Merge pull request #1275 from ShivangiKakkar/fixes-256
#256 disables edit-container button when no container is present
This commit is contained in:
commit
220b902144
2 changed files with 17 additions and 2 deletions
|
@ -45,6 +45,7 @@ body {
|
||||||
--small-text-size: 0.833rem; /* 10px */
|
--small-text-size: 0.833rem; /* 10px */
|
||||||
--small-radius: 3px;
|
--small-radius: 3px;
|
||||||
--icon-button-size: calc(calc(var(--block-line-separation-size) * 2) + 1.66rem); /* 20px */
|
--icon-button-size: calc(calc(var(--block-line-separation-size) * 2) + 1.66rem); /* 20px */
|
||||||
|
--inactive-opacity: 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-resolution: 1dppx) {
|
@media (min-resolution: 1dppx) {
|
||||||
|
@ -578,6 +579,11 @@ span ~ .panel-header-text {
|
||||||
max-inline-size: 204px;
|
max-inline-size: 204px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disable-edit-containers {
|
||||||
|
opacity: var(--inactive-opacity);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.userContext-wrapper {
|
.userContext-wrapper {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -506,8 +506,10 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||||
Logic.showPanel(P_CONTAINER_EDIT, { name: Logic.generateIdentityName() });
|
Logic.showPanel(P_CONTAINER_EDIT, { name: Logic.generateIdentityName() });
|
||||||
});
|
});
|
||||||
|
|
||||||
Logic.addEnterHandler(document.querySelector("#edit-containers-link"), () => {
|
Logic.addEnterHandler(document.querySelector("#edit-containers-link"), (e) => {
|
||||||
Logic.showPanel(P_CONTAINERS_EDIT);
|
if (!e.target.classList.contains("disable-edit-containers")){
|
||||||
|
Logic.showPanel(P_CONTAINERS_EDIT);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Logic.addEnterHandler(document.querySelector("#sort-containers-link"), async function () {
|
Logic.addEnterHandler(document.querySelector("#sort-containers-link"), async function () {
|
||||||
|
@ -687,6 +689,13 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||||
document.addEventListener("mousedown", () => {
|
document.addEventListener("mousedown", () => {
|
||||||
document.removeEventListener("focus", focusHandler);
|
document.removeEventListener("focus", focusHandler);
|
||||||
});
|
});
|
||||||
|
/* If no container is present disable the Edit Containers button */
|
||||||
|
const editContainer = document.querySelector("#edit-containers-link");
|
||||||
|
if (Logic.identities().length === 0) {
|
||||||
|
editContainer.classList.add("disable-edit-containers");
|
||||||
|
} else {
|
||||||
|
editContainer.classList.remove("disable-edit-containers");
|
||||||
|
}
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue