BTHLABS-60: Appearance settings

Co-authored-by: Tomek Wójcik <labs@tomekwojcik.pl>
Co-committed-by: Tomek Wójcik <labs@tomekwojcik.pl>
This commit is contained in:
2025-10-07 04:42:58 +00:00
committed by Tomek Wójcik
parent b4d5375954
commit 2e8b8d7330
11 changed files with 102 additions and 9 deletions

View File

@@ -46,3 +46,33 @@ def version(request: HttpRequest) -> dict:
return {
'VERSION': backend_version,
}
def appearance_settings(request: HttpRequest) -> dict:
theme = 'hotpocket'
result = {
'theme': theme,
'light_mode': False,
'theme_css': 'ui/css/bootstrap-hotpocket.min.css',
}
if request.user.is_anonymous is False:
theme = request.user.settings.get('theme', 'hotpocket')
result.update({
'theme': theme,
'light_mode': request.user.settings['light_mode'],
})
match theme:
case 'bootstrap':
result['theme_css'] = 'ui/css/bootstrap.min.css'
case 'cosmo':
result['theme_css'] = 'ui/css/cosmo.min.css'
case 'solar':
result['theme_css'] = 'ui/css/solar.min.css'
return {
'APPEARANCE_SETTINGS': result,
}