WIP: render thread - get thread bodies working

This commit is contained in:
towards-a-new-leftypol 2024-02-05 05:22:12 -05:00
parent d998067828
commit 831c0ba096
6 changed files with 289 additions and 3 deletions

View File

@ -91,7 +91,8 @@ executable chandlr
time,
bytestring,
filepath,
network-uri
network-uri,
containers
-- Directories containing source files.
hs-source-dirs: src

1
html/files.html Normal file
View File

@ -0,0 +1 @@
<div class="files"> <div class="file"> <p class="fileinfo"><span>File <small>(<a class="hide-image-link" href="javascript:void(0)" style="">hide</a>)</small>: </span><a href="/leftypol/src/1705665213107.png" target="_blank">1705665213107.png</a> <span class="details"> ( 1.88 MB , 1200x800 , <a download="south-african-representatives-at-the-international-court-of-justice.png" href="javascript:void(0)" title="Save as original filename (south-african-representatives-at-the-international-court-of-justice.png)">south-african-representati….png</a> ) </span></p> <a href="/leftypol/src/1705665213107.png" target="_blank"><img class="post-image" loading="lazy" src="https://leftychan.net/leftypol/thumb/1705665213107.png" style="width:255px;height:170px" alt=""></a> </div> </div>

34
html/op.html Normal file
View File

@ -0,0 +1,34 @@
<div class="post op" id="op_477700">
<a class="hide-thread-link" style="float:left;margin-right:5px" href="javascript:void(0)">[]</a>
<p class="intro">
<input type="checkbox" class="delete" name="delete_477700" id="delete_477700">
<a href="#" class="post-btn" title="Post menu"></a>
<label for="delete_477700">
<span class="subject">Israel 'at war' as Hamas gunmen launch surprise attack from Gaza Thread Pt. II</span> <span class="name">Anonymous</span> <img class="flag" src="/static/flags/acceleration.png" style="width:auto;max-height:16px;" alt="Acceleration" title="Acceleration"> <time datetime="2024-01-19T11:53:33Z" data-local="true" title="14 days ago">2024-01-19 (Fri) 06:53:33</time>
</label>
&nbsp;
<a class="post_no" id="post_no_477700" onclick="highlightReply(477700)" href="/leftypol/res/477700.html#477700">No.</a>
<a class="post_no" onclick="citeReply(477700)" href="/leftypol/res/477700.html#q477700">477700</a>
<a class="watchThread" href="#">[Watch Thread]</a>
</p>
<div class="body">
Continued from <a onclick="highlightReply('475181', event);" href="/leftypol/res/475181.html#475181">&gt;&gt;475181</a>
<br>
<br>
Updates since the start of the last thread:
<br>
<em>The (largely civilian) Palestinian death toll has now passed 24,000.</em>
<br>
<br>
<em>The US House, with Biden's support, approved more than <strong>$14,000,000,000</strong> in military aid to Israel.</em>
<br>
<br>
<em>South Africa filed a case at the International Court of Justice accusing Israel of genocidal acts in Gaza.</em>
<br>
<br>
<em>Houthi rebels in Yemen have attacked cargo ships in the Red Sea in an attempt to disrupt the supply line of Israel's ongoing carpet bombing campaign against Gaza. The Biden admin has responded to the Houthis with a retaliatory bombing campaign.</em>
<br>
<br>
<em>400,000 marched in Washington DC in protest of Biden's support of Israel's genocide.</em>
</div>
</div>

51
html/post.html Normal file
View File

