Skip to content

Commit

Permalink
Improve dark mode (#55)
Browse files Browse the repository at this point in the history
* Improve dark mode

* Fix tests
  • Loading branch information
reaper47 authored Jan 7, 2025
1 parent c985fd1 commit 7d71af3
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 42 deletions.
10 changes: 5 additions & 5 deletions src/model/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,25 @@ impl Release {
}

html.push_str(&format!(
"<li><a href=\"{}\" target=\"_blank\">Youtube</a></li>",
"<li><a href=\"{}\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">Youtube</a></li>",
self.url_youtube
));

if let Some(url) = &artist.url_bandcamp {
html.push_str(&format!(
"<li><a href=\"{url}\" target=\"_blank\">Bandcamp</a></li>"
"<li><a href=\"{url}\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">Bandcamp</a></li>"
));
}

if let Some(url) = &artist.url_metallum {
html.push_str(&format!(
"<li><a href=\"{url}\" target=\"_blank\">Metallum (band)</a></li>"
"<li><a href=\"{url}\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">Metallum (band)</a></li>"
));
}

if let Some(url) = &self.url_metallum {
html.push_str(&format!(
"<li><a href=\"{url}\" target=\"_blank\">Metallum (album)</a></li>"
"<li><a href=\"{url}\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">Metallum (album)</a></li>"
));
}

Expand Down Expand Up @@ -407,7 +407,7 @@ mod tests {

let got = release.to_html(&artist);

let want = "<li style=\"margin-bottom: 1rem\"><b>Wintersun - Time II</b><ul><li>Symphonic Melodic Death Metal</li><li>Full-Length</li><li><a href=\"https://www.youtube.com\" target=\"_blank\">Youtube</a></li><li><a href=\"https://wintersun.bandcamp.com\" target=\"_blank\">Bandcamp</a></li><li><a href=\"https://www.metal-archives.com/band/wintersun\" target=\"_blank\">Metallum (band)</a></li><li><a href=\"https://www.metal-archives.com\" target=\"_blank\">Metallum (album)</a></li></ul></li>";
let want = "<li style=\"margin-bottom: 1rem\"><b>Wintersun - Time II</b><ul><li>Symphonic Melodic Death Metal</li><li>Full-Length</li><li><a href=\"https://www.youtube.com\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">Youtube</a></li><li><a href=\"https://wintersun.bandcamp.com\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">Bandcamp</a></li><li><a href=\"https://www.metal-archives.com/band/wintersun\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">Metallum (band)</a></li><li><a href=\"https://www.metal-archives.com\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">Metallum (album)</a></li></ul></li>";
pretty_assertions::assert_eq!(got, want);
}
}
3 changes: 3 additions & 0 deletions src/scraper/wiki.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,7 @@ mod tests {
(
7,
vec![
Release::new("16", "Guides for the Misguided"),
Release::new("Dream Theater", "Parasomnia"),
Release::new("Impending Doom", "Towards the Light (EP)"),
Release::new("Jinjer", "Duél"),
Expand Down Expand Up @@ -2212,6 +2213,7 @@ mod tests {
Release::new("Architects", "The Sky, the Earth & All Between"),
Release::new("Avantasia", "Here Be Dragons"),
Release::new("Brainstorm", "Plague of Rats"),
Release::new("Cloakroom", "Last Leg of the Human Table"),
Release::new(
"Dirkschneider",
"Balls to the Wall – Reloaded (covers album)",
Expand Down Expand Up @@ -2241,6 +2243,7 @@ mod tests {
),
Release::new("Nightstalker", "Return from the Point of No Return"),
Release::new("Ricky Warwick", "Blood Ties"),
Release::new("Warbringer", "Wrath and Ruin"),
],
),
(21, vec![Release::new("Lordi", "Limited Deadition")]),
Expand Down
10 changes: 5 additions & 5 deletions src/web/templates/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub(crate) fn nav(page: Page) -> Markup {
d="M4 6h16M4 12h8m-8 6h16";
}
}
ul tabindex="0" class="menu menu-sm dropdown-content bg-base-100 rounded-box z-[1] mt-3 w-52 p-2 shadow" hx-boost="true" {
ul tabindex="0" class="menu menu-sm dropdown-content bg-base-300 rounded-box z-[1] mt-3 w-52 p-2 shadow" hx-boost="true" {
(nav_items)
}
}
Expand All @@ -101,31 +101,31 @@ fn nav_items(page: Page) -> Markup {
@if page != Page::Home { " hover:text-gray-800 dark:hover:text-gray-300" }
} {
button hx-get="/" hx-target="#content" hx-push-url="true"
_="on click remove .font-bold from .nav__item then add .font-bold to closest <li/>" { "Home" }
_="on click remove .font-bold from .nav__item then add .font-bold to closest <li/> then call document.querySelector('button').focus()" { "Home" }
}
li class={
"nav__item"
@if page == Page::Calendar { " font-bold"}
@if page != Page::Calendar { " hover:text-gray-800 dark:hover:text-gray-300" }
} {
button hx-get="/calendar" hx-target="#content" hx-push-url="true"
_="on click remove .font-bold from .nav__item then add .font-bold to closest <li/>" { "Calendar" }
_="on click remove .font-bold from .nav__item then add .font-bold to closest <li/> then call document.querySelector('button').focus()" { "Calendar" }
}
li class={
"nav__item"
@if page == Page::Calendar { " font-bold"}
@if page != Page::Calendar { " hover:text-gray-800 dark:hover:text-gray-300" }
} {
button hx-get="/about" hx-target="#content" hx-push-url="true"
_="on click remove .font-bold from .nav__item then add .font-bold to closest <li/>" { "About" }
_="on click remove .font-bold from .nav__item then add .font-bold to closest <li/> then call document.querySelector('button').focus()" { "About" }
}
li class={
"nav__item"
@if page == Page::Calendar { " font-bold"}
@if page != Page::Calendar { " hover:text-gray-800 dark:hover:text-gray-300" }
} {
button hx-get="/contact" hx-target="#content" hx-push-url="true"
_="on click remove .font-bold from .nav__item then add .font-bold to closest <li/>" { "Contact" }
_="on click remove .font-bold from .nav__item then add .font-bold to closest <li/> then call document.querySelector('button').focus()" { "Contact" }
}
)
}
Expand Down
28 changes: 14 additions & 14 deletions src/web/templates/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ pub async fn index(headers: HeaderMap, State(state): State<AppState>) -> Markup
div class="w-full px-2 mb-4 md:w-1/2 dark:bg-black" {
div class="bg-white rounded shadow py-2 dark:bg-red-900" {
p class="text-base px-6 mb-5" {
"We pull our information straight from Wikipedia's authoritative"
(PreEscaped("<a href=\"https://en.wikipedia.org/wiki/2024_in_heavy_metal_music\" target=\"_blank\" class=\"text-red-500 hover:text-red-700\"> metal album release page</a>"))
"We pull our information straight from Wikipedia's authoritative "
(PreEscaped("<a href=\"https://en.wikipedia.org/wiki/2024_in_heavy_metal_music\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">metal album release page</a>"))
", so you can be sure you're getting accurate and up-to-date info. Never miss out on a killer album drop again!"
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ fn rss_apps(bands: &Vec<String>, genres: &[String; 46]) -> Markup {
html!(
p {
"The only thing you must do is install an RSS app and add the "
a href=(format!("{}/calendar/feed.xml", config().HOST_URL)) class="text-blue-600 visited:text-purple-600" { (format!("{}/calendar/feed.xml", config().HOST_URL)) }
a href=(format!("{}/calendar/feed.xml", config().HOST_URL)) class="link link-primary visited:link-secondary focus:link-accent" { (format!("{}/calendar/feed.xml", config().HOST_URL)) }
" feed. You may also customize your list according to the bands and genres you wish to track."
}
div class="my-4" {
Expand Down Expand Up @@ -164,10 +164,10 @@ fn rss_apps(bands: &Vec<String>, genres: &[String; 46]) -> Markup {
b {"Android:" }
ul class="list-disc" {
li {
a class="text-blue-600 visited:text-purple-600" href="https://play.google.com/store/apps/details?id=com.nononsenseapps.feeder.play&hl=en_CA" target="_blank" { "Feeder" }
a class="link link-primary visited:link-secondary focus:link-accent" href="https://play.google.com/store/apps/details?id=com.nononsenseapps.feeder.play&hl=en_CA" target="_blank" { "Feeder" }
}
li {
a class="text-blue-600 visited:text-purple-600" href="https://play.google.com/store/apps/details?id=com.innologica.inoreader&hl=en_CA&pli=1" target="_blank" { "Inoreader" }
a class="link link-primary visited:link-secondary focus:link-accent" href="https://play.google.com/store/apps/details?id=com.innologica.inoreader&hl=en_CA&pli=1" target="_blank" { "Inoreader" }
}
}
}
Expand All @@ -176,7 +176,7 @@ fn rss_apps(bands: &Vec<String>, genres: &[String; 46]) -> Markup {
b {"iOS:" }
ul class="list-disc" {
li {
a class="text-blue-600 visited:text-purple-600" href="http://www.rssowl.org/" target="_blank" { "RSSOwl" }
a class="link link-primary visited:link-secondary focus:link-accent" href="http://www.rssowl.org/" target="_blank" { "RSSOwl" }
}
}
}
Expand All @@ -185,10 +185,10 @@ fn rss_apps(bands: &Vec<String>, genres: &[String; 46]) -> Markup {
b {"Linux:" }
ul class="list-disc" {
li {
a class="text-blue-600 visited:text-purple-600" href="https://gfeeds.gabmus.org/" target="_blank" { "GNOME Feeds" }
a class="link link-primary visited:link-secondary focus:link-accent" href="https://gfeeds.gabmus.org/" target="_blank" { "GNOME Feeds" }
}
li {
a class="text-blue-600 visited:text-purple-600" href="http://www.rssowl.org/" target="_blank" { "RSSOwl" }
a class="link link-primary visited:link-secondary focus:link-accent" href="http://www.rssowl.org/" target="_blank" { "RSSOwl" }
}
}
}
Expand All @@ -197,10 +197,10 @@ fn rss_apps(bands: &Vec<String>, genres: &[String; 46]) -> Markup {
b {"Windows:" }
ul class="list-disc" {
li {
a class="text-blue-600 visited:text-purple-600" href="http://feedreader.com/" target="_blank" { "Feedreader" }
a class="link link-primary visited:link-secondary focus:link-accent" href="http://feedreader.com/" target="_blank" { "Feedreader" }
}
li {
a class="text-blue-600 visited:text-purple-600" href="http://www.rssowl.org/" target="_blank" { "RSSOwl" }
a class="link link-primary visited:link-secondary focus:link-accent" href="http://www.rssowl.org/" target="_blank" { "RSSOwl" }
}
}
}
Expand All @@ -224,7 +224,7 @@ pub async fn about_handler(headers: HeaderMap) -> Markup {
}
p class="mb-8" {
"Our service is fully open source and available on "
(PreEscaped("<a href=\"https://github.com/reaper47/heavy-metal-notifier\" target=\"_blank\" class=\"text-blue-500 hover:text-blue-800\">GitHub</a>"))
(PreEscaped("<a href=\"https://github.com/reaper47/heavy-metal-notifier\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\">GitHub</a>"))
". We believe in the power of community and collaboration, and we invite you to join us in improving and expanding our "
"service to make it even better for heavy metal fans everywhere."
}
Expand Down Expand Up @@ -361,9 +361,9 @@ pub async fn tos(headers: HeaderMap) -> Markup {
"the one who hosts an instance of Heavy Metal Releases Notifier and may be used for any lawful purpose "
"without compensation to the user. Heavy Metal Releases Notifier reserves the right to refuse service "
"to any user `for` any reason at any time. The images are from "
(PreEscaped("<a href=\"https://pixabay.com\">Pixabay</a>"))
(PreEscaped("<a href=\"https://pixabay.com\" class=\"link link-primary visited:link-secondary focus:link-accent\">Pixabay</a>"))
"and "
(PreEscaped("<a href=\"https://commons.wikimedia.org/wiki/Main_Page\">Wikimedia Commons</a>"))
(PreEscaped("<a href=\"https://commons.wikimedia.org/wiki/Main_Page\" class=\"link link-primary visited:link-secondary focus:link-accent\">Wikimedia Commons</a>"))
"."
}
h5 class="text-3xl font-bold mb-3" {
Expand Down Expand Up @@ -424,7 +424,7 @@ pub async fn tos(headers: HeaderMap) -> Markup {
}
p class="mb-8" {
"If you have any questions or concerns regarding these Terms of Service agreement, please contact Heavy Metal Releases Notifier at "
(PreEscaped("<a href=\"mailto:metal.releases.666@gmail.com\" target=\"_blank\" class=\"text-blue-500 hover:text-blue-600\" aria-label=\"Email metal.releases.666@gmail.com\">metal.releases.666@gmail.com</a>"))
(PreEscaped("<a href=\"mailto:metal.releases.666@gmail.com\" target=\"_blank\" class=\"link link-primary visited:link-secondary focus:link-accent\" aria-label=\"Email metal.releases.666@gmail.com\">metal.releases.666@gmail.com</a>"))
"."
}
}
Expand Down
11 changes: 9 additions & 2 deletions web/app/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["../../src/web/templates/*.rs"],
content: [
"../../src/web/templates/*.rs",
"../../src/model/*.rs",
],
theme: {
extend: {},
},
plugins: [require("@tailwindcss/typography"), require("daisyui")],
}
daisyui: {
themes: ["light", "forest"],
darkTheme: "forest",
}
}
15 changes: 0 additions & 15 deletions web/static/css/tailwind-custom.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

#feeds__container {
& a {
text-decoration: underline;
color: rgb(37 99 235);

&:hover {
color: rgb(30 64 175);
}

&:visited {
color: rgb(147 51 234);
}
}
}
2 changes: 1 addition & 1 deletion web/static/css/tailwind.css

Large diffs are not rendered by default.

0 comments on commit 7d71af3

Please sign in to comment.