fix(users/Profpatsch/whatcd-resolver): add page chrome to artist

Change-Id: Id13553c450603b04c6bba0085d7f3246fe0d54af
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11682
Autosubmit: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
Profpatsch 2024-05-16 22:26:51 +02:00 committed by clbot
parent c5555f25da
commit 54ea3eeacb

View file

@ -24,6 +24,7 @@ import FieldParser (FieldParser, FieldParser' (..))
import FieldParser qualified as Field import FieldParser qualified as Field
import Html qualified import Html qualified
import IHP.HSX.QQ (hsx) import IHP.HSX.QQ (hsx)
import IHP.HSX.ToHtml (ToHtml)
import Json qualified import Json qualified
import Json.Enc (Enc) import Json.Enc (Enc)
import Json.Enc qualified as Enc import Json.Enc qualified as Enc
@ -259,24 +260,8 @@ htmlUi = do
bestTorrentsTable <- getBestTorrentsTable Nothing bestTorrentsTable <- getBestTorrentsTable Nothing
-- transmissionTorrentsTable <- lift @Transaction getTransmissionTorrentsTable -- transmissionTorrentsTable <- lift @Transaction getTransmissionTorrentsTable
pure $ pure $
Html.docTypeHtml htmlPageChrome
[hsx| [hsx|
<head>
<title>whatcd-resolver</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">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<script src="https://unpkg.com/htmx.org@1.9.2" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"></script>
<style>
dl {
margin: 1em;
padding: 0.5em 1em;
border: thin solid;
}
</style>
</head>
<body>
<form <form
hx-post="/snips/redacted/search" hx-post="/snips/redacted/search"
hx-target="#redacted-search-results"> hx-target="#redacted-search-results">
@ -302,6 +287,30 @@ htmlUi = do
hx-trigger="every 5s" hx-trigger="every 5s"
hx-swap="none" hx-swap="none"
/> />
|]
htmlPageChrome :: (ToHtml a) => a -> Html
htmlPageChrome body =
Html.docTypeHtml $
[hsx|
<head>
<!-- TODO: set nice page title for each page -->
<title>whatcd-resolver</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">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<script src="https://unpkg.com/htmx.org@1.9.2" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"></script>
<style>
dl {
margin: 1em;
padding: 0.5em 1em;
border: thin solid;
}
</style>
</head>
<body>
{body}
</body> </body>
|] |]
@ -317,7 +326,8 @@ artistPage ::
m Html m Html
artistPage dat = runTransaction $ do artistPage dat = runTransaction $ do
torrents <- getBestTorrentsTable (Just $ label @"artistId" dat.dbId) torrents <- getBestTorrentsTable (Just $ label @"artistId" dat.dbId)
pure pure $
htmlPageChrome
[hsx| [hsx|
Artist ID: {dat.dbId} Artist ID: {dat.dbId}