diff options
Diffstat (limited to 'home.lisp')
-rw-r--r-- | home.lisp | 37 |
1 files changed, 30 insertions, 7 deletions
@@ -21,18 +21,22 @@ (format nil "/playlist/~a" (key pl))) -(defun create-playlist-listing (parent) - (dolist (pl (user-playlists (session-user parent))) +(defun create-playlist-listing (parent &optional user) + (dolist (pl (user-playlists (or user (session-user parent)))) (with-clog-create parent (div (:bind pl-item) (div () (playlist-explore-card (pl)) (button (:content "delete" :bind btn)))) - (set-on-click - btn - (thunk* - (destroy-playlist pl) - (destroy pl-item)))))) + (cond + ((eq user (session-user parent)) + (set-on-click + btn + (thunk* + (destroy-playlist pl) + (destroy pl-item)))) + (t + (destroy btn)))))) (defun create-invite-list-item (invite-list invite) (with-clog-create invite-list @@ -88,4 +92,23 @@ (new-playlist-form ()) (invite-control ())))))) +(defun user-key-from-url (url) + (first (last (ppcre:split "/" (nth 4 (multiple-value-list (quri:parse-uri url))))))) + +(defun user-listing-page (body) + (when-let* ((user-id + (user-key-from-url (url (location body)))) + (user + (object-with-key user-id))) + (include-style body) + (with-clog-create body + (div () + (navigation-header ()) + (div (:class "row") + (div () + (section (:h3 :content (format nil "Playlists by ~a" + (user-name user)))) + (div (:class "row") + (playlist-listing (user))))))))) + |