minor UI tweaks
This commit is contained in:
@@ -248,12 +248,20 @@ body.is-resizing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sub-panel .panel-body {
|
.sub-panel .panel-body {
|
||||||
padding: 0 12px 12px;
|
padding: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-body {
|
.panel-body {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
padding: 0 16px 16px;
|
padding: 12px 16px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-panel .panel-body.panel-body-inherited {
|
||||||
|
padding: 0 12px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-panel .scope-group-inherited {
|
||||||
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel[open] .panel-summary {
|
.panel[open] .panel-summary {
|
||||||
|
|||||||
@@ -132,6 +132,37 @@ function renderGlobalSitesList(sites) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderWorkspaceSitesList(list, workspaceId, sites) {
|
||||||
|
if (!list) return;
|
||||||
|
const ownedSites = (sites || []).filter(
|
||||||
|
(site) => (site.workspaceId || "global") === workspaceId
|
||||||
|
);
|
||||||
|
list.innerHTML = "";
|
||||||
|
if (!ownedSites.length) {
|
||||||
|
const empty = document.createElement("div");
|
||||||
|
empty.className = "hint";
|
||||||
|
empty.textContent = "No sites inherit from this workspace.";
|
||||||
|
list.appendChild(empty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (const site of ownedSites) {
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = "#";
|
||||||
|
link.textContent = site.name || site.urlPattern || "Untitled Site";
|
||||||
|
link.addEventListener("click", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const siteCard = document.querySelector(
|
||||||
|
`.site-card[data-id="${site.id}"]`
|
||||||
|
);
|
||||||
|
if (siteCard) {
|
||||||
|
siteCard.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||||
|
openDetailsChain(document.getElementById("sites-panel"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
list.appendChild(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function applyTheme(theme) {
|
function applyTheme(theme) {
|
||||||
const value = theme || "system";
|
const value = theme || "system";
|
||||||
document.documentElement.dataset.theme = value;
|
document.documentElement.dataset.theme = value;
|
||||||
@@ -1563,7 +1594,7 @@ function renderWorkspaceSection(title, containerClass, items, builder, newItemFa
|
|||||||
details.appendChild(summary);
|
details.appendChild(summary);
|
||||||
|
|
||||||
const body = document.createElement("div");
|
const body = document.createElement("div");
|
||||||
body.className = "panel-body";
|
body.className = "panel-body panel-body-inherited";
|
||||||
body.style.paddingTop = "10px";
|
body.style.paddingTop = "10px";
|
||||||
|
|
||||||
const listContainer = document.createElement("div");
|
const listContainer = document.createElement("div");
|
||||||
@@ -1887,7 +1918,9 @@ function buildScopedModuleSection({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
body.appendChild(buildScopeGroup("Inherited", inheritedList));
|
const inheritedGroup = buildScopeGroup("Inherited", inheritedList);
|
||||||
|
inheritedGroup.classList.add("scope-group-inherited");
|
||||||
|
body.appendChild(inheritedGroup);
|
||||||
|
|
||||||
const localContainer = document.createElement("div");
|
const localContainer = document.createElement("div");
|
||||||
localContainer.className = localContainerClass;
|
localContainer.className = localContainerClass;
|
||||||
@@ -2296,6 +2329,7 @@ function buildWorkspaceCard(ws, allWorkspaces = [], allSites = []) {
|
|||||||
if (confirm(`Delete workspace "${ws.name}"? All items will move to global.`)) {
|
if (confirm(`Delete workspace "${ws.name}"? All items will move to global.`)) {
|
||||||
card.remove();
|
card.remove();
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
|
updateToc(collectWorkspaces(), collectSites());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2430,33 +2464,9 @@ function buildWorkspaceCard(ws, allWorkspaces = [], allSites = []) {
|
|||||||
const sitesBody = document.createElement("div");
|
const sitesBody = document.createElement("div");
|
||||||
sitesBody.className = "panel-body";
|
sitesBody.className = "panel-body";
|
||||||
const siteList = document.createElement("div");
|
const siteList = document.createElement("div");
|
||||||
siteList.className = "sites-list";
|
siteList.className = "sites-list workspace-sites-list";
|
||||||
const ownedSites = (allSites || []).filter(
|
siteList.dataset.workspaceId = card.dataset.id;
|
||||||
(site) => (site.workspaceId || "global") === card.dataset.id
|
renderWorkspaceSitesList(siteList, card.dataset.id, allSites);
|
||||||
);
|
|
||||||
if (!ownedSites.length) {
|
|
||||||
const empty = document.createElement("div");
|
|
||||||
empty.className = "hint";
|
|
||||||
empty.textContent = "No sites inherit from this workspace.";
|
|
||||||
siteList.appendChild(empty);
|
|
||||||
} else {
|
|
||||||
for (const site of ownedSites) {
|
|
||||||
const link = document.createElement("a");
|
|
||||||
link.href = "#";
|
|
||||||
link.textContent = site.name || site.urlPattern || "Untitled Site";
|
|
||||||
link.addEventListener("click", (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
const siteCard = document.querySelector(
|
|
||||||
`.site-card[data-id="${site.id}"]`
|
|
||||||
);
|
|
||||||
if (siteCard) {
|
|
||||||
siteCard.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
||||||
openDetailsChain(document.getElementById("sites-panel"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
siteList.appendChild(link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sitesBody.appendChild(siteList);
|
sitesBody.appendChild(siteList);
|
||||||
sitesSection.appendChild(sitesBody);
|
sitesSection.appendChild(sitesBody);
|
||||||
card.appendChild(sitesSection);
|
card.appendChild(sitesSection);
|
||||||
@@ -2592,6 +2602,7 @@ function buildSiteCard(site, allWorkspaces = []) {
|
|||||||
deleteBtn.addEventListener("click", () => {
|
deleteBtn.addEventListener("click", () => {
|
||||||
card.remove();
|
card.remove();
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
|
updateToc(collectWorkspaces(), collectSites());
|
||||||
});
|
});
|
||||||
|
|
||||||
row.appendChild(nameField);
|
row.appendChild(nameField);
|
||||||
@@ -3240,6 +3251,7 @@ function updateSidebarErrors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sites = collectSites();
|
||||||
const patterns = siteCards
|
const patterns = siteCards
|
||||||
.map((card) => (card.querySelector(".site-pattern")?.value || "").trim())
|
.map((card) => (card.querySelector(".site-pattern")?.value || "").trim())
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
@@ -3255,16 +3267,22 @@ function updateSidebarErrors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
workspaceCards.forEach((card) => {
|
||||||
|
const list = card.querySelector(".workspace-sites-list");
|
||||||
|
if (!list) return;
|
||||||
|
renderWorkspaceSitesList(list, card.dataset.id, sites);
|
||||||
|
});
|
||||||
|
|
||||||
if (!errors.length) {
|
if (!errors.length) {
|
||||||
sidebarErrorsEl.classList.add("hidden");
|
sidebarErrorsEl.classList.add("hidden");
|
||||||
sidebarErrorsEl.textContent = "";
|
sidebarErrorsEl.textContent = "";
|
||||||
renderGlobalSitesList(collectSites());
|
renderGlobalSitesList(sites);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sidebarErrorsEl.textContent = errors.map((error) => `- ${error}`).join("\n");
|
sidebarErrorsEl.textContent = errors.map((error) => `- ${error}`).join("\n");
|
||||||
sidebarErrorsEl.classList.remove("hidden");
|
sidebarErrorsEl.classList.remove("hidden");
|
||||||
renderGlobalSitesList(collectSites());
|
renderGlobalSitesList(sites);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadSettings() {
|
async function loadSettings() {
|
||||||
@@ -3664,7 +3682,7 @@ async function loadSettings() {
|
|||||||
|
|
||||||
workspacesContainer.innerHTML = "";
|
workspacesContainer.innerHTML = "";
|
||||||
for (const ws of workspaces) {
|
for (const ws of workspaces) {
|
||||||
workspacesContainer.appendChild(buildWorkspaceCard(ws, workspaces));
|
workspacesContainer.appendChild(buildWorkspaceCard(ws, workspaces, sites));
|
||||||
}
|
}
|
||||||
|
|
||||||
sitesContainer.innerHTML = "";
|
sitesContainer.innerHTML = "";
|
||||||
@@ -4008,6 +4026,13 @@ function updateToc(workspaces, sites) {
|
|||||||
sitesList.appendChild(li);
|
sitesList.appendChild(li);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const workspaceCards = document.querySelectorAll(".workspace-card");
|
||||||
|
workspaceCards.forEach((card) => {
|
||||||
|
const list = card.querySelector(".workspace-sites-list");
|
||||||
|
if (!list) return;
|
||||||
|
renderWorkspaceSitesList(list, card.dataset.id, sites);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initToc() {
|
function initToc() {
|
||||||
|
|||||||
Reference in New Issue
Block a user