summaryrefslogtreecommitdiffstats
path: root/apps/portal/src/index.html
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-06-05 21:50:26 +0200
committerivarlovlie <git@ivarlovlie.no>2022-06-05 21:50:26 +0200
commit44a95927edb532f8982cf24c03d9fdd129016bd6 (patch)
treecd0efffc182f9429f8ec2bfe9622e6d36446f112 /apps/portal/src/index.html
parent54b63daf1b5cefb54a3c616a4fee3ef57a671936 (diff)
downloadgreatoffice-44a95927edb532f8982cf24c03d9fdd129016bd6.tar.xz
greatoffice-44a95927edb532f8982cf24c03d9fdd129016bd6.zip
feat: Implement new theme switcher component and backend
The theme is now shared between the domain returned by base_domain()
Diffstat (limited to 'apps/portal/src/index.html')
-rw-r--r--apps/portal/src/index.html15
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/portal/src/index.html b/apps/portal/src/index.html
index 0bf1fb1..25de7d3 100644
--- a/apps/portal/src/index.html
+++ b/apps/portal/src/index.html
@@ -26,16 +26,23 @@
<link rel="icon"
href="./_assets/pwa/favicon.svg">
<script>
- const currentTheme = localStorage.getItem("theme");
+ const value = `; ${document.cookie}`;
+ const parts = value.split(`; go_theme=`);
+ let currentTheme = "system";
+ if (parts.length === 2) {
+ currentTheme = parts.pop().split(";").shift();
+ }
if (currentTheme === "light") {
document.querySelector("html").dataset.theme = "light";
- } else {
+ } else if (currentTheme === "dark") {
document.querySelector("html").dataset.theme = "dark";
+ } else {
+ document.querySelector("html").dataset.theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
}
</script>
<link rel="stylesheet"
href="./_assets/pre.css">
- <title>Projects - Greatoffice</title>
+ <title>Portal - Greatoffice</title>
</head>
<body>
@@ -47,7 +54,7 @@
<div class="fill-loader fill-loader--v4"
id="loader"
role="alert">
- <p class="fill-loader__label">Loading Projects...</p>
+ <p class="fill-loader__label">Loading Portal...</p>
<div aria-hidden="true">
<div class="fill-loader__base"></div>
<div class="fill-loader__fill"></div>