From 824206612dd54e6a9c52e43a8f45d761a235a795 Mon Sep 17 00:00:00 2001 From: broquemonsieur Date: Sat, 10 Aug 2024 22:59:17 -0700 Subject: [PATCH] Add dark light interoperability --- assets/404_tv_box_light_theme.svg | 1261 +++++++++++++++++++++++++++++ src/invidious/helpers/errors.cr | 6 +- src/invidious/views/error.ecr | 16 +- 3 files changed, 1277 insertions(+), 6 deletions(-) create mode 100644 assets/404_tv_box_light_theme.svg diff --git a/assets/404_tv_box_light_theme.svg b/assets/404_tv_box_light_theme.svg new file mode 100644 index 00000000..9c2f9705 --- /dev/null +++ b/assets/404_tv_box_light_theme.svg @@ -0,0 +1,1261 @@ + + + + + + Layer 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index dc24b173..11eb1421 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -75,7 +75,8 @@ def error_template_helper(env : HTTP::Server::Context, status_code : Int32, exce # proposed above the error message, just worded differently. next_steps = "" unfound_tv_box_dark_theme = File.read("assets/404_tv_box_dark_theme.svg") - + unfound_tv_box_light_theme = File.read("assets/404_tv_box_light_theme.svg") + return templated "error" end @@ -87,6 +88,7 @@ def error_template_helper(env : HTTP::Server::Context, status_code : Int32, mess error_message = translate(locale, message) unfound_tv_box_dark_theme = File.read("assets/404_tv_box_dark_theme.svg") + unfound_tv_box_light_theme = File.read("assets/404_tv_box_light_theme.svg") next_steps = error_redirect_helper(env) return templated "error" @@ -199,4 +201,4 @@ def error_redirect_helper(env : HTTP::Server::Context) else return "" end -end +end \ No newline at end of file diff --git a/src/invidious/views/error.ecr b/src/invidious/views/error.ecr index 6cf33f26..ed504c2c 100644 --- a/src/invidious/views/error.ecr +++ b/src/invidious/views/error.ecr @@ -1,11 +1,19 @@ +<% + dark_mode = env.get("preferences").as(Preferences).dark_mode +%> + <% content_for "header" do %> <%= "Error" %> - Invidious <% end %>
- +
<%= error_message %> - - <%= unfound_tv_box_dark_theme %> + <% if dark_mode == "dark" %> + <%= unfound_tv_box_dark_theme %> + <% else %> + <%= unfound_tv_box_light_theme %> + <% end %> +
<%= next_steps %> -
+ \ No newline at end of file