Highlight active tab when switching between Today/Tomorrow

Swap the full tab panel on click so the active tab styling updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 14:01:34 +01:00
co-authored by Claude Opus 4.6
parent bca9da4639
commit 6b95a95ca6
+4 -4
View File
@@ -82,12 +82,12 @@
[:div {:class "flex gap-1 mt-4"}
[:button {:class (if (= active-tab :today) tab-active tab-inactive)
:hx-get "/prices/today"
:hx-target "#price-content"
:hx-target "#price-panel"
:hx-swap "innerHTML"}
"Today"]
[:button {:class (if (= active-tab :tomorrow) tab-active tab-inactive)
:hx-get "/prices/tomorrow"
:hx-target "#price-content"
:hx-target "#price-panel"
:hx-swap "innerHTML"}
"Tomorrow"]])
@@ -120,11 +120,11 @@
(defn prices-today [query-fn request]
(fragment
(price-table "Today — DK1" (prices/get-today-prices query-fn))))
(price-content :today (prices/get-today-prices query-fn))))
(defn prices-tomorrow [query-fn request]
(fragment
(price-table "Tomorrow — DK1" (prices/get-tomorrow-prices query-fn))))
(price-content :tomorrow (prices/get-tomorrow-prices query-fn))))
(defn fetch-prices [query-fn request]
(prices/fetch-and-save! query-fn)