about summary refs log tree commit diff
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2024-05-11T20·13+0200
committerclbot <clbot@tvl.fyi>2024-05-13T14·50+0000
commit87d7c6198d9d2c5bf51a189bc88f715d8da64141 (patch)
treeec0df691c8b88484def46bcf4f5cb6dc33d0013d
parentbad074465a7afaa3a6b6dd4a606785c35daa66c4 (diff)
feat(users/Profpatsch/whatcd-resolver): trivial artist page r/8129
Change-Id: I2c0dd1a3f300b46fec8b38c310dc08ea2f5f2492
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11648
Autosubmit: Profpatsch <mail@profpatsch.de>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
-rw-r--r--users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs b/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs
index 8843a78729c4..28aa0f2b10da 100644
--- a/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs
+++ b/users/Profpatsch/whatcd-resolver/src/WhatcdResolver.hs
@@ -208,6 +208,16 @@ htmlUi = do
                     jsonld <- httpGetJsonLd (qry.target)
                     pure $ renderJsonld jsonld
                 ),
+                ( "artist",
+                  respond.html $ \span -> do
+                    qry <-
+                      parseQueryArgs
+                        span
+                        ( label @"dbId"
+                            <$> (singleQueryArgument "db_id" Field.utf8)
+                        )
+                    pure $ [fmt|Artist ID: {qry.dbId}|]
+                ),
                 ( "autorefresh",
                   respond.plain $ do
                     qry <-
@@ -455,11 +465,16 @@ getBestTorrentsTable = do
         fresh
           & foldMap
             ( \b -> do
+                let artistLink :: Text = [fmt|/artist?db_id={b.groupId}|]
                 [hsx|
                   <tr>
                   <td>{localTorrent b}</td>
                   <td>{Html.toHtml @Int b.groupId}</td>
-                  <td>{Html.toHtml @Text b.torrentGroupJson.artist}</td>
+                  <td>
+                    <a href={artistLink}>
+                      {Html.toHtml @Text b.torrentGroupJson.artist}
+                    </a>
+                  </td>
                   <td>{Html.toHtml @Text b.torrentGroupJson.groupName}</td>
                   <td>{Html.toHtml @Int b.seedingWeight}</td>
                   <td><details hx-trigger="toggle once" hx-post="snips/redacted/torrentDataJson" hx-vals={Enc.encToBytesUtf8 $ Enc.object [("torrent-id", Enc.int b.torrentId)]}></details></td>