2020-07-16 10:29:32 -04:00
|
|
|
module IndexPage (make) where
|
|
|
|
|
|
|
|
import qualified Data.Text.Lazy as Lazy
|
|
|
|
|
|
|
|
import BuilderQQ
|
|
|
|
import Info
|
|
|
|
|
2020-08-11 14:29:54 -04:00
|
|
|
make :: Text -> IndexInfo -> Lazy.Text
|
|
|
|
make root info = toLazyText $ make' root info
|
2020-07-16 10:29:32 -04:00
|
|
|
|
2020-08-11 14:29:54 -04:00
|
|
|
make' :: Text -> IndexInfo -> Builder
|
2024-08-18 01:37:58 -04:00
|
|
|
make' root (IndexInfo {title, desc, galleries, links, footer}) = [b|
|
2020-07-16 10:29:32 -04:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang=en>
|
|
|
|
<meta charset=utf-8>
|
2020-08-04 17:12:58 -04:00
|
|
|
<link rel=stylesheet href=/style/shiny/index.css>
|
2020-08-04 18:52:56 -04:00
|
|
|
<link rel=icon href=/style/niss.svg>
|
2020-07-16 10:29:32 -04:00
|
|
|
|
2021-05-24 07:03:47 -04:00
|
|
|
<meta name=viewport content="width=1200">
|
2020-10-06 16:41:26 -04:00
|
|
|
|
2020-08-11 14:29:54 -04:00
|
|
|
<meta property=og:type content=og:website>
|
2020-08-30 13:13:40 -04:00
|
|
|
<meta property=og:title content="$title">
|
|
|
|
<meta property=og:site_name content="$title">
|
|
|
|
<meta property=og:description content="$desc">
|
|
|
|
<meta property=og:image content="$root/style/card.png">
|
2020-08-11 14:29:54 -04:00
|
|
|
<meta property=og:url content="$url">
|
2020-09-19 02:13:13 -04:00
|
|
|
<meta name=twitter:site content=@2_gecs>
|
2020-08-11 14:29:54 -04:00
|
|
|
<meta name=twitter:card content=summary>
|
|
|
|
|
2022-11-12 06:14:42 -05:00
|
|
|
<meta name=robots content='noai,noimageai'>
|
|
|
|
|
2020-08-30 13:13:40 -04:00
|
|
|
<title>$title</title>
|
2020-07-16 10:29:32 -04:00
|
|
|
|
2020-10-06 16:07:39 -04:00
|
|
|
<div class=page>
|
|
|
|
<header>
|
|
|
|
<h1 id=title>$title</h1>
|
|
|
|
</header>
|
2020-07-16 10:29:32 -04:00
|
|
|
|
2020-10-06 16:07:39 -04:00
|
|
|
<main>
|
2024-08-18 01:37:58 -04:00
|
|
|
$galleryList
|
|
|
|
$linkList
|
2020-10-06 16:07:39 -04:00
|
|
|
</main>
|
2020-07-18 05:45:32 -04:00
|
|
|
|
2024-08-18 01:37:58 -04:00
|
|
|
$footer'
|
2020-10-06 16:07:39 -04:00
|
|
|
</div>
|
2020-07-16 10:29:32 -04:00
|
|
|
|]
|
|
|
|
where
|
2024-08-18 01:37:58 -04:00
|
|
|
galleryList = if null galleries then "" else [b|
|
2020-08-04 12:56:44 -04:00
|
|
|
<nav aria-label="gallery list">
|
|
|
|
<ul id=gallery-list class=list>
|
2024-08-18 01:37:58 -04:00
|
|
|
$items
|
2020-08-04 12:56:44 -04:00
|
|
|
</ul>
|
|
|
|
</nav>
|
2020-07-19 06:22:02 -04:00
|
|
|
|]
|
|
|
|
where items = map makeItem galleries
|
2024-08-18 01:37:58 -04:00
|
|
|
linkList = if null links then "" else [b|
|
2020-08-04 12:56:44 -04:00
|
|
|
<nav aria-label="other links">
|
|
|
|
<ul id=link-list class=list>
|
2024-08-18 01:37:58 -04:00
|
|
|
$items
|
2020-08-04 12:56:44 -04:00
|
|
|
</ul>
|
|
|
|
</nav>
|
2020-07-19 06:22:02 -04:00
|
|
|
|]
|
|
|
|
where items = map makeLink links
|
|
|
|
footer' = case footer of
|
|
|
|
Nothing -> ""
|
2024-08-18 01:37:58 -04:00
|
|
|
Just f -> [b|
|
2020-07-19 06:22:02 -04:00
|
|
|
<footer>
|
2024-08-18 01:37:58 -04:00
|
|
|
$f
|
2020-07-19 06:22:02 -04:00
|
|
|
</footer>
|
|
|
|
|]
|
2020-08-30 13:13:40 -04:00
|
|
|
url = [b|$root|]
|
2020-07-16 10:29:32 -04:00
|
|
|
|
|
|
|
makeItem :: GalleryInfo -> Builder
|
2024-08-18 01:37:58 -04:00
|
|
|
makeItem (GalleryInfo {title, desc, prefix, filters}) = [b|
|
2020-08-30 13:13:40 -04:00
|
|
|
<li$nsfw><a href=$prefix title="$desc">$title</a></li>
|
2020-07-16 10:29:32 -04:00
|
|
|
|]
|
2020-08-30 13:13:40 -04:00
|
|
|
where nsfw = if hasNsfw filters then [b| class=nsfw|] else ""
|
2020-07-19 06:22:02 -04:00
|
|
|
|
|
|
|
makeLink :: Link -> Builder
|
2024-08-18 01:37:58 -04:00
|
|
|
makeLink (Link {title, url, nsfw}) = [b|
|
2020-08-30 13:13:40 -04:00
|
|
|
<li$nsfw'><a href=$url>$title</a>
|
2020-07-19 06:22:02 -04:00
|
|
|
|]
|
2020-08-30 13:13:40 -04:00
|
|
|
where nsfw' = if nsfw then [b| class=nsfw|] else ""
|
2020-07-17 06:29:13 -04:00
|
|
|
|
|
|
|
hasNsfw :: GalleryFilters -> Bool
|
2020-07-24 19:10:52 -04:00
|
|
|
hasNsfw (GalleryFilters {nsfw}) = nsfw /= NoNsfw
|