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:
@@ -82,12 +82,12 @@
|
|||||||
[:div {:class "flex gap-1 mt-4"}
|
[:div {:class "flex gap-1 mt-4"}
|
||||||
[:button {:class (if (= active-tab :today) tab-active tab-inactive)
|
[:button {:class (if (= active-tab :today) tab-active tab-inactive)
|
||||||
:hx-get "/prices/today"
|
:hx-get "/prices/today"
|
||||||
:hx-target "#price-content"
|
:hx-target "#price-panel"
|
||||||
:hx-swap "innerHTML"}
|
:hx-swap "innerHTML"}
|
||||||
"Today"]
|
"Today"]
|
||||||
[:button {:class (if (= active-tab :tomorrow) tab-active tab-inactive)
|
[:button {:class (if (= active-tab :tomorrow) tab-active tab-inactive)
|
||||||
:hx-get "/prices/tomorrow"
|
:hx-get "/prices/tomorrow"
|
||||||
:hx-target "#price-content"
|
:hx-target "#price-panel"
|
||||||
:hx-swap "innerHTML"}
|
:hx-swap "innerHTML"}
|
||||||
"Tomorrow"]])
|
"Tomorrow"]])
|
||||||
|
|
||||||
@@ -120,11 +120,11 @@
|
|||||||
|
|
||||||
(defn prices-today [query-fn request]
|
(defn prices-today [query-fn request]
|
||||||
(fragment
|
(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]
|
(defn prices-tomorrow [query-fn request]
|
||||||
(fragment
|
(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]
|
(defn fetch-prices [query-fn request]
|
||||||
(prices/fetch-and-save! query-fn)
|
(prices/fetch-and-save! query-fn)
|
||||||
|
|||||||
Reference in New Issue
Block a user