Implemented frontend configuration service and dynamic theme reloading integration. Updated sidebar to display dynamic application name.
All checks were successful
Dev Publish: Nuget / Publish Dev Packages (push) Successful in 48s

This commit was merged in pull request #6.
This commit is contained in:
2026-01-19 10:55:34 +01:00
parent d85b07bde7
commit 4187f9da4e
7 changed files with 70 additions and 9 deletions

View File

@@ -12,8 +12,9 @@
<script type="importmap"></script>
<script>
window.themeLoader = {
window.frontendConfig = {
STYLE_TAG_ID: 'theme-variables',
configuration: {},
applyTheme: function(cssContent) {
// Find or create the style tag
@@ -29,25 +30,33 @@
styleTag.textContent = cssContent;
},
loadInitialThemeSync: function() {
reloadConfiguration: function (){
try {
const xhr = new XMLHttpRequest();
xhr.open('GET', '/api/frontend/config', false);
xhr.send(null);
if (xhr.status === 200) {
const config = JSON.parse(xhr.responseText);
this.applyTheme(config.themeCss);
document.title = config.name;
this.configuration = JSON.parse(xhr.responseText);
}
} catch (error) {
console.error('Failed to load initial theme:', error);
}
},
getConfiguration: function (){
return this.configuration;
},
reload: function () {
this.reloadConfiguration();
document.title = this.configuration.name;
this.applyTheme(this.configuration.themeCss);
}
};
window.themeLoader.loadInitialThemeSync();
window.frontendConfig.reload();
</script>
</head>