@ -0,0 +1,51 @@
<div class="postcontainer" id="pc477702" data-board="leftypol">
<div class="sidearrows">&gt;&gt;</div>
<div class="post reply" id="reply_477702">
<p class="intro">
<a id="477702" class="post_anchor"></a>
<input type="checkbox" class="delete" name="delete_477702" id="delete_477702">
<a href="#" class="post-btn" title="Post menu"></a>
<label for="delete_477702">
<span class="name">Anonymous</span>
<time datetime="2024-01-19T11:58:26Z" data-local="true" title="17 days ago">2024-01-19 (Fri) 06:58:26</time>
</label>
&nbsp;
<a class="post_no" id="post_no_477702" onclick="highlightReply(477702)" href="/leftypol/res/477700.html#477702">No.</a>
<a class="post_no" onclick="citeReply(477702)" href="/leftypol/res/477700.html#q477702">477702</a>
<span class="mentioned unimportant">
<a class="mentioned-477703" onclick="highlightReply('477703');" href="#477703">&gt;&gt;477703</a>
</span>
</p>
<div class="files">
<div class="file">
<p class="fileinfo">
<span>File <small>(<a class="hide-image-link" href="javascript:void(0)">hide</a>)</small>: </span>
<a href="/leftypol/src/1705665505794.jpeg" target="_blank">1705665505794.jpeg</a>
<span class="details">
( 403.8 KB, 1280x720,
<a download="Aerial-shot-Washington-DC-Palestine.jpeg" href="javascript:void(0)" title="Save as original filename (Aerial-shot-Washington-DC-Palestine.jpeg)">Aerial-shot-Washington-DC….jpeg</a>
)
</span>
</p>
<a href="/leftypol/src/1705665505794.jpeg" target="_blank">
<img class="post-image" loading="lazy" src="/leftypol/thumb/1705665505794.png" style="width:255px;height:143px" alt="">
</a>
</div>
</div>
<div class="body">
<strong>400,000 marched in Washington DC against Bidens complicity in Israels genocide</strong>
<br>
<br>
<em>On January 13, a crowd of 400,000 gathered in Washington, DCs Freedom Plaza to take the Palestine solidarity movement straight to Bidens doorstep. Hundreds of thousands then marched, holding Palestinian, Yemeni, South African, and Puerto Rican flags, through DC and straight to the gates of the White House.</em>
<br>
<br>
<em>The mobilization was organized by the American Muslim Task Force on Palestine, which includes American Muslims for Palestine, Council on American-Islamic Relations, Islamic Circle of North America, Muslim American Society, Muslim Student Association-National, Muslim Legal Fund of America, Muslim Ummah of North America, and Young Muslims, and the ANSWER Coalition.</em>
<br>
<br>
<em>Frustrated with Bidens support and bankrolling of Israels genocide in Gaza, protesters surrounded the Presidents residence and chanted “Hands off Yemen!” and “Yemen, Yemen, make us proud, turn this invasion around!” in reference to the US-UK bombing campaign against Yemen in response to the countrys blockade of Israel-bound ships. Protesters also left bloody baby dolls at the gates of the White House to condemn the genocide in Gaza and the over 10,000 children that have been killed to date. As the crowd demonstrated, several snipers were seen on the roof of the White House.</em>
<br>
<br>
<em>The hundreds of thousands who showed up in DC were joined by millions across the world who participated in a global day of action in solidarity with Palestine to mark nearly 100 days of Israels genocide in Gaza. Rallies, strikes, and mass mobilizations were held in major cities of South Africa, Japan, Turkey, the UK, South Korea, Indonesia, Ireland, New Zealand, Ivory Coast, Sweden, Italy, Germany, Austria, Australia, Finland, as well as throughout the United States. Thousands shut down the Port of Oakland in California at 5 am on Saturday morning.</em>
</div>
</div>
</div>

@ -1 +1 @@
Subproject commit 3f420d3131eb0477b522103a582732a5ba365f19
Subproject commit 53e9a74af4083bf9dd567d94b6ab9a701c5e20ae

View File

