From f94d232ffbbb40c67925313dbb8025286035ee06 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Thu, 27 Oct 2022 15:12:42 -0500 Subject: Rename: user.lisp home.lisp --- home.lisp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ user.lisp | 56 -------------------------------------------------------- vampire.asd | 2 +- 3 files changed, 57 insertions(+), 57 deletions(-) create mode 100644 home.lisp delete mode 100644 user.lisp diff --git a/home.lisp b/home.lisp new file mode 100644 index 0000000..c0ec8a6 --- /dev/null +++ b/home.lisp @@ -0,0 +1,56 @@ +;;;; user.lisp + +(in-package :vampire) + +;;; CLIENT STATE + +(defclass/std user-ctl () + ()) + + +;;; CLIENT CONTROL + +;;; CLIENT UI + +(defun create-new-playlist-form (parent &rest args) + (declare (ignorable args)) + (with-clog-create parent + (div () + (section (:h2 :content "Create New Playlist")) + (label (:content "Playlist Title:")) + (form-element (:text :bind pl-title)) + (button (:content "Create" :bind btn))) + (set-on-click + btn + (thunk* + (new-playlist (session-user parent) :title (value pl-title)) + (reload (location (connection-body parent))))))) + +(defun url-to-playlist (pl) + (format nil "/playlist/~a" + (key pl))) + +(defun create-playlist-listing (parent &rest args) + (declare (ignorable args)) + (dolist (pl (user-playlists (session-user parent))) + (let ((url + (url-to-playlist pl))) + (with-clog-create parent + (div () + (section (:h4) + (a (:link url :content (playlist-title pl) :bind pl-link)))) + (set-on-click + pl-link + (thunk* + (setf (url (location (connection-body parent))) + url))))))) + +(defun user-home-page (body) + (with-clog-create body + (div () + (navigation-header ()) + (p (:content (format nil "Welcome ~a" (user-name (session-user body))))) + (new-playlist-form ()) + (playlist-listing ())))) + + diff --git a/user.lisp b/user.lisp deleted file mode 100644 index c0ec8a6..0000000 --- a/user.lisp +++ /dev/null @@ -1,56 +0,0 @@ -;;;; user.lisp - -(in-package :vampire) - -;;; CLIENT STATE - -(defclass/std user-ctl () - ()) - - -;;; CLIENT CONTROL - -;;; CLIENT UI - -(defun create-new-playlist-form (parent &rest args) - (declare (ignorable args)) - (with-clog-create parent - (div () - (section (:h2 :content "Create New Playlist")) - (label (:content "Playlist Title:")) - (form-element (:text :bind pl-title)) - (button (:content "Create" :bind btn))) - (set-on-click - btn - (thunk* - (new-playlist (session-user parent) :title (value pl-title)) - (reload (location (connection-body parent))))))) - -(defun url-to-playlist (pl) - (format nil "/playlist/~a" - (key pl))) - -(defun create-playlist-listing (parent &rest args) - (declare (ignorable args)) - (dolist (pl (user-playlists (session-user parent))) - (let ((url - (url-to-playlist pl))) - (with-clog-create parent - (div () - (section (:h4) - (a (:link url :content (playlist-title pl) :bind pl-link)))) - (set-on-click - pl-link - (thunk* - (setf (url (location (connection-body parent))) - url))))))) - -(defun user-home-page (body) - (with-clog-create body - (div () - (navigation-header ()) - (p (:content (format nil "Welcome ~a" (user-name (session-user body))))) - (new-playlist-form ()) - (playlist-listing ())))) - - diff --git a/vampire.asd b/vampire.asd index 63d7715..2861383 100644 --- a/vampire.asd +++ b/vampire.asd @@ -22,6 +22,6 @@ (:file "navigation") (:file "new-account") (:file "login") - (:file "user") + (:file "home") (:file "playlist") (:file "vampire"))) -- cgit v1.2.3