fix(ui): admin panel, profile: restore missing icons library

This commit is contained in:
Edouard Vanbelle
2026-05-07 13:54:59 +02:00
parent 405721c679
commit 93d9a21013
7 changed files with 37 additions and 23 deletions
+3
View File
@@ -5,6 +5,7 @@
import { formatFileSize, formatQuotaSize } from '../core/formatters.js';
import { i18n } from '../core/i18n.js';
import { oxiIconsInit } from '../core/icons.js';
import { Modal } from '../core/modal.js';
import { fileOps } from '../features/files/fileOperations.js';
import { multiSelect } from '../features/files/multiSelect.js';
@@ -334,6 +335,8 @@ function switchSectionTo(section) {
* Initialize the application
*/
function initApp() {
oxiIconsInit();
// Cache DOM elements
cacheElements();
+14 -14
View File
@@ -15,7 +15,7 @@
// All icons use viewBox="0 0 {width} 512" and fill="currentColor".
// Keys use FA5 class names (without "fa-" prefix) for backward compatibility.
const _ICONS = {
const OxiIcons = {
'arrow-left': [
448,
'M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z'
@@ -430,7 +430,7 @@ const _ICONS = {
* @returns {string} SVG markup string, or empty string if icon not found
*/
function oxiIcon(name, extraClass) {
const entry = _ICONS[name];
const entry = OxiIcons[name];
if (!entry) return '';
const [w, d] = entry;
const cls = extraClass ? `oxi-icon ${extraClass}` : 'oxi-icon';
@@ -477,13 +477,13 @@ function replaceIconsInElement(container) {
}
// Use outline variant if available and element uses "far"
if (isRegular && _ICONS[`${iconName}-outline`]) {
if (isRegular && OxiIcons[`${iconName}-outline`]) {
iconName = `${iconName}-outline`;
}
if (!iconName || !_ICONS[iconName]) continue;
if (!iconName || !OxiIcons[iconName]) continue;
const [w, d] = _ICONS[iconName];
const [w, d] = OxiIcons[iconName];
// Build SVG element
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
@@ -510,14 +510,7 @@ function replaceIconsInElement(container) {
}
}
// ── Expose globally ────────────────────────────────────────────
export { oxiIcon, replaceIconsInElement };
export const OxiIcons = _ICONS;
// ── Auto-replace: MutationObserver bridge ──────────────────────
// Watches the DOM for new <i class="fa-..."> elements and converts them
// to inline SVGs automatically. Debounced to at most once per frame.
(function autoReplace() {
function oxiIconsInit() {
let raf = 0;
const scan = () => {
raf = 0;
@@ -541,4 +534,11 @@ export const OxiIcons = _ICONS;
}
}
}).observe(document.documentElement, { childList: true, subtree: true });
})();
}
// ── Expose globally ────────────────────────────────────────────
export { OxiIcons, oxiIcon, oxiIconsInit, replaceIconsInElement };
// ── Auto-replace: MutationObserver bridge ──────────────────────
// Watches the DOM for new <i class="fa-..."> elements and converts them
// to inline SVGs automatically. Debounced to at most once per frame.
+2
View File
@@ -1,6 +1,7 @@
import { getCsrfHeaders } from '../../core/csrf.js';
import { escapeHtml } from '../../core/formatters.js';
import { i18n } from '../../core/i18n.js';
import { oxiIconsInit } from '../../core/icons.js';
const API = '/api';
let currentAdminId = '';
@@ -1041,6 +1042,7 @@ async function completeMigration() {
async function init() {
try {
oxiIconsInit();
const me = await fetch(`${API}/auth/me`, {
headers: headers(),
credentials: 'same-origin'
@@ -1,5 +1,6 @@
// device-verify.js — Extracted from inline <script> in device-verify.html
import { getCsrfHeaders } from '../../core/csrf.js';
import { oxiIconsInit } from '../../core/icons.js';
(() => {
var API_BASE = window.location.origin;
@@ -12,6 +13,8 @@ import { getCsrfHeaders } from '../../core/csrf.js';
var debounceTimer = null;
var currentCode = '';
oxiIconsInit();
// Pre-fill from URL query param (?code=ABCD-1234)
var params = new URLSearchParams(window.location.search);
if (params.get('code')) {
+2
View File
@@ -1,5 +1,6 @@
import { getCsrfHeaders } from '../../core/csrf.js';
import { i18n } from '../../core/i18n.js';
import { oxiIconsInit } from '../../core/icons.js';
const API = '/api';
@@ -29,6 +30,7 @@ function timeAgo(dateStr) {
async function init() {
try {
oxiIconsInit();
const resp = await fetch(`${API}/auth/me`, {
headers: headers(),
credentials: 'same-origin'
+4
View File
@@ -1,3 +1,5 @@
import { oxiIconsInit } from '../../core/icons';
/**
* publicShare.js — Client-side logic for the public share page (/s/{token}).
*
@@ -27,6 +29,8 @@
const tokenIdx = pathParts.indexOf('s');
const TOKEN = tokenIdx !== -1 ? pathParts[tokenIdx + 1] : null;
oxiIconsInit();
if (!TOKEN) {
showState('expired');
$expiredMsg.textContent = 'Invalid share link.';