From 454e2f3cd84b6c0b02a0c2936a574d3d9c35c5a1 Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Wed, 15 Oct 2025 02:43:04 +0700 Subject: feat: start switching to absolute length units in design --- internal/lightgallery/html_renderer.go | 8 ++++---- internal/tailwind/transformer.go | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'internal') diff --git a/internal/lightgallery/html_renderer.go b/internal/lightgallery/html_renderer.go index 8e184e0..f02b953 100644 --- a/internal/lightgallery/html_renderer.go +++ b/internal/lightgallery/html_renderer.go @@ -51,9 +51,9 @@ func (r *LightGalleryHTMLRenderer) renderLightGallery(w util.BufWriter, source [ w.WriteString(fmt.Sprintf(`
-
+
-
+
`, galleryID)) var dynamicElements []string @@ -84,8 +84,8 @@ func (r *LightGalleryHTMLRenderer) renderLightGallery(w util.BufWriter, source [ thumb: "https://f003.backblazeb2.com/file/sayana-photos/webp-320p/%s.webp", subHtml: `+"`"+``+"`"+` }`, img.URL, img.URL, util.EscapeHTML(captionHTML), imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, imageUrlWithoutExt, captionHTML, dayDate.Format("2006-01-02 15:04:05 -07:00"))) } diff --git a/internal/tailwind/transformer.go b/internal/tailwind/transformer.go index 2f052b9..4057ea4 100644 --- a/internal/tailwind/transformer.go +++ b/internal/tailwind/transformer.go @@ -17,44 +17,44 @@ func (t *TailwindTransformer) Transform(node *ast.Document, reader text.Reader, switch node := n.(type) { case *ast.Heading: classes := map[int]string{ - 1: "font-patua text-[2.5vmax] font-bold text-main-dark mb-[1.2vmin] tracking-[0.04vmin]", - 2: "font-spectral text-[2vmax] font-bold text-main-dark mb-[0.8vmin] tracking-[0.04vmin]", - 3: "font-spectral text-[1.5vmax] font-medium text-main-dark mb-[0.6vmin] tracking-[0.04vmin]", - 4: "font-spectral text-[1.2vmax] font-medium text-main-medium mb-[0.4vmin] tracking-[0.04vmin]", - 5: "font-spectral text-[1vmax] font-medium text-main-medium mb-[0.4vmin] italic tracking-[0.04vmin]", - 6: "font-spectral text-[1vmax] font-medium text-secondary mb-[0.4vmin]", + 1: "font-patua text-4xl font-bold text-main-dark mb-6 tracking-[.0125rem]", + 2: "font-spectral text-3xl font-bold text-main-dark mb-2 tracking-[.0125rem]", + 3: "font-spectral text-2xl font-medium text-main-dark mb-1.5 tracking-[.0125rem]", + 4: "font-spectral text-xl font-medium text-main-medium mb-1 tracking-[.0125rem]", + 5: "font-spectral text-base font-medium text-main-medium mb-1 italic tracking-[.0125rem]", + 6: "font-spectral text-base font-medium text-secondary mb-1", } if class, ok := classes[node.Level]; ok { node.SetAttribute([]byte("class"), []byte(class)) } case *ast.Paragraph: - node.SetAttribute([]byte("class"), []byte("text-[1vmax]/[2] font-spectral tracking-[0.04vmin] -indent-[2vmax] ml-[2vmax] mb-[1.6vmin]")) + node.SetAttribute([]byte("class"), []byte("text-base/[2] font-spectral tracking-[.0125rem] -indent-8 ml-8 mb-8")) case *ast.List: if node.IsOrdered() { - node.SetAttribute([]byte("class"), []byte("list-decimal list-inside space-y-[0.8vmin] mb-[1.6vmin] pl-[2vmax]")) + node.SetAttribute([]byte("class"), []byte("list-decimal list-inside space-y-2 mb-8 pl-8")) } else { - node.SetAttribute([]byte("class"), []byte("list-disc list-inside space-y-[0.8vmin] mb-[1.6vmin] pl-[2vmax]")) + node.SetAttribute([]byte("class"), []byte("list-disc list-inside space-y-2 mb-8 pl-8")) } case *ast.ListItem: - node.SetAttribute([]byte("class"), []byte("text-[1vmax]/[2] font-spectral tracking-[0.04vmin]")) + node.SetAttribute([]byte("class"), []byte("text-base/[2] font-spectral tracking-[.0125rem]")) case *ast.Blockquote: - node.SetAttribute([]byte("class"), []byte("border-l-[0.4vmin] border-main-medium bg-background-dark p-[0.8vmin] mb-[0.8vmin] italic")) + node.SetAttribute([]byte("class"), []byte("border-l-1 border-main-medium bg-background-dark p-2 mb-2 italic")) case *ast.CodeSpan: node.SetAttribute([]byte("class"), []byte("bg-background-dark")) case *ast.CodeBlock, *ast.FencedCodeBlock: - node.SetAttribute([]byte("class"), []byte("bg-background-dark p-[0.8vmin] rounded-lg overflow-x-auto mb-[1.6vmin]")) + node.SetAttribute([]byte("class"), []byte("bg-background-dark p-2 rounded-lg overflow-x-auto mb-8")) case *ast.Link: node.SetAttribute([]byte("class"), []byte("text-secondary hover:text-main-dark underline")) case *ast.Image: - node.SetAttribute([]byte("class"), []byte("max-w-full h-auto rounded-lg shadow-lg mb-[1.6vmin]")) + node.SetAttribute([]byte("class"), []byte("max-w-full h-auto rounded-lg shadow-lg mb-8")) case *ast.Emphasis: switch node.Level { -- cgit v1.3.1+13 From 739a4af71187e82fd58956e5ad36f0baefddf3c4 Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Wed, 15 Oct 2025 18:14:59 +0700 Subject: feat: improve measurements in layout --- internal/lightgallery/html_renderer.go | 6 ++-- internal/tailwind/transformer.go | 24 +++++++------- views/index.html | 6 ++-- views/layouts/general-page.html | 8 ++--- views/pages/blog-catalogue.html | 26 ++++++++-------- views/pages/blog-page.html | 10 +++--- views/pages/global-map.html | 2 +- views/pages/home-page.html | 52 +++++++++++++++---------------- views/partials/blog-page-like-button.html | 4 +-- views/partials/catalogue-blog-cards.html | 12 +++---- views/partials/general-page-footer.html | 2 +- views/partials/general-page-header.html | 8 ++--- 12 files changed, 80 insertions(+), 80 deletions(-) (limited to 'internal') diff --git a/internal/lightgallery/html_renderer.go b/internal/lightgallery/html_renderer.go index f02b953..c2f785e 100644 --- a/internal/lightgallery/html_renderer.go +++ b/internal/lightgallery/html_renderer.go @@ -50,10 +50,10 @@ func (r *LightGalleryHTMLRenderer) renderLightGallery(w util.BufWriter, source [ galleryID := generateDivId(8) w.WriteString(fmt.Sprintf(` -
-
+
+
-
+
`, galleryID)) var dynamicElements []string diff --git a/internal/tailwind/transformer.go b/internal/tailwind/transformer.go index 4057ea4..f932533 100644 --- a/internal/tailwind/transformer.go +++ b/internal/tailwind/transformer.go @@ -17,44 +17,44 @@ func (t *TailwindTransformer) Transform(node *ast.Document, reader text.Reader, switch node := n.(type) { case *ast.Heading: classes := map[int]string{ - 1: "font-patua text-4xl font-bold text-main-dark mb-6 tracking-[.0125rem]", - 2: "font-spectral text-3xl font-bold text-main-dark mb-2 tracking-[.0125rem]", - 3: "font-spectral text-2xl font-medium text-main-dark mb-1.5 tracking-[.0125rem]", - 4: "font-spectral text-xl font-medium text-main-medium mb-1 tracking-[.0125rem]", - 5: "font-spectral text-base font-medium text-main-medium mb-1 italic tracking-[.0125rem]", - 6: "font-spectral text-base font-medium text-secondary mb-1", + 1: "font-patua text-4xl font-bold text-main-dark mb-3 tracking-[.0125rem]", + 2: "font-spectral text-3xl font-bold text-main-dark mb-1 tracking-[.0125rem]", + 3: "font-spectral text-2xl font-medium text-main-dark mb-0.8 tracking-[.0125rem]", + 4: "font-spectral text-xl font-medium text-main-medium mb-0.5 tracking-[.0125rem]", + 5: "font-spectral text-base font-medium text-main-medium mb-0.5 italic tracking-[.0125rem]", + 6: "font-spectral text-base font-medium text-secondary mb-0.5", } if class, ok := classes[node.Level]; ok { node.SetAttribute([]byte("class"), []byte(class)) } case *ast.Paragraph: - node.SetAttribute([]byte("class"), []byte("text-base/[2] font-spectral tracking-[.0125rem] -indent-8 ml-8 mb-8")) + node.SetAttribute([]byte("class"), []byte("text-base/[2] font-spectral tracking-[.0125rem] -indent-8 ml-4 mb-8")) case *ast.List: if node.IsOrdered() { - node.SetAttribute([]byte("class"), []byte("list-decimal list-inside space-y-2 mb-8 pl-8")) + node.SetAttribute([]byte("class"), []byte("list-decimal list-inside space-y-2 mb-4 pl-8")) } else { - node.SetAttribute([]byte("class"), []byte("list-disc list-inside space-y-2 mb-8 pl-8")) + node.SetAttribute([]byte("class"), []byte("list-disc list-inside space-y-2 mb-4 pl-8")) } case *ast.ListItem: node.SetAttribute([]byte("class"), []byte("text-base/[2] font-spectral tracking-[.0125rem]")) case *ast.Blockquote: - node.SetAttribute([]byte("class"), []byte("border-l-1 border-main-medium bg-background-dark p-2 mb-2 italic")) + node.SetAttribute([]byte("class"), []byte("border-l-2 border-main-medium bg-background-dark p-1 mb-2 italic")) case *ast.CodeSpan: node.SetAttribute([]byte("class"), []byte("bg-background-dark")) case *ast.CodeBlock, *ast.FencedCodeBlock: - node.SetAttribute([]byte("class"), []byte("bg-background-dark p-2 rounded-lg overflow-x-auto mb-8")) + node.SetAttribute([]byte("class"), []byte("bg-background-dark p-1 rounded-lg overflow-x-auto mb-4")) case *ast.Link: node.SetAttribute([]byte("class"), []byte("text-secondary hover:text-main-dark underline")) case *ast.Image: - node.SetAttribute([]byte("class"), []byte("max-w-full h-auto rounded-lg shadow-lg mb-8")) + node.SetAttribute([]byte("class"), []byte("max-w-full h-auto rounded-lg shadow-lg mb-4")) case *ast.Emphasis: switch node.Level { diff --git a/views/index.html b/views/index.html index 666b9c6..c81d4b7 100644 --- a/views/index.html +++ b/views/index.html @@ -102,14 +102,14 @@ switchTheme(savedTheme); - -
-
+
+
-
+
+ class="blog-cards grow flex flex-col overflow-y-auto bg-background-light inset-shadow p-6"> Loading...
diff --git a/views/pages/blog-page.html b/views/pages/blog-page.html index cc00e1a..78a4b7f 100644 --- a/views/pages/blog-page.html +++ b/views/pages/blog-page.html @@ -16,12 +16,12 @@ {{ end }} {{ define "body" }} -
+
{{ .ParsedMarkdown }} {{- if .MapLocationX }} -
-
-
+
+
+
-{{ end }} \ No newline at end of file +{{ end }} diff --git a/views/pages/global-map.html b/views/pages/global-map.html index 330790b..7d730ea 100644 --- a/views/pages/global-map.html +++ b/views/pages/global-map.html @@ -242,7 +242,7 @@ title: title, }).bindPopup(` `); diff --git a/views/pages/home-page.html b/views/pages/home-page.html index 30f5ad0..9db6d23 100644 --- a/views/pages/home-page.html +++ b/views/pages/home-page.html @@ -1,52 +1,52 @@ {{ define "body" }} -
-
+
+
-

{{ .L.HomePage.Hymn1 }}

-
-

{{ .L.HomePage.Hymn2 }}

-

{{ .L.HomePage.Hymn3 }}

-

{{ .L.HomePage.Hymn4 }}

+
+

{{ .L.HomePage.Hymn2 }}

+

{{ .L.HomePage.Hymn3 }}

+

{{ .L.HomePage.Hymn4 }}

-

{{ .L.HomePage.DidYouKnowThat }}

-
+
    -
  • {{ index .FunFacts 0 }}
  • -
  • {{ index .FunFacts 1 }}
  • -
  • {{ index .FunFacts 2 }}
  • +
  • {{ index .FunFacts 0 }}
  • +
  • {{ index .FunFacts 1 }}
  • +
  • {{ index .FunFacts 2 }}
-
-
-

+

-
+
{{- range $_ := iterate .FilledHeartCount }}
{{- end }} @@ -54,7 +54,7 @@
{{- end }} + class="home-page-gif z-49 -rotate-12 max-w-[70%] max-h-[70%] border-4 border-(--background-dark-color) border-inset">
-

{{ .L.HomePage.SidebarDescription }}

-
+
-

{{ .L.HomePage.HomePageDescription }}

+

{{ .L.HomePage.HomePageDescription }}

-

{{ .L.HomePage.BlogSearchDescription }}

+

{{ .L.HomePage.BlogSearchDescription }}

-

{{ .L.HomePage.MarkerMapDescription }}

+

{{ .L.HomePage.MarkerMapDescription }}

-

{{ .L.HomePage.ThemeSwitchDescription }}

+

{{ .L.HomePage.ThemeSwitchDescription }}

diff --git a/views/partials/blog-page-like-button.html b/views/partials/blog-page-like-button.html index 1dfb5b8..f286471 100644 --- a/views/partials/blog-page-like-button.html +++ b/views/partials/blog-page-like-button.html @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/views/partials/catalogue-blog-cards.html b/views/partials/catalogue-blog-cards.html index f96e0f1..041f3c8 100644 --- a/views/partials/catalogue-blog-cards.html +++ b/views/partials/catalogue-blog-cards.html @@ -1,15 +1,15 @@ {{- range .BlogPages }} -
+
- -
-
- + +
+
+ {{ .Title }} // {{ .ActionDate }} -

{{ .PublishedTime }}

+

{{ .PublishedTime }}

{{ .ShortDescription }}

diff --git a/views/partials/general-page-footer.html b/views/partials/general-page-footer.html index c0774f6..8979423 100644 --- a/views/partials/general-page-footer.html +++ b/views/partials/general-page-footer.html @@ -1,5 +1,5 @@ {{ block "footer" . }}{{ end }} -

+

All the photos on saya.today are licensed under CC BY-SA 4.0 by Saya Andy © {{ .PublishedYear }}

CC diff --git a/views/partials/general-page-header.html b/views/partials/general-page-header.html index d13a6d8..115ab13 100644 --- a/views/partials/general-page-header.html +++ b/views/partials/general-page-header.html @@ -1,8 +1,8 @@
- -

//

-

{{ .Title }}

+ class="flex flex-row mb-2"> + +

//

+

{{ .Title }}

{{ .PublishedDate }}

{{ block "header" . }}{{ end }} -- cgit v1.3.1+13 From d3ffefbd3d9de2378b564e4c6f965c03a5a06113 Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Wed, 15 Oct 2025 23:23:27 +0700 Subject: feat: adapt layout for phone screens (especially small ones) --- internal/router/api-v1-general-page-body.go | 2 + locale/localization.en.yaml | 3 ++ locale/localization.go | 6 +++ locale/localization.ru.yaml | 3 ++ static/input.css | 73 ++++++++++++----------------- views/layouts/general-page.html | 25 +++++----- views/pages/blog-catalogue.html | 16 +++---- views/pages/blog-page.html | 6 ++- views/pages/global-map.html | 18 +++---- views/pages/home-page.html | 8 ++-- views/partials/general-page-body.html | 2 +- views/partials/general-page-header.html | 2 +- 12 files changed, 85 insertions(+), 79 deletions(-) (limited to 'internal') diff --git a/internal/router/api-v1-general-page-body.go b/internal/router/api-v1-general-page-body.go index b2fa268..c1a4a9f 100644 --- a/internal/router/api-v1-general-page-body.go +++ b/internal/router/api-v1-general-page-body.go @@ -136,6 +136,8 @@ func Api_V1_GeneralPage_Body(l map[string]*locale.LocaleConfig, langs []string, values["MapLocationAreaMeters"] = areaError values["Title"] = metadata.Title values["ParsedMarkdown"] = template.HTML(parsedMarkdown) + values["PublishedDate"] = metadata.PublishedTime.Format("2006-01-02 15:04:05 -07:00") + values["ActionDate"] = metadata.ActionDate additionalTemplates = append(additionalTemplates, "views/pages/blog-page.html") diff --git a/locale/localization.en.yaml b/locale/localization.en.yaml index 1b3654b..e93ab00 100644 --- a/locale/localization.en.yaml +++ b/locale/localization.en.yaml @@ -22,3 +22,6 @@ HomePage: Hymn2: "We've been expecting you!" Hymn3: 'You bring such joy in Sayasite!' Hymn4: 'No matter where you roam, know our love is true!~' +Metadata: + Published: 'Published' + Action: 'Took place on' diff --git a/locale/localization.go b/locale/localization.go index 088783f..7dbb554 100644 --- a/locale/localization.go +++ b/locale/localization.go @@ -12,6 +12,7 @@ type LocaleConfig struct { BlogSearch BlogSearchConfig `yaml:"BlogSearch" json:"BlogSearch"` GlobalMap GlobalMapConfig `yaml:"GlobalMap" json:"GlobalMap"` HomePage HomePageConfig `yaml:"HomePage" json:"HomePage"` + Metadata MetadataConfig `yaml:"Metadata" json:"Metadata"` } type BlogSearchConfig struct { @@ -43,6 +44,11 @@ type HomePageConfig struct { Hymn4 string `yaml:"Hymn4" json:"Hymn4"` } +type MetadataConfig struct { + Action string `yaml:"Action" json:"Action"` + Published string `yaml:"Published" json:"Published"` +} + func LoadConfig(path string, config *LocaleConfig) error { fileBytes, err := os.ReadFile(path) if err != nil { diff --git a/locale/localization.ru.yaml b/locale/localization.ru.yaml index 9d7084f..a1a9a6c 100644 --- a/locale/localization.ru.yaml +++ b/locale/localization.ru.yaml @@ -22,3 +22,6 @@ HomePage: Hymn2: 'Мы Вас столько ждали!' Hymn3: 'Столько радости от Вас на Саясайте!' Hymn4: 'Где бы Вы не были, знайте, -- наша любовь крепка!' +Metadata: + Published: 'Опубликовано' + Action: 'Время действия' diff --git a/static/input.css b/static/input.css index 668ca7a..51c3c30 100644 --- a/static/input.css +++ b/static/input.css @@ -3,15 +3,16 @@ @theme { --font-spectral: Spectral, serif; --font-patua: "Patua One", cursive; + --breakpoint-xs: 32rem; } html { - font-size: 8px; + font-size: 12px; } @media screen and (width >= 640px) { html { - font-size: 12px; + font-size: 14px; } } @@ -494,42 +495,42 @@ body[data-theme~="ram"] .leaflet-tile { filter: invert(1) hue-rotate(190deg) contrast(1.1) brightness(1.2) !important; } -@media (min-aspect-ratio: 1.1/1) { - .ar-gt-1\.1\:mr-6 { +@media (min-aspect-ratio: 0.8/1) { + .ar-gt-0\.8\:mr-6 { margin-right: 1.5rem; } - .ar-gt-1\.1\:w-fit { + .ar-gt-0\.8\:w-fit { width: fit-content; } - .ar-gt-1\.1\:w-\[100dvh\] { + .ar-gt-0\.8\:w-\[100dvh\] { width: 100dvh; flex-basis: 100dvh; } - .ar-gt-1\.1\:min-w-fit { + .ar-gt-0\.8\:min-w-fit { min-width: fit-content; } - .ar-gt-1\.1\:min-w-\[10dvh\] { + .ar-gt-0\.8\:min-w-\[10dvh\] { min-width: 10dvh; } - .ar-gt-1\.1\:max-w-\[20dvh\] { + .ar-gt-0\.8\:max-w-\[20dvh\] { max-width: 20dvh; } - .ar-gt-1\.1\:max-w-\[100dvh\] { + .ar-gt-0\.8\:max-w-\[100dvh\] { max-width: 100dvh; } - .ar-gt-1\.1\:items-center { + .ar-gt-0\.8\:items-center { align-items: center; } } -@media (max-aspect-ratio: 1.1/1) { +@media (max-aspect-ratio: 0.8/1) { .bg-sidebar { background-size: calc(var(--squares-and-triangles-background-width-coef) * 1.6vh) calc(var(--squares-and-triangles-background-height-coef) * 1.6vh); } @@ -546,71 +547,67 @@ body[data-theme~="ram"] .leaflet-tile { background-size: 10dvh; } - .ar-lt-1\.1\:grid { + .ar-lt-0\.8\:grid { display: grid; } - .ar-lt-1\.1\:flex-col { + .ar-lt-0\.8\:flex-col { flex-direction: column; } - .ar-lt-1\.1\:flex-row { + .ar-lt-0\.8\:flex-row { flex-direction: row; } - .ar-lt-1\.1\:h-\[8dvh\] { + .ar-lt-0\.8\:h-\[8dvh\] { height: 8dvh; } - .ar-lt-1\.1\:h-\[10dvh\] { + .ar-lt-0\.8\:h-\[10dvh\] { height: 10dvh; } - .ar-lt-1\.1\:h-\[30dvh\] { + .ar-lt-0\.8\:h-\[30dvh\] { height: 30dvh; } - .ar-lt-1\.1\:h-\[90dvh\] { + .ar-lt-0\.8\:h-\[90dvh\] { height: 90dvh; } - .ar-lt-1\.1\:w-\[8dvh\] { + .ar-lt-0\.8\:w-\[8dvh\] { width: 8dvh; } - .ar-lt-1\.1\:w-\[80\%\] { + .ar-lt-0\.8\:w-\[80\%\] { width: 80%; } - .ar-lt-1\.1\:w-\[90dvw\] { + .ar-lt-0\.8\:w-\[90dvw\] { width: 90dvw; } - .ar-lt-1\.1\:w-screen { + .ar-lt-0\.8\:w-screen { width: 100dvw; } - .ar-lt-1\.1\:max-h-\[25\%\] { - max-height: 25%; + .ar-lt-0\.8\:max-h-\[30\%\] { + max-height: 30%; } - .ar-lt-1\.1\:max-h-\[80\%\] { + .ar-lt-0\.8\:max-h-\[80\%\] { max-height: 80%; } - .ar-lt-1\.1\:max-h-\[92dvh\] { + .ar-lt-0\.8\:max-h-\[92dvh\] { max-height: 92dvh; } - .ar-lt-1\.1\:text-\[5dvh\] { + .ar-lt-0\.8\:text-\[5dvh\] { font-size: 5dvh; } - .ar-lt-1\.1\:ml-\[5dvw\] { - margin-left: 5dvw; - } - - .ar-lt-1\.1\:hidden { + .ar-lt-0\.8\:hidden { display: none; } } @@ -631,16 +628,6 @@ body[data-theme~="ram"] .leaflet-tile { } } -@media (max-aspect-ratio: 0.4/1) { - .ar-lt-0\.4\:w-\[100dvw\] { - width: 100dvw; - } - - .ar-lt-0\.4\:ml-0 { - margin-left: 0; - } -} - .home-page-heart { position: absolute; color: var(--color-pink-700); diff --git a/views/layouts/general-page.html b/views/layouts/general-page.html index 435ea66..5d84649 100644 --- a/views/layouts/general-page.html +++ b/views/layouts/general-page.html @@ -14,7 +14,7 @@ - + -