implemented dynamic theme loading, working on user edit

This commit is contained in:
2025-07-01 22:24:23 +02:00
parent 691c317a57
commit 684e0b00dd
12 changed files with 178 additions and 61 deletions

View File

@@ -9,12 +9,22 @@
import User from "./routes/user/User.svelte";
let translations_ready = false;
let translations_ready = $state(false);
onMount(async () => {
await loadTranslation('de','Login');
translations_ready = true;
});
function loadTheme(name){
if (!name) return;
console.log({theme:name});
const url = `${location.protocol}//${location.host.replace('5173','8080')}/css/${name}.css`;
fetch(url).then(resp => resp.text()).then(css => {
document.getElementById('usercss').innerText = css;
});
}
$effect(() => loadTheme(user.theme));
</script>
{#if translations_ready }