Fix: Tab-Auswahl bleibt nach Reload erhalten (localStorage)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-03-07 01:10:01 +01:00
parent 4aed4e70ab
commit c9378f4cdb
8 changed files with 4854 additions and 2 deletions

1
web/dist/assets/index-CcoMcI3c.css vendored Normal file

File diff suppressed because one or more lines are too long

4830
web/dist/assets/index-DD6kbsyw.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
web/dist/earth-night-orig.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 KiB

BIN
web/dist/earth-night.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 KiB

14
web/dist/index.html vendored Normal file
View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Gaming Hub</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🎮</text></svg>" />
<script type="module" crossorigin src="/assets/index-DD6kbsyw.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CcoMcI3c.css">
</head>
<body>
<div id="root"></div>
</body>
</html>

BIN
web/dist/nasa-blue-marble-q90.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
web/dist/nasa-blue-marble.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View file

@ -25,7 +25,12 @@ export function registerTab(pluginName: string, component: React.FC<{ data: any
export default function App() {
const [connected, setConnected] = useState(false);
const [plugins, setPlugins] = useState<PluginInfo[]>([]);
const [activeTab, setActiveTab] = useState<string>('');
const [activeTab, setActiveTabRaw] = useState<string>(() => localStorage.getItem('hub_activeTab') ?? '');
const setActiveTab = (tab: string) => {
setActiveTabRaw(tab);
localStorage.setItem('hub_activeTab', tab);
};
const [pluginData, setPluginData] = useState<Record<string, any>>({});
const eventSourceRef = useRef<EventSource | null>(null);
@ -35,7 +40,9 @@ export default function App() {
.then(r => r.json())
.then((list: PluginInfo[]) => {
setPlugins(list);
if (list.length > 0 && !activeTab) setActiveTab(list[0].name);
const saved = localStorage.getItem('hub_activeTab');
const valid = list.some(p => p.name === saved);
if (list.length > 0 && !valid) setActiveTab(list[0].name);
})
.catch(() => {});
}, []);