;; Account dashboard components (defcomp ~dashboard/error-banner (&key (error :as string)) (when error (div :class "rounded-lg border border-red-200 bg-red-50 text-red-800 px-4 py-3 text-sm" error))) (defcomp ~dashboard/user-email (&key (email :as string)) (when email (p :class "text-sm text-stone-500 mt-1" email))) (defcomp ~dashboard/user-name (&key (name :as string)) (when name (p :class "text-sm text-stone-600" name))) (defcomp ~dashboard/logout-form (&key (csrf-token :as string)) (form :action "/auth/logout/" :method "post" (input :type "hidden" :name "csrf_token" :value csrf-token) (button :type "submit" :class "inline-flex items-center gap-2 rounded-full border border-stone-300 px-4 py-2 text-sm font-medium text-stone-700 hover:bg-stone-50 transition" (i :class "fa-solid fa-right-from-bracket text-xs") " Sign out"))) (defcomp ~dashboard/label-item (&key (name :as string)) (span :class "inline-flex items-center rounded-full border border-stone-200 px-3 py-1 text-xs font-medium bg-white/60" name)) (defcomp ~dashboard/labels-section (&key items) (when items (div (h2 :class "text-base font-semibold tracking-tight mb-3" "Labels") (div :class "flex flex-wrap gap-2" items)))) (defcomp ~dashboard/main-panel (&key error email name logout labels) (div :class "w-full max-w-3xl mx-auto px-4 py-6" (div :class "bg-white/70 backdrop-blur rounded-2xl shadow border border-stone-200 p-6 sm:p-8 space-y-8" error (div :class "flex items-center justify-between" (div (h1 :class "text-xl font-semibold tracking-tight" "Account") email name) logout) labels))) ;; Assembled dashboard content — replaces Python _account_main_panel_sx (defcomp ~dashboard/content (&key (error :as string?)) (let* ((user (current-user)) (csrf (csrf-token))) (~dashboard/main-panel :error (when error (~dashboard/error-banner :error error)) :email (when (get user "email") (~dashboard/user-email :email (get user "email"))) :name (when (get user "name") (~dashboard/user-name :name (get user "name"))) :logout (~dashboard/logout-form :csrf-token csrf) :labels (when (not (empty? (or (get user "labels") (list)))) (~dashboard/labels-section :items (map (lambda (label) (~dashboard/label-item :name (get label "name"))) (get user "labels")))))))