diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 777daf8..ce3fc4d 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -6,6 +6,7 @@ import { LayoutDashboard, Database, RefreshCw, + Globe, Package, Heart, Menu, @@ -32,6 +33,8 @@ import Toast from './components/ui/Toast' import Modal from './components/ui/Modal' import NavButton from './components/ui/NavButton' import PayloadButton from './components/ui/PayloadButton' +import PayloadIcon from './components/ui/PayloadIcon' +import PayloadName from './components/ui/PayloadName' import LogoIcon from './components/ui/LogoIcon' import ErrorBoundary from './components/ui/ErrorBoundary' @@ -103,7 +106,7 @@ function App() { const [config, setConfig] = useState({}) const [ip, setIp] = useState('0.0.0.0') const [loading, setLoading] = useState(false) - const [activeLoadingName, setActiveLoadingName] = useState('') + const [activeLoadingPayload, setActiveLoadingPayload] = useState(null) const [launchHistory, setLaunchHistory] = useState([]) const [toasts, setToasts] = useState([]) const [loadingPayloads, setLoadingPayloads] = useState(true) @@ -417,11 +420,11 @@ function App() { window.location.reload() } - const loadPayload = async (slotOrPath, customName) => { + const loadPayload = async (slotOrPath, presentation = {}) => { if (!slotOrPath) return - const name = customName || slotOrPath.split('/').pop().replace(/\.(elf|bin)$/i, '').replace(/_/g, ' ') + const name = presentation.name || slotOrPath.split('/').pop().replace(/\.(elf|bin)$/i, '').replace(/_/g, ' ') setLoading(true) - setActiveLoadingName(name) + setActiveLoadingPayload({ ...presentation, key: slotOrPath, name, path: presentation.path || slotOrPath }) try { const safeParam = encodeURI(slotOrPath) const res = await mutationFetch(`/loadpayload:${safeParam}`) @@ -433,7 +436,7 @@ function App() { } setTimeout(() => { setLoading(false) - setActiveLoadingName('') + setActiveLoadingPayload(null) }, 1500) } @@ -898,6 +901,7 @@ function App() { let author = null let icon = null let sourceName = null + let repositoryName = null if (isUsb) { const parsed = parsePayloadName(itemObj.filename) @@ -914,8 +918,9 @@ function App() { version = itemObj.version || repoMeta?.version || null author = repoMeta?.author || itemObj.author || null icon = repoMeta?.icon || null + repositoryName = itemObj.source_name || repoMeta?.source_name || null if (itemObj.hasDuplicateId || config.MULTI_SOURCES_ENABLED) { - sourceName = itemObj.source_name || repoMeta?.source_name || null + sourceName = repositoryName } } @@ -935,10 +940,13 @@ function App() { return } if (isFavoriteEditMode) toggleFavorite(itemObj.key) - else loadPayload(itemObj.isUsb ? itemObj.path : (itemObj.slot || slotOrKey), displayName) + else loadPayload(itemObj.isUsb ? itemObj.path : (itemObj.slot || slotOrKey), { + name: displayName, path: pathProp, version, icon, + sourceName: repositoryName || sourceName, + }) }} onDelete={() => handleDelete(itemObj.slot || slotOrKey, displayName)} - isLoading={loading && activeLoadingName === (displayName || '').replace(/\.(elf|bin)$/i, '').replace(/_/g, ' ')} + isLoading={loading && activeLoadingPayload?.key === (itemObj.isUsb ? itemObj.path : (itemObj.slot || slotOrKey))} sourceName={sourceName} version={version} icon={icon} @@ -1137,11 +1145,37 @@ function App() { {loading && ( -
{t("app.loading.subtitle", "LAUNCHING PAYLOAD...")}
+{t("app.loading.subtitle", "LAUNCHING PAYLOAD...")}