aboutsummaryrefslogtreecommitdiffhomepage
path: root/explore.lisp
blob: f6f7ff7335e5b7c39b1acbea840d83bd374ea040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;;; explore.lisp

(in-package :vampire)

(defun create-media-search-area (parent)
  (with-clog-create parent
      (p (:content "media search area"))))

(defun create-playlist-explore-card (parent pl)
  (with-clog-create parent
      (div (:bind card :class "card")
           (a (:link (url-to-playlist pl) )
              (img (:bind thumb :class "thumb"))
              (br ())
              (span (:content (playlist-title pl)))
              (span (:content " -- "))
              (span (:content (secs-to-hms (playlist-duration pl))))))
    (when-let (track (first (playlist-tracks pl)))
      (setf (url-src thumb) (or (track-thumb-url track) "")))))

(defun create-recent-playlists-area (parent)
  (let* ((container (create-div parent :class "row")))
    (dolist (pl (recent-playlists 1000))
      (create-playlist-explore-card container pl))))

(defun create-user-list (parent)
  (with-clog-create parent
      (unordered-list (:bind user-container))
    (dolist (user (store-objects-with-class 'user))
      (with-clog-create user-container 
          (list-item () 
                     (a (:link (url-to-user user)
                         :content (format nil " ~a " (user-name user)))))))))

(defun explore-page (body)
  (include-style body)
  (with-clog-create body
      (div ()
           (navigation-header ())
           (div (:class "row")
                (p (:content "ANNOUNCEMENT: Vampire Sucks (ha ha). No really. It has been regularly refusing connections. You may have noticed a White Screen Of Death. I (colin) have been (very slowly) working on an improved application. Stay tuned: IMPROVEMENTS LAND IN OCTOBER 2024. Forthcoming new features: Comments! Search! Exploration!")))
           (div (:class "row")
                (div (:bind playlist-area)
                     (section (:h2 :content "Recent Playlists" :class "center"))
                     (recent-playlists-area ()))
                (div ()
                     (section (:h3 :content "Who uses this?" :class "center"))
                     (user-list ()))))))