Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions resources/public/js/cx.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,29 @@ function ensure_show_modal() {
document.getElementById("modal").addEventListener('htmx:afterSwap', showModal)
}

function stopPropagate(e) {
e.stopPropagation();
}

function preventDefault(e) {
e.preventDefault();
}

function apply_stop_propagate_handler() {
document.querySelectorAll('.stop-propagate').forEach((el) => el.removeEventListener('click', stopPropagate));
document.querySelectorAll('.stop-propagate').forEach((el) => el.addEventListener('click', stopPropagate));
}

function apply_prevent_default_handler() {
document.querySelectorAll('.prevent-default').forEach((el) => el.removeEventListener('click', preventDefault));
document.querySelectorAll('.prevent-default').forEach((el) => el.addEventListener('click', preventDefault));
}

function apply_handlers() {
ensure_cx_toggle()
ensure_show_modal()
apply_stop_propagate_handler()
apply_prevent_default_handler()
}

function handle_response_errors(err) {
Expand Down
48 changes: 27 additions & 21 deletions src/co/gaiwan/compass/html/sessions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
:value
(if (session/participating? session user)
"Leave"
"Join")}]])))
"Join")
:class "prevent-default stop-propagate"}]])))

(o/defstyled session-card-actions :nav
:flex :justify-end :w-full
Expand Down Expand Up @@ -123,13 +124,16 @@
[join-btn session user]]))

(o/defstyled session-card :div
:flex :gap-1
:bg-surface-2
:shadow-2
:boder :border-solid :border-surface-3
[:a :flex :gap-1
:bg-surface-2
:shadow-2
:boder :border-solid :border-surface-3]
#_:text-center
[:a
{:text-decoration "none"
:color "inherit"}]
[:.title :font-size-4 :font-semibold :mt-3 :mb-2
[:a {:color t/--text-1}]]
{:color t/--text-1}]
[:.subtitle :font-size-3 :font-medium :mb-3
{:color t/--text-2}]
[:.details :w-full #_:items-center :py-3 :mr-2 :relative]
Expand Down Expand Up @@ -162,21 +166,23 @@
;; :cx-toggle "expanded"
;; :cx-target (str "." session-card)
:hx-disinherit "hx-target hx-select"}
[:div.type (:session.type/name type)]

[img+join-widget session user]

[:div.details
[:h2.title
[:a {:href (url-for :session/get {:id (:db/id session)})}
[:span.datetime
(str (time/truncate-to (time/local-time time) :minutes)) " · "]
title]]
[:h3.subtitle (session/subtitle session)]
#_[:div.expansion
[session-card-actions session user]]
[:div.loc (fmt-dur duration) " @ " (:location/name location)]
#_[:p.host "Organized by " organized]]]))
[:a
{:href (url-for :session/get {:id (:db/id session)}) }
[:div.type (:session.type/name type)]

[img+join-widget session user]

[:div.details
[:h2.title
[:span
[:span.datetime
(str (time/truncate-to (time/local-time time) :minutes)) " · "]
title]]
[:h3.subtitle (session/subtitle session)]
#_[:div.expansion
[session-card-actions session user]]
[:div.loc (fmt-dur duration) " @ " (:location/name location)]
#_[:p.host "Organized by " organized]]]]))

(o/defrules session-card-pulse
(garden.stylesheet/at-keyframes
Expand Down