{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}

module WikiMusic.SSR.View.Components.Other
  ( likeCount,
    dislikeCount,
    simpleEntityCard,
    imageCarousel,
    warningBanner,
    entityDetails,
  )
where

import Data.Map qualified as Map
import Data.Text qualified as T
import Data.UUID (UUID)
import Optics
import Relude
import Text.Blaze.Html
import Text.Blaze.Html5 as H
import Text.Blaze.Html5.Attributes as A
import WikiMusic.Model.Artwork
import WikiMusic.SSR.Language
import WikiMusic.SSR.Model.Api
import WikiMusic.SSR.View.Components.DetailList
import WikiMusic.SSR.View.Components.Forms

likeCount ::
  ( Is k1 A_Getter,
    Is k2 A_Getter,
    JoinKinds k3 l k2,
    LabelOptic "isLike" l u v Bool Bool,
    LabelOptic "opinions" k1 s1 s1 (Map k4 s2) (Map k4 s2),
    LabelOptic "opinion" k3 s2 s2 u v
  ) =>
  s1 ->
  Text
likeCount :: forall k1 k2 k3 l u v s1 k4 s2.
(Is k1 A_Getter, Is k2 A_Getter, JoinKinds k3 l k2,
 LabelOptic "isLike" l u v Bool Bool,
 LabelOptic "opinions" k1 s1 s1 (Map k4 s2) (Map k4 s2),
 LabelOptic "opinion" k3 s2 s2 u v) =>
s1 -> Text
likeCount s1
entity =
  String -> Text
T.pack
    (String -> Text) -> ([s2] -> String) -> [s2] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall b a. (Show a, IsString b) => a -> b
show
    (Int -> String) -> ([s2] -> Int) -> [s2] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [s2] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length
    ([s2] -> Text) -> [s2] -> Text
forall a b. (a -> b) -> a -> b
$ Map k4 s2 -> [s2]
forall k a. Map k a -> [a]
Map.elems
    (Map k4 s2 -> [s2]) -> Map k4 s2 -> [s2]
