From a3f85e4cbad8dd18a8806800cb9ea469795336e9 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 2 Jul 2023 14:14:58 -0700 Subject: [PATCH 1/5] Fix scrolling styles with CSS grid --- styles/sass/style.scss | 33 ++++---- templates/index.html.tera | 164 +++++++++++++++++++------------------- 2 files changed, 99 insertions(+), 98 deletions(-) diff --git a/styles/sass/style.scss b/styles/sass/style.scss index a1be5d2..e9e3da7 100644 --- a/styles/sass/style.scss +++ b/styles/sass/style.scss @@ -43,11 +43,19 @@ input[type=number] { #content { width: 100%; height: 100%; - display: flex; - flex-direction: column; + + display: grid; + grid-template-areas: + "nav nav" + "challenge submissions"; + grid-template-columns: 30em auto; + grid-template-rows: min-content auto; + overflow: hidden; nav { + grid-area: nav; + --bg: #{$fg}; --fg: #{$bg}; background: var(--bg); @@ -98,16 +106,12 @@ input[type=number] { } } - & > div:first-of-type { - display: flex; - height: 100%; - & > :first-child { - min-width: 40em; - padding: 1em; - } - & > * { - overflow: scroll; - } + & > div { + overflow: scroll; + } + + #challenge { + padding: 1em; } } @@ -116,9 +120,8 @@ input[type=number] { } #submissions { - display: flex; - flex-direction: column; - height: calc(100% - 2em); + grid-area: submissions; + background: rgba(0, 0, 0, 0.125); $gap: 0.5em; padding: $gap; diff --git a/templates/index.html.tera b/templates/index.html.tera index 7272dd5..0242ca7 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -64,92 +64,90 @@ -
-
-

Welcome to Tegaki Tuesday #{{ challenge }}!

- {% if content.japanese %} -
- - - {% for line in content.japanese %} - {% for subline in line %} -

- {%- for word in subline -%} - {%- if word.dictionary -%} - - {%- endif -%} - {% for segment in word.text -%} - {{ segment.kanji }}({{ segment.furigana | safe }}) - {%- endfor -%} - {%- if word.dictionary -%} - - {%- endif -%} - {%- endfor -%} -

- {% endfor %} - {% endfor %} -
- {% endif %} - {{ content.text | safe }} - {% if content.translation %} -

- Translation - {% if content.translation.author %}by {{ content.translation.author }}{% endif %} - {% if content.translation.site %} via - {% if content.translation.site.link %} - {{ content.translation.site.name }} - {% else %} - {{ content.translation.site.name }} - {% endif %} - {%- endif -%} -

- {%- endif -%} - {%- if content.suggester -%} -

This challenge was suggested by {{ content.suggester }} using the -h suggest command.

- {%- endif -%} -
-
+
+

Welcome to Tegaki Tuesday #{{ challenge }}!

+ {% if content.japanese %} +
-
- {% for submission in submissions %} - {% set author = users[submission.author_id] %} -
- {{ author.username }}'s submission -
{% if not author.deleted %}{% endif %}{{ author.username }}{% if author.deleted %} (deleted account){% else %}{% endif %}
-
+ + {% for line in content.japanese %} + {% for subline in line %} +

+ {%- for word in subline -%} + {%- if word.dictionary -%} + + {%- endif -%} + {% for segment in word.text -%} + {{ segment.kanji }}({{ segment.furigana | safe }}) + {%- endfor -%} + {%- if word.dictionary -%} + + {%- endif -%} + {%- endfor -%} +

{% endfor %} -
-
- some random shit goes here -
-
+ {% endfor %} +
+ {% endif %} + {{ content.text | safe }} + {% if content.translation %} +

+ Translation + {% if content.translation.author %}by {{ content.translation.author }}{% endif %} + {% if content.translation.site %} via + {% if content.translation.site.link %} + {{ content.translation.site.name }} + {% else %} + {{ content.translation.site.name }} + {% endif %} + {%- endif -%} +

+ {%- endif -%} + {%- if content.suggester -%} +

This challenge was suggested by {{ content.suggester }} using the -h suggest command.

+ {%- endif -%} +
+
+ +
+ {% for submission in submissions %} + {% set author = users[submission.author_id] %} +
+ {{ author.username }}'s submission +
{% if not author.deleted %}{% endif %}{{ author.username }}{% if author.deleted %} (deleted account){% else %}{% endif %}
+
+ {% endfor %} +
+
+ some random shit goes here +
From 8b7f5b39b863ecf0311c7914bc3dbcc31af2c8ff Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 2 Jul 2023 21:10:12 -0700 Subject: [PATCH 2/5] Add submissions copyright footer --- settings.yaml | 1 + src/models/settings.rs | 1 + styles/sass/style.scss | 5 +++++ templates/index.html.tera | 6 +++--- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/settings.yaml b/settings.yaml index eb637ee..dddbb1a 100644 --- a/settings.yaml +++ b/settings.yaml @@ -1,3 +1,4 @@ +copyright_start: 2021 guilds: # Tegaki Tuesday - id: 814700630958276649 diff --git a/src/models/settings.rs b/src/models/settings.rs index a331404..0e3e36d 100644 --- a/src/models/settings.rs +++ b/src/models/settings.rs @@ -6,6 +6,7 @@ use std::fs; #[derive(Serialize, Deserialize)] pub struct Settings { pub guilds: Vec, + pub copyright_start: u32, } impl Settings { diff --git a/styles/sass/style.scss b/styles/sass/style.scss index e9e3da7..a07f294 100644 --- a/styles/sass/style.scss +++ b/styles/sass/style.scss @@ -125,6 +125,11 @@ input[type=number] { background: rgba(0, 0, 0, 0.125); $gap: 0.5em; padding: $gap; + + footer { + margin-top: 1em; + } + & > div { width: 100%; column-count: 3; diff --git a/templates/index.html.tera b/templates/index.html.tera index 0242ca7..128dd6a 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -145,9 +145,9 @@ {% endfor %} -
- some random shit goes here -
+
+ Submissions are copyright © {% set year = now() | date(format="%Y") | int %}{{ settings.copyright_start }}{% if year != settings.copyright_start %}–{{ year }}{% endif %} their respective submitters, and are licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. +
From a9d6a3800e14de1275b496081ae1652663be31d9 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 2 Jul 2023 21:19:57 -0700 Subject: [PATCH 3/5] Make footer go to bottom --- styles/sass/style.scss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/styles/sass/style.scss b/styles/sass/style.scss index a07f294..b927255 100644 --- a/styles/sass/style.scss +++ b/styles/sass/style.scss @@ -121,13 +121,17 @@ input[type=number] { #submissions { grid-area: submissions; + display: flex; + flex-direction: column; + gap: 1em; background: rgba(0, 0, 0, 0.125); $gap: 0.5em; padding: $gap; footer { - margin-top: 1em; + margin-top: auto; + text-align: center; } & > div { From fa9d7e9be081e0ab54d07342fb9a24196c7b3966 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 2 Jul 2023 21:25:55 -0700 Subject: [PATCH 4/5] Add challenge content footer --- styles/sass/style.scss | 16 ++--- templates/copyright-years.html.tera | 1 + templates/index.html.tera | 103 +++++++++++++++------------- 3 files changed, 63 insertions(+), 57 deletions(-) create mode 100644 templates/copyright-years.html.tera diff --git a/styles/sass/style.scss b/styles/sass/style.scss index b927255..d6783da 100644 --- a/styles/sass/style.scss +++ b/styles/sass/style.scss @@ -108,6 +108,14 @@ input[type=number] { & > div { overflow: scroll; + display: flex; + flex-direction: column; + gap: 1em; + + footer { + margin-top: auto; + text-align: center; + } } #challenge { @@ -121,19 +129,11 @@ input[type=number] { #submissions { grid-area: submissions; - display: flex; - flex-direction: column; - gap: 1em; background: rgba(0, 0, 0, 0.125); $gap: 0.5em; padding: $gap; - footer { - margin-top: auto; - text-align: center; - } - & > div { width: 100%; column-count: 3; diff --git a/templates/copyright-years.html.tera b/templates/copyright-years.html.tera new file mode 100644 index 0000000..abc881b --- /dev/null +++ b/templates/copyright-years.html.tera @@ -0,0 +1 @@ +© {% set year = now() | date(format="%Y") | int %}{{ settings.copyright_start }}{% if year != settings.copyright_start %}–{{ year }}{% endif %} \ No newline at end of file diff --git a/templates/index.html.tera b/templates/index.html.tera index 128dd6a..3837301 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -65,57 +65,62 @@
-

Welcome to Tegaki Tuesday #{{ challenge }}!

- {% if content.japanese %} -
- - - {% for line in content.japanese %} - {% for subline in line %} -

- {%- for word in subline -%} - {%- if word.dictionary -%} - - {%- endif -%} - {% for segment in word.text -%} - {{ segment.kanji }}({{ segment.furigana | safe }}) +

+

Welcome to Tegaki Tuesday #{{ challenge }}!

+ {% if content.japanese %} +
+ {% endif %} + {{ content.text | safe }} + {% if content.translation %} +

+ Translation + {% if content.translation.author %}by {{ content.translation.author }}{% endif %} + {% if content.translation.site %} via + {% if content.translation.site.link %} + {{ content.translation.site.name }} + {% else %} + {{ content.translation.site.name }} + {% endif %} + {%- endif -%} +

+ {%- endif -%} + {%- if content.suggester -%} +

This challenge was suggested by {{ content.suggester }} using the -h suggest command.

+ {%- endif -%}
- {% endif %} - {{ content.text | safe }} - {% if content.translation %} -

- Translation - {% if content.translation.author %}by {{ content.translation.author }}{% endif %} - {% if content.translation.site %} via - {% if content.translation.site.link %} - {{ content.translation.site.name }} - {% else %} - {{ content.translation.site.name }} - {% endif %} - {%- endif -%} -

- {%- endif -%} - {%- if content.suggester -%} -

This challenge was suggested by {{ content.suggester }} using the -h suggest command.

- {%- endif -%} +
+ Copyright {% include "copyright-years" %} Tegaki Tuesday. All rights reserved. 字ちゃん mascot art by @bellumela. +