From 1b2b7c3eb939724696894f31ff27db97b0cac84c Mon Sep 17 00:00:00 2001 From: Andreas Widen Date: Sat, 25 Nov 2023 17:21:37 +0100 Subject: Initial commit. Signed-off-by: Andreas Widen --- apps/media/templates/components.scm | 48 +++++++++++++++++++++++++++ apps/media/templates/screenshot.scm | 43 ++++++++++++++++++++++++ apps/media/templates/screenshots-overview.scm | 28 ++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 apps/media/templates/components.scm create mode 100644 apps/media/templates/screenshot.scm create mode 100644 apps/media/templates/screenshots-overview.scm (limited to 'apps/media/templates') diff --git a/apps/media/templates/components.scm b/apps/media/templates/components.scm new file mode 100644 index 0000000..880d69f --- /dev/null +++ b/apps/media/templates/components.scm @@ -0,0 +1,48 @@ +;;; Harmonic Flow web site + +(define-module (apps media templates components) + #:use-module (apps aux lists) + #:use-module (apps aux web) + #:use-module (apps base templates components) + #:use-module (apps base utils) + #:use-module (apps i18n) + #:use-module (apps media types) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-19) + #:export (screenshot->shtml + screenshots-box)) + + +;;; +;;; Components. +;;; + + +(define (screenshot->shtml shot) + "Return an SHTML representation of the given screenshot object. + + SHOT () + A screenshot object as defined in (apps media types)." + `(div + (@ (class "screenshot-preview")) + (a + (@ (href ,(hfweb-url (url-path-join "screenshots" + (screenshot-slug shot) "")))) + (img + (@ (class "responsive-image") + (src ,(screenshot-preview shot)) + (alt ""))) + (span (@ (class "screenshot-inset-shadow")) "")) + (p ,(screenshot-caption shot) (span (@ (class "hidden")) ".")))) + + +(define* (screenshots-box screenshots #:optional (n 6) #:key shadow) + "Return SHTML for a box displaying up to N many SCREENSHOTS randomly +chosen at build time. If SHADOW is true, a shadow is displayed at the +top." + `(div + (@ (class ,(string-join `("screenshots-box" + ,@(if shadow + '("top-shadow-bg") + '()))))) + ,@(map screenshot->shtml (take-random screenshots n)))) \ No newline at end of file diff --git a/apps/media/templates/screenshot.scm b/apps/media/templates/screenshot.scm new file mode 100644 index 0000000..5a32016 --- /dev/null +++ b/apps/media/templates/screenshot.scm @@ -0,0 +1,43 @@ +;;; Harmonic Flow web site + +(define-module (apps media templates screenshot) + #:use-module (apps base templates theme) + #:use-module (apps base types) + #:use-module (apps base utils) + #:use-module (apps media templates components) + #:use-module (apps media types) + #:use-module (apps i18n) + #:export (screenshot-t)) + + +(define (screenshot-t context) + "Return an SHTML page for the screenshot in the CONTEXT." + (let ((shot (context-datum context "screenshot")) + (shots (context-datum context "screenshots"))) + (theme + #:title (list (screenshot-title shot) (C_ "webpage title" "screenshot |")) + #:description (screenshot-caption shot) + #:keywords + (string-split ;TRANSLATORS: |-separated list of webpage keywords + (G_ "Harmonic Flow|HFGE|Screenshot") #\|) + #:active-menu-item (C_ "website menu" "Screenshots") + #:css (list (hfweb-url "static/base/css/index.css") + (hfweb-url "static/media/css/screenshots.css")) + #:crumbs (list (crumb (C_ "website menu" "Screenshots") (hfweb-url "screenshots/")) + (crumb (screenshot-title shot) "./")) + #:content + `(main + (section + (@ (class "light-text centered-text noise-bg")) + (h2 + (@ (class "a11y-offset")) + ,(screenshot-title shot)) + + (div + (@ (class "screenshot-viewer")) + (img + (@ (class "responsive-image centered-block") + (src ,(screenshot-image shot)) + (alt ,(screenshot-caption shot))))) + + ,(screenshots-box shots #:shadow #t)))))) diff --git a/apps/media/templates/screenshots-overview.scm b/apps/media/templates/screenshots-overview.scm new file mode 100644 index 0000000..fee601b --- /dev/null +++ b/apps/media/templates/screenshots-overview.scm @@ -0,0 +1,28 @@ +;;; Harmonic Flow web site + +(define-module (apps media templates screenshots-overview) + #:use-module (apps base templates theme) + #:use-module (apps base types) + #:use-module (apps base utils) + #:use-module (apps i18n) + #:use-module (apps media templates components) + #:export (screenshots-overview-t)) + + +(define (screenshots-overview-t screenshots) + "Return an SHTML page for all SCREENSHOTS." + (theme + #:title (C_ "webpage title" '("Overview of all available screenshots |")) + #:description (G_ "Overview of all available screenshots.") + #:keywords + (string-split ;TRANSLATORS: |-separated list of webpage keywords + (G_ "Harmonic Flow|HFGE|Screenshots|Overview") #\|) + #:active-menu-item (C_ "website menu" "Screenshots") + #:css (list (hfweb-url "static/base/css/index.css")) + #:crumbs (list (crumb (C_ "website menu" "Screenshots") "./")) + #:content + `(main + (section + (@ (class "light-text centered-text noise-bg")) + + ,(screenshots-box screenshots (length screenshots) #:shadow #t))))) -- cgit v1.2.3-54-g00ecf