@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
module Component.ThreadView
( Model (..)
, initialModel
@ -13,12 +15,39 @@ import Miso
, text
, h1_
, noEff
, href_
, a_
, class_
, id_
, textProp
, title_
, alt_
, src_
, style_
, img_
, span_
, time_
, h2_
, rawHtml
, loading_
, download_
, small_
, p_
, for_
, label_
)
import Data.Maybe (maybeToList)
import qualified Data.Map as Map
import Miso.String (toMisoString)
import GHCJS.DOM.Types (JSString)
import Network.SiteType (Site)
import qualified Network.SiteType as Site
import Network.PostType (Post)
import qualified Network.PostType as Post
import qualified Network.BoardType as Board
import qualified Network.ThreadType as Thread
data Model = Model
{ site :: Site
@ -40,5 +69,175 @@ view :: Model -> View a
view m =
div_
[]
(
[ h1_ [] [ text $ toMisoString $ Site.name $ site m ]
, op_post thread_posts
]
++ map reply (drop 1 thread_posts)
)
where
thread_posts :: [ Post ]
thread_posts =
concatMap (Thread.posts) $
concatMap (Board.threads) $
Site.boards (site m)
op_post :: [ Post ] -> View a
op_post [] = h2_ [] [ "There's nothing here" ]
op_post (x:_) = op x
body :: Post -> [ View a ]
body post = map (rawHtml . toMisoString) $ maybeToList $ Post.body post
op :: Post -> View a
op op_post = div_
[ class_ "post op"
, id_ "op_477700"
]
[ span_
[ class_ "intro" ]
[ span_
[ class_ "subject" ][ "Israel 'at war' as Hamas gunmen launch surprise attack from Gaza Thread Pt. II" ]
, span_
[ class_ "name" ][ "Anonymous" ]
, img_
[ style_ $ Map.fromList
[
( "max-height"
, "16px"
)
,
( "width"
, "auto"
)
]
, class_ "flag"
, src_ "/static/flags/acceleration.png"
, alt_ "Acceleration"
, title_ "Acceleration"
]
, time_
[ textProp "datetime" "2024-01-19T11:53:33Z"
, textProp "data-local" "true"
, title_ "14 days ago"
][ "2024-01-19 (Fri) 06:53:33" ]
]
, " "
, a_
[ class_ "post_no"
, id_ "post_no_477700"
, href_ "/leftypol/res/477700.html#477700"
][ "No." ]
, a_
[ class_ "post_no"
, href_ "/leftypol/res/477700.html#q477700"
][ "477700" ]
, div_
[ class_ "body" ]
(body op_post)
]
reply :: Post -> View a
reply post = div_
[ class_ "postcontainer"
, id_ "pc477702"
, textProp "data-board" "leftypol"
]
[ div_
[ class_ "post reply"
, id_ "reply_477702"
]
[ p_
[ class_ "intro" ]
[ label_
[ for_ "delete_477702" ]
[ span_
[ class_ "name" ][ "Anonymous" ]
, time_
[ textProp "datetime" "2024-01-19T11:58:26Z"
, textProp "data-local" "true"
, title_ "17 days ago"
][ "2024-01-19 (Fri) 06:58:26" ]
]
, "&nbsp;"
, a_
[ class_ "post_no"
, id_ "post_no_477702"
-- , onclick_ "highlightReply(477702)"
, href_ "/leftypol/res/477700.html#477702"
][ "No." ]
, a_
[ class_ "post_no"
-- , onclick_ "citeReply(477702)"
, href_ "/leftypol/res/477700.html#q477702"
][ "477702" ]
, span_
[ class_ "mentioned unimportant" ]
[ a_
[ class_ "mentioned-477703"
-- , onclick_ "highlightReply('477703');"
, href_ "#477703"
][ "&gt;&gt;477703" ]
]
]
, div_
[ class_ "files" ]
[ div_
[ class_ "file" ]
[ p_
[ class_ "fileinfo" ]
[ span_ []
[ "File"
, small_ []
[ "("
, a_
[ class_ "hide-image-link"
, href_ "javascript:void(0)"
][ "hide" ]
, ")"
]
, ":"
]
, a_
[ href_ "/leftypol/src/1705665505794.jpeg"
][ "1705665505794.jpeg" ]
, span_
[ class_ "details" ]
[ "( 403.8 KB, 1280x720,"
, a_
[ download_ "Aerial-shot-Washington-DC-Palestine.jpeg"
, href_ "javascript:void(0)"
, title_ "Save as original filename (Aerial-shot-Washington-DC-Palestine.jpeg)"
][ "Aerial-shot-Washington-DC….jpeg" ]
, ")"
]
]
, a_
[ href_ "/leftypol/src/1705665505794.jpeg"
]
[ img_
[ style_ $ Map.fromList
[
( "height"
, "143px"
)
,
( "width"
, "255px"
)
]
, class_ "post-image"
, loading_ "lazy"
, src_ "/leftypol/thumb/1705665505794.png"
, alt_ ""
]
]
]
]
, div_
[ class_ "body" ]
(body post)
]
]