about summary refs log tree commit diff
path: root/users/Profpatsch/whatcd-resolver
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2024-06-07T11·58+0200
committerclbot <clbot@tvl.fyi>2024-06-07T12·19+0000
commitad108e51091e19bd1645e87ec490e678467a9dc2 (patch)
tree30f991e6429538dbac0b51117604951461faf2e0 /users/Profpatsch/whatcd-resolver
parent1b887b43da0e3670e39b81ebbec7fc237006dcd1 (diff)
feat(users/Profpatsch/whatcd-resolver): add <title> to artist page r/8224
Change-Id: I49c4f657b099de806cc310bbf0a17ceba09b4d0f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11760
Reviewed-by: Profpatsch <mail@profpatsch.de>
Autosubmit: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/Profpatsch/whatcd-resolver')
-rw-r--r--users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs b/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs
index b39f3ccfed90..73a9dccb12ac 100644
--- a/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs
+++ b/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs
@@ -262,6 +262,7 @@ htmlUi = do
       -- transmissionTorrentsTable <- lift @Transaction getTransmissionTorrentsTable
       pure $
         htmlPageChrome
+          "whatcd-resolver"
           [hsx|
             <form
               hx-post="/snips/redacted/search"
@@ -290,13 +291,13 @@ htmlUi = do
             />
         |]
 
-htmlPageChrome :: (ToHtml a) => a -> Html
-htmlPageChrome body =
+htmlPageChrome :: (ToHtml a) => Text -> a -> Html
+htmlPageChrome title body =
   Html.docTypeHtml $
     [hsx|
       <head>
         <!-- TODO: set nice page title for each page -->
-        <title>whatcd-resolver</title>
+        <title>{title}</title>
         <meta charset="utf-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">
         <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
@@ -326,9 +327,15 @@ artistPage ::
   dat ->
   m Html
 artistPage dat = runTransaction $ do
-  torrents <- getBestTorrentsTable (Just $ getLabel @"artistRedactedId" dat)
+  fresh <- getBestTorrentsData (Just $ getLabel @"artistRedactedId" dat)
+  let artistName = fresh & findMaybe (\t -> t.artists & findMaybe (\a -> if a.artistId == (dat.artistRedactedId & fromIntegral @Natural @Int) then Just a.artistName else Nothing))
+  let torrents = mkBestTorrentsTable fresh
   pure $
     htmlPageChrome
+      ( case artistName of
+          Nothing -> "whatcd-resolver"
+          Just a -> [fmt|{a} - Artist Page - whatcd-resolver|]
+      )
       [hsx|
         Artist ID: {dat.artistRedactedId}