feat(users/Profpatsch/whatcd-resolver): add <title> to artist page

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
This commit is contained in:
Profpatsch 2024-06-07 13:58:52 +02:00 committed by clbot
parent 1b887b43da
commit ad108e5109

View file

@ -262,6 +262,7 @@ htmlUi = do
-- transmissionTorrentsTable <- lift @Transaction getTransmissionTorrentsTable -- transmissionTorrentsTable <- lift @Transaction getTransmissionTorrentsTable
pure $ pure $
htmlPageChrome htmlPageChrome
"whatcd-resolver"
[hsx| [hsx|
<form <form
hx-post="/snips/redacted/search" hx-post="/snips/redacted/search"
@ -290,13 +291,13 @@ htmlUi = do
/> />
|] |]
htmlPageChrome :: (ToHtml a) => a -> Html htmlPageChrome :: (ToHtml a) => Text -> a -> Html
htmlPageChrome body = htmlPageChrome title body =
Html.docTypeHtml $ Html.docTypeHtml $
[hsx| [hsx|
<head> <head>
<!-- TODO: set nice page title for each page --> <!-- TODO: set nice page title for each page -->
<title>whatcd-resolver</title> <title>{title}</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <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"> <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 -> dat ->
m Html m Html
artistPage dat = runTransaction $ do 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 $ pure $
htmlPageChrome htmlPageChrome
( case artistName of
Nothing -> "whatcd-resolver"
Just a -> [fmt|{a} - Artist Page - whatcd-resolver|]
)
[hsx| [hsx|
Artist ID: {dat.artistRedactedId} Artist ID: {dat.artistRedactedId}