Get ready to have file details in CatalogGrid

- update posts type (new fields not yet used)
This commit is contained in:
towards-a-new-leftypol 2024-01-22 15:20:43 -05:00
parent 75024b1fd0
commit 0a75e96f27
5 changed files with 35 additions and 25 deletions

@ -1 +1 @@
Subproject commit a5d90ea96195ed6a5a7e3196d5b0e32b65af5058 Subproject commit 9e9d7babe6352b2fdf19d4ab43a557c71ca2e2ff

View File

@ -13,15 +13,15 @@ import Data.List (intercalate)
import Data.Maybe (maybeToList) import Data.Maybe (maybeToList)
import Data.JSString (append) import Data.JSString (append)
import Miso import Miso
( View , div_ , class_ , img_ , href_ , a_ ( View, div_ , class_ , img_ , href_ , a_
, src_ , alt_ , title_ , strong_ , span_ , src_ , title_ , strong_ , span_
, p_ , br_ , id_ , Effect , noEff , p_ , br_ , id_ , Effect , noEff, width_
, text, rawHtml , height_, text, rawHtml
) )
import Miso.String (toMisoString, MisoString)
import Network.CatalogPostType (CatalogPost) import Network.CatalogPostType (CatalogPost)
import qualified Network.CatalogPostType as CatalogPost import qualified Network.CatalogPostType as CatalogPost
import Miso.String (toMisoString, MisoString)
data Model = Model data Model = Model
{ displayItems :: [ CatalogPost ] { displayItems :: [ CatalogPost ]
@ -43,7 +43,7 @@ update
-> Model -> Model
-> Effect a Model -> Effect a Model
update _ (DisplayItems xs) m = noEff (m { displayItems = xs }) update _ (DisplayItems xs) m = noEff (m { displayItems = xs })
update _ _ m = noEff m -- update _ _ m = noEff m
view :: Interface a -> Model -> View a view :: Interface a -> Model -> View a
view iface model = view iface model =
@ -68,7 +68,6 @@ gridItem post =
[ img_ [ img_
[ class_ "thread-image" [ class_ "thread-image"
, src_ "/a/thumb/1111111111111.png" , src_ "/a/thumb/1111111111111.png"
, alt_ "Opening post image"
, title_ ( toMisoString $ show $ CatalogPost.bump_time post ) , title_ ( toMisoString $ show $ CatalogPost.bump_time post )
] ]
] ]
@ -79,7 +78,8 @@ gridItem post =
, p_ , p_
[ class_ "intro" ] [ class_ "intro" ]
[ span_ [ span_
[ class_ "subject" ]subject [ class_ "subject" ]
subject
] ]
] ++ body ] ++ body
) )

View File

@ -10,21 +10,27 @@ import Data.Aeson (FromJSON, ToJSON)
import Data.Time.Clock (UTCTime) -- Required for timestamp with time zone import Data.Time.Clock (UTCTime) -- Required for timestamp with time zone
import Data.Int (Int64) import Data.Int (Int64)
import Data.Text (Text) import Data.Text (Text)
-- import Common.AttachmentType (Dimension)
data CatalogPost = CatalogPost data CatalogPost = CatalogPost
{ post_id :: Maybe Int64 { post_id :: Maybe Int64
, board_post_id :: Int64 , board_post_id :: Int64
, board_thread_id :: Int64 , board_thread_id :: Int64
, creation_time :: UTCTime , creation_time :: UTCTime
, bump_time :: UTCTime , bump_time :: UTCTime
, body :: Maybe Text , body :: Maybe Text
, name :: Maybe Text , name :: Maybe Text
, subject :: Maybe Text , subject :: Maybe Text
, email :: Maybe Text , email :: Maybe Text
, thread_id :: Int , thread_id :: Int
-- , post_count :: Int -- , post_count :: Int
, estimated_post_count :: Int , estimated_post_count :: Int
, site_name :: String , site_name :: String
, pathpart :: String , pathpart :: String
--, site_id :: Int -- , site_id :: Int
, file_mimetype :: Maybe Text
, file_illegal :: Maybe Bool
-- , file_resolution :: Maybe Dimension
, file_sha256_hash :: Maybe Text
, file_extension :: Maybe Text
} deriving (Show, Generic, FromJSON, ToJSON, Eq) } deriving (Show, Generic, FromJSON, ToJSON, Eq)

View File

@ -30,6 +30,8 @@ import GHCJS.DOM.Types (XMLHttpRequest, JSString)
import Data.JSString.Text (textToJSString) import Data.JSString.Text (textToJSString)
import GHCJS.DOM.EventM (onAsync) import GHCJS.DOM.EventM (onAsync)
import GHCJS.DOM.XMLHttpRequestEventTarget (load, abortEvent, error) import GHCJS.DOM.XMLHttpRequestEventTarget (load, abortEvent, error)
import GHCJS.DOM.Types (toJSString)
import Miso (consoleLog)
data HttpMethod = GET | PUT | POST | DELETE | PATCH data HttpMethod = GET | PUT | POST | DELETE | PATCH
deriving Show deriving Show
@ -68,7 +70,9 @@ mkResult xhr = do
Just bs -> do Just bs -> do
let parse_result = eitherDecodeStrict bs let parse_result = eitherDecodeStrict bs
case parse_result of case parse_result of
Left _ -> return Error Left err -> do
consoleLog $ toJSString $ show err
return Error
Right x -> return HttpResponse Right x -> return HttpResponse
{ status_code = status_code_int { status_code = status_code_int
, status_text = st , status_text = st

View File

@ -30,6 +30,7 @@ html, body {
.post-image{ .post-image{
max-width: 94%!important; max-width: 94%!important;
} }
select{ select{
float:right; float:right;
} }
@ -47,7 +48,6 @@ div.boardlist.bottom {
} }
img.banner, img.board_image { img.banner, img.board_image {
max-width: 100vw; max-width: 100vw;
} }