From 831c0ba096f348288d83efdb61693b6b6732545b Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Mon, 5 Feb 2024 05:22:12 -0500 Subject: [PATCH] WIP: render thread - get thread bodies working --- chandlr.cabal | 3 +- html/files.html | 1 + html/op.html | 34 ++++++ html/post.html | 51 +++++++++ src/Common | 2 +- src/Component/ThreadView.hs | 201 +++++++++++++++++++++++++++++++++++- 6 files changed, 289 insertions(+), 3 deletions(-) create mode 100644 html/files.html create mode 100644 html/op.html create mode 100644 html/post.html diff --git a/chandlr.cabal b/chandlr.cabal index 9661a8a..b6427f1 100644 --- a/chandlr.cabal +++ b/chandlr.cabal @@ -91,7 +91,8 @@ executable chandlr time, bytestring, filepath, - network-uri + network-uri, + containers -- Directories containing source files. hs-source-dirs: src diff --git a/html/files.html b/html/files.html new file mode 100644 index 0000000..5fb7023 --- /dev/null +++ b/html/files.html @@ -0,0 +1 @@ +

File (hide): 1705665213107.png ( 1.88 MB , 1200x800 , south-african-representati….png )

diff --git a/html/op.html b/html/op.html new file mode 100644 index 0000000..20a33d2 --- /dev/null +++ b/html/op.html @@ -0,0 +1,34 @@ +
+ [–] +

+ + + +   + No. + 477700 + [Watch Thread] +

+
+ Continued from >>475181 +
+
+ Updates since the start of the last thread: +
+ The (largely civilian) Palestinian death toll has now passed 24,000. +
+
+ The US House, with Biden's support, approved more than $14,000,000,000 in military aid to Israel. +
+
+ South Africa filed a case at the International Court of Justice accusing Israel of genocidal acts in Gaza. +
+
+ 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. +
+
+ 400,000 marched in Washington DC in protest of Biden's support of Israel's genocide. +
+
diff --git a/html/post.html b/html/post.html new file mode 100644 index 0000000..bdf30e8 --- /dev/null +++ b/html/post.html @@ -0,0 +1,51 @@ +
+
>>
+
+

+ + + + +   + No. + 477702 + + >>477703 + +

+
+
+

+ File (hide): + 1705665505794.jpeg + + ( 403.8 KB, 1280x720, + Aerial-shot-Washington-DC….jpeg + ) + +

+ + + +
+
+
+ 400,000 marched in Washington DC against Biden’s complicity in Israel’s genocide +
+
+ On January 13, a crowd of 400,000 gathered in Washington, DC’s Freedom Plaza to take the Palestine solidarity movement straight to Biden’s 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. +
+
+ 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. +
+
+ Frustrated with Biden’s support and bankrolling of Israel’s genocide in Gaza, protesters surrounded the President’s 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 country’s 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. +
+
+ 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 Israel’s 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. +
+
+
diff --git a/src/Common b/src/Common index 3f420d3..53e9a74 160000 --- a/src/Common +++ b/src/Common @@ -1 +1 @@ -Subproject commit 3f420d3131eb0477b522103a582732a5ba365f19 +Subproject commit 53e9a74af4083bf9dd567d94b6ab9a701c5e20ae diff --git a/src/Component/ThreadView.hs b/src/Component/ThreadView.hs index bbe5e31..4c9481d 100644 --- a/src/Component/ThreadView.hs +++ b/src/Component/ThreadView.hs @@ -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 ] + ( + [ 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" ] + ] + , " " + , 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" + ][ ">>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) + ] ]