icons: sidebar item icon remap and desktop label overrides
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
843774e695
commit
a217ea104a
|
|
@ -250,6 +250,24 @@
|
||||||
iconContainer.appendChild(parts.chrome);
|
iconContainer.appendChild(parts.chrome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var DESKTOP_LABEL_OVERRIDES = {
|
||||||
|
"Frappe HR": "HR",
|
||||||
|
"ERPNext Settings": "Settings"
|
||||||
|
};
|
||||||
|
|
||||||
|
function renameDesktopLabels() {
|
||||||
|
Object.keys(DESKTOP_LABEL_OVERRIDES).forEach(function (id) {
|
||||||
|
var newLabel = DESKTOP_LABEL_OVERRIDES[id];
|
||||||
|
document.querySelectorAll('.desktop-icon[data-id="' + id + '"]').forEach(function (icon) {
|
||||||
|
var title = icon.querySelector(".icon-title");
|
||||||
|
if (title && title.textContent.trim() !== newLabel) {
|
||||||
|
title.textContent = newLabel;
|
||||||
|
title.setAttribute("data-original-title", newLabel);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function processIcons() {
|
function processIcons() {
|
||||||
document.querySelectorAll(
|
document.querySelectorAll(
|
||||||
".desktop-icon > .icon-container:not(.jey-chrome-done)"
|
".desktop-icon > .icon-container:not(.jey-chrome-done)"
|
||||||
|
|
@ -262,6 +280,7 @@
|
||||||
".desktop-icon > .icon-container.folder-icon:not(.jey-chrome-done)"
|
".desktop-icon > .icon-container.folder-icon:not(.jey-chrome-done)"
|
||||||
).forEach(wrapIcon);
|
).forEach(wrapIcon);
|
||||||
|
|
||||||
|
renameDesktopLabels();
|
||||||
staggerAnimations();
|
staggerAnimations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -325,6 +344,200 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ==================================================================
|
||||||
|
Workspace sidebar item icon remap
|
||||||
|
Rewrites <use href="#icon-NAME"> inside .sidebar-item-icon[item-icon]
|
||||||
|
to point at a different but semantically related sprite id.
|
||||||
|
Idempotent via .jey-side-item-done marker class.
|
||||||
|
================================================================== */
|
||||||
|
|
||||||
|
var SIDEBAR_ITEM_ICON_MAP = {
|
||||||
|
/* ERPNext / timeless legacy names */
|
||||||
|
"home": "house",
|
||||||
|
"accounting": "landmark",
|
||||||
|
"assets": "warehouse",
|
||||||
|
"buying": "shopping-cart",
|
||||||
|
"crm": "handshake",
|
||||||
|
"customer": "contact-round",
|
||||||
|
"customization": "palette",
|
||||||
|
"expenses": "banknote-arrow-up",
|
||||||
|
"getting-started": "rocket",
|
||||||
|
"hr": "users-round",
|
||||||
|
"integration": "plug-2",
|
||||||
|
"liabilities": "scale",
|
||||||
|
"loan": "piggy-bank",
|
||||||
|
"money-coins-1": "coins",
|
||||||
|
"non-profit": "heart-handshake",
|
||||||
|
"organization": "building-2",
|
||||||
|
"project": "folder-kanban",
|
||||||
|
"projects": "kanban",
|
||||||
|
"quality": "badge-check",
|
||||||
|
"sell": "trending-up",
|
||||||
|
"setting": "settings-2",
|
||||||
|
"stock": "package-2",
|
||||||
|
"support": "headphones",
|
||||||
|
"tool": "wrench",
|
||||||
|
"web": "earth",
|
||||||
|
"website": "globe",
|
||||||
|
"chart": "chart-column",
|
||||||
|
"criticize": "thumbs-down",
|
||||||
|
"review": "book-open-check",
|
||||||
|
"image-view": "image",
|
||||||
|
"up-arrow": "arrow-up",
|
||||||
|
"table_2": "table-properties",
|
||||||
|
"book-text": "library",
|
||||||
|
|
||||||
|
/* Lucide names found in workspace_sidebar fixtures */
|
||||||
|
"arrow-down-from-line": "download",
|
||||||
|
"arrow-left-to-line": "panel-left-close",
|
||||||
|
"arrow-right-from-line": "log-out",
|
||||||
|
"at-sign": "mail",
|
||||||
|
"badge-alert": "triangle-alert",
|
||||||
|
"badge-cent": "circle-dollar-sign",
|
||||||
|
"banknote-arrow-up": "trending-up",
|
||||||
|
"banknote-x": "receipt",
|
||||||
|
"bell": "bell-ring",
|
||||||
|
"bell-dot": "bell-ring",
|
||||||
|
"bell-ring": "megaphone",
|
||||||
|
"book-open-check": "clipboard-check",
|
||||||
|
"book-open-text": "book-marked",
|
||||||
|
"book-user": "contact-round",
|
||||||
|
"briefcase-business": "briefcase",
|
||||||
|
"building-2": "landmark",
|
||||||
|
"cable": "network",
|
||||||
|
"calendar-check": "calendar-check-2",
|
||||||
|
"calendar-check-2": "calendar-fold",
|
||||||
|
"calendar-clock": "timer",
|
||||||
|
"calendar-days": "calendar-range",
|
||||||
|
"calendar-heart": "heart",
|
||||||
|
"calendar-range": "calendar-fold",
|
||||||
|
"calendar-sync": "rotate-cw",
|
||||||
|
"caravan": "tent",
|
||||||
|
"circle-dollar-sign": "coins",
|
||||||
|
"circle-user-round": "user-round",
|
||||||
|
"clipboard-check": "clipboard-list",
|
||||||
|
"clipboard-pen": "notebook-pen",
|
||||||
|
"computer": "monitor",
|
||||||
|
"database": "hard-drive",
|
||||||
|
"database-backup": "save",
|
||||||
|
"dollar-sign": "coins",
|
||||||
|
"earth": "globe",
|
||||||
|
"factory": "warehouse",
|
||||||
|
"file": "file-text",
|
||||||
|
"file-lock": "shield",
|
||||||
|
"file-question-mark": "file-text",
|
||||||
|
"file-up": "upload",
|
||||||
|
"file-user": "contact-round",
|
||||||
|
"flag": "flame",
|
||||||
|
"folder-tree": "list-tree",
|
||||||
|
"funnel": "filter",
|
||||||
|
"git-pull-request-arrow": "git-branch",
|
||||||
|
"goal": "target",
|
||||||
|
"graduation-cap": "school",
|
||||||
|
"grid-2x2-check": "layout-grid",
|
||||||
|
"hammer": "wrench",
|
||||||
|
"heading": "text",
|
||||||
|
"heart-pulse": "stethoscope",
|
||||||
|
"import": "file-up",
|
||||||
|
"inspection-panel": "clipboard-check",
|
||||||
|
"laptop": "monitor",
|
||||||
|
"layout-dashboard": "gauge",
|
||||||
|
"lightbulb": "zap",
|
||||||
|
"link": "link-2",
|
||||||
|
"list": "list-checks",
|
||||||
|
"list-end": "list-ordered",
|
||||||
|
"list-todo": "clipboard-list",
|
||||||
|
"list-tree": "folder-tree",
|
||||||
|
"lock-keyhole": "shield",
|
||||||
|
"lock-keyhole-open": "shield-alert",
|
||||||
|
"logs": "scroll-text",
|
||||||
|
"mail": "mail-open",
|
||||||
|
"mail-x": "inbox",
|
||||||
|
"message-square-reply": "speech",
|
||||||
|
"milestone": "flag",
|
||||||
|
"monitor-check": "square-check",
|
||||||
|
"move-horizontal": "arrow-left-right",
|
||||||
|
"notebook-pen": "square-pen",
|
||||||
|
"notebook-text": "notepad-text",
|
||||||
|
"notepad-text": "scroll-text",
|
||||||
|
"orbit": "atom",
|
||||||
|
"panel-bottom-close": "panel-top-open",
|
||||||
|
"panel-top-close": "panel-bottom-open",
|
||||||
|
"pen-tool": "pen-line",
|
||||||
|
"person-standing": "user-round",
|
||||||
|
"piggy-bank": "vault",
|
||||||
|
"plane": "send",
|
||||||
|
"pointer": "mouse-pointer-2",
|
||||||
|
"printer": "file-output",
|
||||||
|
"receipt": "receipt-text",
|
||||||
|
"receipt-text": "scroll-text",
|
||||||
|
"repeat": "rotate-cw",
|
||||||
|
"repeat-2": "rotate-ccw",
|
||||||
|
"scroll-text": "book-text",
|
||||||
|
"server": "database",
|
||||||
|
"settings": "sliders-horizontal",
|
||||||
|
"sheet": "file-spreadsheet",
|
||||||
|
"split": "git-branch",
|
||||||
|
"sprout": "leaf",
|
||||||
|
"square-activity": "heart-pulse",
|
||||||
|
"square-pen": "pen-line",
|
||||||
|
"square-user-round": "contact-round",
|
||||||
|
"star": "sparkles",
|
||||||
|
"table": "table-2",
|
||||||
|
"thumbs-up": "heart",
|
||||||
|
"trash": "archive",
|
||||||
|
"trending-down": "chart-line",
|
||||||
|
"triangle": "triangle-alert",
|
||||||
|
"truck": "ship",
|
||||||
|
"tv-minimal": "monitor",
|
||||||
|
"upload": "cloud-upload",
|
||||||
|
"user": "user-round",
|
||||||
|
"user-cog": "user-round-cog",
|
||||||
|
"user-lock": "shield",
|
||||||
|
"user-round": "circle-user-round",
|
||||||
|
"user-round-check": "user-check",
|
||||||
|
"user-round-minus": "user-x",
|
||||||
|
"user-star": "award",
|
||||||
|
"users": "users-round",
|
||||||
|
"users-round": "contact-round",
|
||||||
|
"videotape": "film",
|
||||||
|
"wallpaper": "image",
|
||||||
|
"washing-machine": "container",
|
||||||
|
"webhook": "cable"
|
||||||
|
};
|
||||||
|
|
||||||
|
function processSidebarItemIcons() {
|
||||||
|
var nodes = document.querySelectorAll(
|
||||||
|
".body-sidebar .sidebar-item-icon[item-icon]:not(.jey-side-item-done)"
|
||||||
|
);
|
||||||
|
if (!nodes.length) return;
|
||||||
|
|
||||||
|
for (var i = 0; i < nodes.length; i++) {
|
||||||
|
var span = nodes[i];
|
||||||
|
var from = (span.getAttribute("item-icon") || "").trim().toLowerCase();
|
||||||
|
|
||||||
|
// Always mark done — even on unknown / identity — so we never revisit.
|
||||||
|
span.classList.add("jey-side-item-done");
|
||||||
|
|
||||||
|
var to = SIDEBAR_ITEM_ICON_MAP[from];
|
||||||
|
if (!to || to === from) continue;
|
||||||
|
|
||||||
|
var useEl = span.querySelector("svg > use");
|
||||||
|
if (!useEl) continue;
|
||||||
|
|
||||||
|
var newHref = "#icon-" + to;
|
||||||
|
if (useEl.getAttribute("href") !== newHref) {
|
||||||
|
useEl.setAttribute("href", newHref);
|
||||||
|
}
|
||||||
|
if (useEl.hasAttribute("xlink:href") &&
|
||||||
|
useEl.getAttribute("xlink:href") !== newHref) {
|
||||||
|
useEl.setAttribute("xlink:href", newHref);
|
||||||
|
}
|
||||||
|
span.setAttribute("data-jey-orig-icon", from);
|
||||||
|
span.setAttribute("item-icon", to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ==================================================================
|
/* ==================================================================
|
||||||
Rebuild all icons (called on theme switch)
|
Rebuild all icons (called on theme switch)
|
||||||
================================================================== */
|
================================================================== */
|
||||||
|
|
@ -349,6 +562,7 @@
|
||||||
processIcons();
|
processIcons();
|
||||||
processContextMenuIcons();
|
processContextMenuIcons();
|
||||||
processSidebarIcons();
|
processSidebarIcons();
|
||||||
|
processSidebarItemIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expose for theme switcher
|
// Expose for theme switcher
|
||||||
|
|
@ -358,7 +572,7 @@
|
||||||
Boot
|
Boot
|
||||||
================================================================== */
|
================================================================== */
|
||||||
|
|
||||||
function processAll() { processIcons(); processContextMenuIcons(); processSidebarIcons(); }
|
function processAll() { processIcons(); processContextMenuIcons(); processSidebarIcons(); processSidebarItemIcons(); }
|
||||||
|
|
||||||
$(document).on("page-change", processAll);
|
$(document).on("page-change", processAll);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue