From b75454071f4a21a0f29edbea4e8aa5751ded7f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 7 Jul 2020 02:20:18 +0200 Subject: Draft of multiple tabs for HTML popups. Adds a tab system inside each popup. Vivaldi's lighthouse says it works fine, but firefox takes way longer to load the page, and uses 100% CPU for a while. Not sure why. Possible solution would be client side rendering for the events (since they only need to be shown one clicked). It's worth taking another look at this once the popup system has been replaced. --- module/output/html.scm | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'module/output/html.scm') diff --git a/module/output/html.scm b/module/output/html.scm index 4947594a..a17a19fd 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -142,6 +142,18 @@ (div ,body)))) +(define (tabset elements) + (define tabgroup (symbol->string (gensym "tabgroup"))) + + `(div (@ (class "tabgroup")) + ,@(for (i (key body)) in (enumerate elements) + (define id (symbol->string (gensym "tab"))) + `(div (@ (class "tab")) + (input (@ (type "radio") (id ,id) (name ,tabgroup) + ,@(when (zero? i) '((checked))))) + (label (@ (for ,id) (style "top: " ,(* 6 i) "ex")) ,key) + (div (@ (class "content")) ,body))))) + (define (popup ev id) `(div (@ (class "popup-container") (id ,id)) (div (@ (class "popup")) @@ -156,7 +168,11 @@ title: "Ladda ner" href: (string-append "/calendar/" (prop ev 'UID) ".ics"))) - ,(fmt-single-event ev)))) + ,(tabset + `(("📅" ,(fmt-single-event ev)) + ;; TODO only on debug/edit? + ("" (script (@ (type "application/calendar+xml")) + ,((@ (output xcal) vcomponent->sxcal) ev)))))))) @@ -202,9 +218,6 @@ (eq? 'TENTATIVE (prop ev 'PARTSTAT))) " tentative")) (data-tipped-options ,(format #f "inline: '~a'" popup-id))))) - ,(when (debug) - `(script (@ (type "application/calendar+xml")) - ,((@ (output xcal) vcomponent->sxcal) ev))) ,(when (prop ev 'RRULE) `(span (@ (class "repeating")) "↺")) ,((get-config 'summary-filter) ev (prop ev 'SUMMARY)) -- cgit v1.2.3