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

View File

@ -10,6 +10,7 @@ import Data.Aeson (FromJSON, ToJSON)
import Data.Time.Clock (UTCTime) -- Required for timestamp with time zone
import Data.Int (Int64)
import Data.Text (Text)
-- import Common.AttachmentType (Dimension)
data CatalogPost = CatalogPost
{ post_id :: Maybe Int64
@ -26,5 +27,10 @@ data CatalogPost = CatalogPost
, estimated_post_count :: Int
, site_name :: 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)

View File

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

View File

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