From 60307d364d132e49134cec2d815528d34237242d Mon Sep 17 00:00:00 2001 From: Araozu Date: Sun, 27 Oct 2024 17:44:51 -0500 Subject: [PATCH] feat: dark theme --- .gitignore | 1 + public/css/input.css | 17 ++++++ src/modules/album/album.templ | 4 +- src/modules/album/album_templ.go | 28 +++++----- src/modules/auth/login_templ.go | 2 +- src/modules/index/index.templ | 4 +- src/modules/index/index_templ.go | 14 ++--- src/utils/utils.templ | 26 +++++---- src/utils/utils_templ.go | 96 ++++++++++++++++---------------- tailwind.config.cjs | 7 ++- 10 files changed, 112 insertions(+), 87 deletions(-) diff --git a/.gitignore b/.gitignore index 09a5f1d..00c64cd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ public/css/output.css .env tmp main +src/**/*.txt diff --git a/public/css/input.css b/public/css/input.css index a8eb458..3bc90d3 100644 --- a/public/css/input.css +++ b/public/css/input.css @@ -2,6 +2,23 @@ @tailwind components; @tailwind utilities; +:root { + --c-bg: #01040a; + --c-on-bg: white; +} + +@media (prefers-color-scheme: light) { + :root { + --c-bg: white; + --c-on-bg: black; + } +} + +html { + background-color: var(--c-bg); + color: var(--c-on-bg); +} + body { font-family: "Atkinson Hyperlegible", sans-serif; } diff --git a/src/modules/album/album.templ b/src/modules/album/album.templ index 64f6415..8ecccc1 100644 --- a/src/modules/album/album.templ +++ b/src/modules/album/album.templ @@ -25,7 +25,7 @@ templ allAlbumsTempl(albums []utils.Album) { />
-
+
for _, album := range albums { @index.AlbumCard(album) } @@ -67,7 +67,7 @@ templ albumTempl(albumId string, album *utils.Album, songs []utils.Song, songsJs
for i, song := range songs { ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 13) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 14) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/src/modules/auth/login_templ.go b/src/modules/auth/login_templ.go index ab86c6d..1bbad50 100644 --- a/src/modules/auth/login_templ.go +++ b/src/modules/auth/login_templ.go @@ -43,7 +43,7 @@ func LoginTempl() templ.Component { }() } ctx = templ.InitializeContext(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Login to Navidrome:




Result:
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/src/modules/index/index.templ b/src/modules/index/index.templ index 7cf406c..892defe 100644 --- a/src/modules/index/index.templ +++ b/src/modules/index/index.templ @@ -13,7 +13,7 @@ templ IndexTempl(albums []utils.Album) {

Random Albums

-
+
for _, album := range albums { @AlbumCard(album) } @@ -23,7 +23,7 @@ templ IndexTempl(albums []utils.Album) { } templ AlbumCard(album utils.Album) { -
+
music to go

Random Albums

") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -56,7 +56,7 @@ func IndexTempl(albums []utils.Album) templ.Component { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -95,7 +95,7 @@ func AlbumCard(album utils.Album) templ.Component { templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -130,7 +130,7 @@ func AlbumCard(album utils.Album) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -143,7 +143,7 @@ func AlbumCard(album utils.Album) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/src/utils/utils.templ b/src/utils/utils.templ index 3c37ac5..a9426a1 100644 --- a/src/utils/utils.templ +++ b/src/utils/utils.templ @@ -30,7 +30,7 @@ templ SkeletonTempl() { templ MusicPlayer() {
this.checkDuration(), 1000); + clearInterval(this.listenerInterval); + this.listenerInterval = setInterval(() => this.checkDuration(), 1000); }, // Plays the song at the passed idx, sets this.idx to that, @@ -247,7 +249,7 @@ templ MusicPlayer() { } templ fullMusicPlayer() { -