forall a b. (a -> b) -> a -> b
$ (s2 -> Bool) -> Map k4 s2 -> Map k4 s2
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (s2 -> Optic' k2 NoIx s2 Bool -> Bool
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic k3 NoIx s2 s2 u v
#opinion Optic k3 NoIx s2 s2 u v
-> Optic l NoIx u v Bool Bool -> Optic' k2 NoIx s2 Bool
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic l NoIx u v Bool Bool
#isLike) (s1
entity s1 -> Optic' k1 NoIx s1 (Map k4 s2) -> Map k4 s2
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k1 NoIx s1 (Map k4 s2)
#opinions)

dislikeCount ::
  ( Is k1 A_Getter,
    Is k2 A_Getter,
    JoinKinds k3 l k2,
    LabelOptic "opinions" k1 s1 s1 (Map k4 s2) (Map k4 s2),
    LabelOptic "opinion" k3 s2 s2 u v,
    LabelOptic "isDislike" l u v Bool Bool
  ) =>
  s1 ->
  Text
dislikeCount :: forall k1 k2 k3 l s1 k4 s2 u v.
(Is k1 A_Getter, Is k2 A_Getter, JoinKinds k3 l k2,
 LabelOptic "opinions" k1 s1 s1 (Map k4 s2) (Map k4 s2),
 LabelOptic "opinion" k3 s2 s2 u v,
 LabelOptic "isDislike" l u v Bool Bool) =>
s1 -> Text
dislikeCount s1
entity =
  String -> Text
T.pack
    (String -> Text) -> ([s2] -> String) -> [s2] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall b a. (Show a, IsString b) => a -> b
show
    (Int -> String) -> ([s2] -> Int) -> [s2] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [s2] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length
    ([s2] -> Text) -> [s2] -> Text
forall a b. (a -> b) -> a -> b
$ Map k4 s2 -> [s2]
forall k a. Map k a -> [a]
Map.elems
    (Map k4 s2 -> [s2]) -> Map k4 s2 -> [s2]
forall a b. (a -> b) -> a -> b
$ (s2 -> Bool) -> Map k4 s2 -> Map k4 s2
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter (s2 -> Optic' k2 NoIx s2 Bool -> Bool
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic k3 NoIx s2 s2 u v
#opinion Optic k3 NoIx s2 s2 u v
-> Optic l NoIx u v Bool Bool -> Optic' k2 NoIx s2 Bool
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic l NoIx u v Bool Bool
#isDislike) (s1
entity s1 -> Optic' k1 NoIx s1 (Map k4 s2) -> Map k4 s2
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k1 NoIx s1 (Map k4 s2)
#opinions)

mkIdentifierHref :: Text -> UUID -> AttributeValue
mkIdentifierHref :: Text -> UUID -> AttributeValue
mkIdentifierHref Text
path UUID
identifier = String -> AttributeValue
forall a. IsString a => String -> a
fromString (String
"/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Text -> String
T.unpack Text
path String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> UUID -> String
forall b a. (Show a, IsString b) => a -> b
show UUID
identifier)

simpleEntityCard ::
  ( Is k1 A_Getter,
    Is k3 A_Getter,
    Is k4 A_Getter,
    Is k5 A_Getter,
    Is k6 A_Getter,
    Is k7 A_Getter,
    Is k8 A_Getter,
    Is k9 A_Getter,
    Show a,
    JoinKinds k10 l1 k4,
    JoinKinds k10 l2 k3,
    LabelOptic "displayName" k8 s1 s1 Text Text,
    LabelOptic "isLike" l1 u v Bool Bool,
    LabelOptic "artworks" k5 s1 s1 (Map k11 s2) (Map k11 s2),
    LabelOptic "identifier" k7 s1 s1 UUID UUID,
    LabelOptic "opinions" k9 s1 s1 (Map k12 s3) (Map k12 s3),
    LabelOptic "viewCount" k1 s1 s1 a a,
    LabelOptic "artwork" k6 s2 s2 Artwork Artwork,
    LabelOptic "opinion" k10 s3 s3 u v,
    LabelOptic "isDislike" l2 u v Bool Bool
  ) =>
  Language ->
  Text ->
  s1 ->
  Html
simpleEntityCard :: forall k1 k3 k4 k5 k6 k7 k8 k9 a k10 l1 l2 s1 u v k11 s2 k12 s3.
(Is k1 A_Getter, Is k3 A_Getter, Is k4 A_Getter, Is k5 A_Getter,
 Is k6 A_Getter, Is k7 A_Getter, Is k8 A_Getter, Is k9 A_Getter,
 Show a, JoinKinds k10 l1 k4, JoinKinds k10 l2 k3,
 LabelOptic "displayName" k8 s1 s1 Text Text,
 LabelOptic "isLike" l1 u v Bool Bool,
 LabelOptic "artworks" k5 s1 s1 (Map k11 s2) (Map k11 s2),
 LabelOptic "identifier" k7 s1 s1 UUID UUID,
 LabelOptic "opinions" k9 s1 s1 (Map k12 s3) (Map k12 s3),
 LabelOptic "viewCount" k1 s1 s1 a a,
 LabelOptic "artwork" k6 s2 s2 Artwork Artwork,
 LabelOptic "opinion" k10 s3 s3 u v,
 LabelOptic "isDislike" l2 u v Bool Bool) =>
Language -> Text -> s1 -> Html
simpleEntityCard Language
language Text
path s1
entity = Html -> Html
article (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"simple-entity-card" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
  Html
maybeImg
  Html -> Html
a
    (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
href (Text -> UUID -> AttributeValue
mkIdentifierHref Text
path (s1
entity s1 -> Optic' k7 NoIx s1 UUID -> UUID
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k7 NoIx s1 UUID
#identifier))
    (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"margin-top-large"
    (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Html -> Html
h3
    (Html -> Html) -> (Text -> Html) -> Text -> Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Html
text
    (Text -> Html) -> Text -> Html
forall a b. (a -> b) -> a -> b
$ s1
entity
    s1 -> Optic' k8 NoIx s1 Text -> Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k8 NoIx s1 Text
#displayName
  Html -> Html
detailList (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
    Text -> Html -> Html
detailListEntry (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict More More
#more Optic A_Lens NoIx LanguageDict LanguageDict More More
-> Optic A_Lens NoIx More More DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx More More DictTerm DictTerm
#likes DictTerm -> Language -> Text
|##| Language
language) (Text -> Html
text (Text -> Html) -> Text -> Html
forall a b. (a -> b) -> a -> b
$ s1 -> Text
forall k1 k2 k3 l u v s1 k4 s2.
(Is k1 A_Getter, Is k2 A_Getter, JoinKinds k3 l k2,
 LabelOptic "isLike" l u v Bool Bool,
 LabelOptic "opinions" k1 s1 s1 (Map k4 s2) (Map k4 s2),
 LabelOptic "opinion" k3 s2 s2 u v) =>
s1 -> Text
likeCount s1
entity)
    Text -> Html -> Html
detailListEntry (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict More More
#more Optic A_Lens NoIx LanguageDict LanguageDict More More
-> Optic A_Lens NoIx More More DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx More More DictTerm DictTerm
#dislikes DictTerm -> Language -> Text
|##| Language
language) (Text -> Html
text (Text -> Html) -> Text -> Html
forall a b. (a -> b) -> a -> b
$ s1 -> Text
forall k1 k2 k3 l s1 k4 s2 u v.
(Is k1 A_Getter, Is k2 A_Getter, JoinKinds k3 l k2,
 LabelOptic "opinions" k1 s1 s1 (Map k4 s2) (Map k4 s2),
 LabelOptic "opinion" k3 s2 s2 u v,
 LabelOptic "isDislike" l u v Bool Bool) =>
s1 -> Text
dislikeCount s1
entity)
    Text -> Html -> Html
detailListEntry (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict More More
#more Optic A_Lens NoIx LanguageDict LanguageDict More More
-> Optic A_Lens NoIx More More DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx More More DictTerm DictTerm
#views DictTerm -> Language -> Text
|##| Language
language) (Text -> Html
text (Text -> Html) -> Text -> Html
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (a -> String) -> a -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> String
forall b a. (Show a, IsString b) => a -> b
show (a -> Text) -> a -> Text
forall a b. (a -> b) -> a -> b
$ s1
entity s1 -> Optic' k1 NoIx s1 a -> a
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k1 NoIx s1 a
#viewCount)
  where
    artworks :: [Artwork]
artworks = (s2 -> Artwork) -> [s2] -> [Artwork]
forall a b. (a -> b) -> [a] -> [b]
Relude.map (\s2
x -> s2
x s2 -> Optic' k6 NoIx s2 Artwork -> Artwork
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k6 NoIx s2 Artwork
#artwork) (Map k11 s2 -> [s2]
forall k a. Map k a -> [a]
Map.elems (Map k11 s2 -> [s2]) -> Map k11 s2 -> [s2]
forall a b. (a -> b) -> a -> b
$ s1
entity s1 -> Optic' k5 NoIx s1 (Map k11 s2) -> Map k11 s2
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k5 NoIx s1 (Map k11 s2)
#artworks) :: [Artwork]
    maybeImg :: Html
maybeImg = Html
-> (NonEmpty Artwork -> Html) -> Maybe (NonEmpty Artwork) -> Html
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Html -> Html
H.span Html
"") (Artwork -> Html
toImg (Artwork -> Html)
-> (NonEmpty Artwork -> Artwork) -> NonEmpty Artwork -> Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty Artwork -> Artwork
forall (f :: * -> *) a. IsNonEmpty f a a "head" => f a -> a
Relude.head) ([Artwork] -> Maybe (NonEmpty Artwork)
forall a. [a] -> Maybe (NonEmpty a)
nonEmpty [Artwork]
artworks)
    toImg :: Artwork -> Html
toImg Artwork
x =
      Html -> Html
a
        (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
href (Text -> UUID -> AttributeValue
mkIdentifierHref Text
path (s1
entity s1 -> Optic' k7 NoIx s1 UUID -> UUID
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k7 NoIx s1 UUID
#identifier))
        (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Html
img
        Html -> Attribute -> Html
forall h. Attributable h => h -> Attribute -> h
! Tag -> AttributeValue -> Attribute
customAttribute Tag
"loading" AttributeValue
"lazy"
        Html -> Attribute -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
src (String -> AttributeValue
forall a. IsString a => String -> a
fromString (String -> AttributeValue)
-> (Text -> String) -> Text -> AttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
T.unpack (Text -> AttributeValue) -> Text -> AttributeValue
forall a b. (a -> b) -> a -> b
$ Artwork
x Artwork -> Optic' A_Lens NoIx Artwork Text -> Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx Artwork Text
#contentUrl)

imageCarousel :: [Artwork] -> Html
imageCarousel :: [Artwork] -> Html
imageCarousel [Artwork]
artworks = do
  Html -> Html
section (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"slider" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
    (Artwork -> Html) -> [Artwork] -> Html
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
      ( \Artwork
x ->
          Html
img
            Html -> Attribute -> Html
forall h. Attributable h => h -> Attribute -> h
! Tag -> AttributeValue -> Attribute
customAttribute Tag
"loading" AttributeValue
"lazy"
            Html -> Attribute -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
src (String -> AttributeValue
forall a. IsString a => String -> a
fromString (String -> AttributeValue)
-> (Text -> String) -> Text -> AttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
T.unpack (Text -> AttributeValue) -> Text -> AttributeValue
forall a b. (a -> b) -> a -> b
$ Artwork
x Artwork -> Optic' A_Lens NoIx Artwork Text -> Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx Artwork Text
#contentUrl)
      )
      [Artwork]
artworks

entityDetailsSkeleton :: Html -> Html -> Html
entityDetailsSkeleton :: Html -> Html -> Html
entityDetailsSkeleton Html
slot0 Html
slot1 = do
  Html -> Html
H.div (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"flex direction-row justify-content-space-evenly" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
    Html -> Html
H.div (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"col" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
      Html
slot0
    Html -> Html
H.div (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"col" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
      Html
slot1

entityDetails ::
  ( Is k1 A_Getter,
    Is k2 A_Getter,
    Is k3 A_Getter,
    Is k4 A_Getter,
    Is k5 A_Getter,
    Is k6 A_Getter,
    Is k7 A_Getter,
    Is k8 A_Getter,
    Is k9 A_Getter,
    Is k10 A_Getter,
    Is k11 A_Getter,
    Is k12 A_Getter,
    Is k13 A_Getter,
    Foldable t1,
    Foldable t2,
    Foldable t3,
    Foldable t4,
    Foldable t5,
    Foldable t6,
    Show a1,
    Show a2,
    Show a3,
    Show a4,
    Show a5,
    Functor t4,
    LabelOptic "createdAt" k4 s s a2 a2,
    LabelOptic "createdBy" k3 s s a1 a1,
    LabelOptic "lastEditedAt" k11 s s (t4 a5) (t4 a5),
    LabelOptic "displayName" k5 s s Text Text,
    LabelOptic "artworks" k6 s s (Map k14 a6) (Map k14 a6),
    LabelOptic "identifier" k9 s s a3 a3,
    LabelOptic "viewCount" k10 s s a4 a4,
    LabelOptic "artwork" k7 a6 a6 Artwork Artwork,
    LabelOptic "description" k8 s s (t3 Text) (t3 Text),
    LabelOptic "soundcloudUrl" k1 s s (t1 Text) (t1 Text),
    LabelOptic "spotifyUrl" k12 s s (t5 Text) (t5 Text),
    LabelOptic "wikipediaUrl" k2 s s (t2 Text) (t2 Text),
    LabelOptic "youtubeUrl" k13 s s (t6 Text) (t6 Text)
  ) =>
  Language ->
  Text ->
  s ->
  Html
entityDetails :: forall k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12 k13 (t1 :: * -> *)
       (t2 :: * -> *) (t3 :: * -> *) (t4 :: * -> *) (t5 :: * -> *)
       (t6 :: * -> *) a1 a2 a3 a4 a5 s k14 a6.
(Is k1 A_Getter, Is k2 A_Getter, Is k3 A_Getter, Is k4 A_Getter,
 Is k5 A_Getter, Is k6 A_Getter, Is k7 A_Getter, Is k8 A_Getter,
 Is k9 A_Getter, Is k10 A_Getter, Is k11 A_Getter, Is k12 A_Getter,
 Is k13 A_Getter, Foldable t1, Foldable t2, Foldable t3,
 Foldable t4, Foldable t5, Foldable t6, Show a1, Show a2, Show a3,
 Show a4, Show a5, Functor t4, LabelOptic "createdAt" k4 s s a2 a2,
 LabelOptic "createdBy" k3 s s a1 a1,
 LabelOptic "lastEditedAt" k11 s s (t4 a5) (t4 a5),
 LabelOptic "displayName" k5 s s Text Text,
 LabelOptic "artworks" k6 s s (Map k14 a6) (Map k14 a6),
 LabelOptic "identifier" k9 s s a3 a3,
 LabelOptic "viewCount" k10 s s a4 a4,
 LabelOptic "artwork" k7 a6 a6 Artwork Artwork,
 LabelOptic "description" k8 s s (t3 Text) (t3 Text),
 LabelOptic "soundcloudUrl" k1 s s (t1 Text) (t1 Text),
 LabelOptic "spotifyUrl" k12 s s (t5 Text) (t5 Text),
 LabelOptic "wikipediaUrl" k2 s s (t2 Text) (t2 Text),
 LabelOptic "youtubeUrl" k13 s s (t6 Text) (t6 Text)) =>
Language -> Text -> s -> Html
entityDetails Language
language Text
path s
x = do
  Html -> Html -> Html
entityDetailsSkeleton Html
slot0 Html
slot1
  where
    verboseLink' :: Text -> Html
verboseLink' Text
uri = Html -> Html
a (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
href (String -> AttributeValue
forall a. IsString a => String -> a
fromString (String -> AttributeValue)
-> (Text -> String) -> Text -> AttributeValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
T.unpack (Text -> AttributeValue) -> Text -> AttributeValue
forall a b. (a -> b) -> a -> b
$ Text
uri) (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Text -> Html
text Text
uri
    path' :: String
path' = Text -> String
T.unpack Text
path
    entityLinks :: Html
entityLinks = do
      (Text -> Html) -> t5 Text -> Html
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
        (Text -> Html -> Html
detailListEntry Text
"Spotify" (Html -> Html) -> (Text -> Html) -> Text -> Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Html
verboseLink')
        (s
x s -> Optic' k12 NoIx s (t5 Text) -> t5 Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k12 NoIx s (t5 Text)
#spotifyUrl)
      (Text -> Html) -> t2 Text -> Html
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
        (Text -> Html -> Html
detailListEntry Text
"Wikipedia" (Html -> Html) -> (Text -> Html) -> Text -> Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Html
verboseLink')
        (s
x s -> Optic' k2 NoIx s (t2 Text) -> t2 Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k2 NoIx s (t2 Text)
#wikipediaUrl)
      (Text -> Html) -> t6 Text -> Html
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
        (Text -> Html -> Html
detailListEntry Text
"YouTube" (Html -> Html) -> (Text -> Html) -> Text -> Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Html
verboseLink')
        (s
x s -> Optic' k13 NoIx s (t6 Text) -> t6 Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k13 NoIx s (t6 Text)
#youtubeUrl)
      (Text -> Html) -> t1 Text -> Html
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
        (Text -> Html -> Html
detailListEntry Text
"SoundCloud" (Html -> Html) -> (Text -> Html) -> Text -> Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Html
verboseLink')
        (s
x s -> Optic' k1 NoIx s (t1 Text) -> t1 Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k1 NoIx s (t1 Text)
#soundcloudUrl)
    slot0 :: Html
slot0 = do
      [Artwork] -> Html
imageCarousel ((a6 -> Artwork) -> [a6] -> [Artwork]
forall a b. (a -> b) -> [a] -> [b]
Relude.map (a6 -> Optic' k7 NoIx a6 Artwork -> Artwork
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k7 NoIx a6 Artwork
#artwork) (Map k14 a6 -> [a6]
forall k a. Map k a -> [a]
Map.elems (Map k14 a6 -> [a6]) -> Map k14 a6 -> [a6]
forall a b. (a -> b) -> a -> b
$ s
x s -> Optic' k6 NoIx s (Map k14 a6) -> Map k14 a6
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k6 NoIx s (Map k14 a6)
#artworks))
      Html -> Html
H.div (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
        Html -> Html
a
          (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
href (String -> AttributeValue
forall a. IsString a => String -> a
fromString (String
"/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
path' String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"/edit/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> a3 -> String
forall b a. (Show a, IsString b) => a -> b
show (s
x s -> Optic' k9 NoIx s a3 -> a3
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k9 NoIx s a3
#identifier)))
          (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Html -> Html
button
          (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Text -> Html
text (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict Buttons Buttons
#buttons Optic A_Lens NoIx LanguageDict LanguageDict Buttons Buttons
-> Optic A_Lens NoIx Buttons Buttons DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx Buttons Buttons DictTerm DictTerm
#edit DictTerm -> Language -> Text
|##| Language
language)
        Html -> Html
a
          (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
href (String -> AttributeValue
forall a. IsString a => String -> a
fromString (String
"/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
path' String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"/delete/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> a3 -> String
forall b a. (Show a, IsString b) => a -> b
show (s
x s -> Optic' k9 NoIx s a3 -> a3
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k9 NoIx s a3
#identifier)))
          (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Html -> Html
button
          (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Text -> Html
text (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict Buttons Buttons
#buttons Optic A_Lens NoIx LanguageDict LanguageDict Buttons Buttons
-> Optic A_Lens NoIx Buttons Buttons DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx Buttons Buttons DictTerm DictTerm
#delete DictTerm -> Language -> Text
|##| Language
language)
      (Text -> Html) -> t3 Text -> Html
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (Html -> Html
p (Html -> Html) -> (Text -> Html) -> Text -> Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Html
text) (s
x s -> Optic' k8 NoIx s (t3 Text) -> t3 Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k8 NoIx s (t3 Text)
#description)

    slot1 :: Html
slot1 = do
      (Html -> Html
h3 (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"text-align-center font-size-xxx-large font-weight-500") (Html -> Html) -> (Text -> Html) -> Text -> Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Html
forall a. IsString a => String -> a
fromString (String -> Html) -> (Text -> String) -> Text -> Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
T.unpack (Text -> Html) -> Text -> Html
forall a b. (a -> b) -> a -> b
$ (s
x s -> Optic' k5 NoIx s Text -> Text
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k5 NoIx s Text
#displayName)
      Html -> Html
H.div (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"flex direction-column" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
        Html -> Html
section (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"flex direction-row justify-content-center gap-small align-items-baseline" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
          Text -> Text -> Html -> Html
postForm' (String -> Text
forall a. IsString a => String -> a
fromString (String
"/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
path' String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"/like/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> a3 -> String
forall b a. (Show a, IsString b) => a -> b
show (s
x s -> Optic' k9 NoIx s a3 -> a3
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k9 NoIx s a3
#identifier))) Text
"" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
            Html -> Html
button (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
type_ AttributeValue
"submit" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
              Html -> Html
H.span Html
"+"
              Text -> Html
text (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict Buttons Buttons
#buttons Optic A_Lens NoIx LanguageDict LanguageDict Buttons Buttons
-> Optic A_Lens NoIx Buttons Buttons DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx Buttons Buttons DictTerm DictTerm
#like DictTerm -> Language -> Text
|##| Language
language)
          Text -> Text -> Html -> Html
postForm' (String -> Text
forall a. IsString a => String -> a
fromString (String
"/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
path' String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"/dislike/" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> a3 -> String
forall b a. (Show a, IsString b) => a -> b
show (s
x s -> Optic' k9 NoIx s a3 -> a3
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k9 NoIx s a3
#identifier))) Text
"" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
            Html -> Html
button (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
type_ AttributeValue
"submit" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
              Html -> Html
H.span Html
"-"
              Text -> Html
text (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict Buttons Buttons
#buttons Optic A_Lens NoIx LanguageDict LanguageDict Buttons Buttons
-> Optic A_Lens NoIx Buttons Buttons DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx Buttons Buttons DictTerm DictTerm
#dislike DictTerm -> Language -> Text
|##| Language
language)

        Html -> Html
section (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Html -> Html
detailList (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
          Text -> Html -> Html
detailListEntry (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict More More
#more Optic A_Lens NoIx LanguageDict LanguageDict More More
-> Optic A_Lens NoIx More More DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx More More DictTerm DictTerm
#views DictTerm -> Language -> Text
|##| Language
language) (a4 -> Html
forall b a. (Show a, IsString b) => a -> b
Relude.show (a4 -> Html) -> a4 -> Html
forall a b. (a -> b) -> a -> b
$ s
x s -> Optic' k10 NoIx s a4 -> a4
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k10 NoIx s a4
#viewCount)
          Text -> Html -> Html
detailListEntry (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict More More
#more Optic A_Lens NoIx LanguageDict LanguageDict More More
-> Optic A_Lens NoIx More More DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx More More DictTerm DictTerm
#createdAt DictTerm -> Language -> Text
|##| Language
language) (a2 -> Html
forall b a. (Show a, IsString b) => a -> b
Relude.show (a2 -> Html) -> a2 -> Html
forall a b. (a -> b) -> a -> b
$ s
x s -> Optic' k4 NoIx s a2 -> a2
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k4 NoIx s a2
#createdAt)
          (Html -> Html) -> t4 Html -> Html
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
            (Text -> Html -> Html
detailListEntry (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict More More
#more Optic A_Lens NoIx LanguageDict LanguageDict More More
-> Optic A_Lens NoIx More More DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx More More DictTerm DictTerm
#lastEditedAt DictTerm -> Language -> Text
|##| Language
language))
            (a5 -> Html
forall b a. (Show a, IsString b) => a -> b
Relude.show (a5 -> Html) -> t4 a5 -> t4 Html
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> s
x s -> Optic' k11 NoIx s (t4 a5) -> t4 a5
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k11 NoIx s (t4 a5)
#lastEditedAt)
          Text -> Html -> Html
detailListEntry (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict More More
#more Optic A_Lens NoIx LanguageDict LanguageDict More More
-> Optic A_Lens NoIx More More DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx More More DictTerm DictTerm
#createdBy DictTerm -> Language -> Text
|##| Language
language) (a1 -> Html
forall b a. (Show a, IsString b) => a -> b
Relude.show (a1 -> Html) -> a1 -> Html
forall a b. (a -> b) -> a -> b
$ s
x s -> Optic' k3 NoIx s a1 -> a1
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' k3 NoIx s a1
#createdBy)

          Html
hr
          Html
entityLinks

warningBanner :: Language -> Html
warningBanner :: Language -> Html
warningBanner Language
language =
  Html -> Html
section (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"warning-section text-align-center" (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ do
    Html -> Html
small
      (Html -> Html) -> Attribute -> Html -> Html
forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
class_ AttributeValue
"warning-text"
      (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Text -> Html
text
        (LanguageDict
dictionary LanguageDict
-> Optic' A_Lens NoIx LanguageDict DictTerm -> DictTerm
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic A_Lens NoIx LanguageDict LanguageDict More More
#more Optic A_Lens NoIx LanguageDict LanguageDict More More
-> Optic A_Lens NoIx More More DictTerm DictTerm
-> Optic' A_Lens NoIx LanguageDict DictTerm
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Lens NoIx More More DictTerm DictTerm
#warningHeavyDevelopment DictTerm -> Language -> Text
|##| Language
language)