Move Action and Routes into the Common git submodule
- also fixes to display fewer things because everything is unbearably slow on mobile even on a lan, I hope that this is something that can be profiled and optimized out since rendering with very few posts is reasonably quick. - things to check: String conversions
This commit is contained in:
parent
c8f720f05b
commit
1874f3a043
8
TODO.txt
8
TODO.txt
|
@ -1,8 +1,13 @@
|
||||||
- get embeds working ✓
|
- get embeds working ✓
|
||||||
- need to implement search
|
- need to implement search ✓
|
||||||
- change urls / history when time-travelling
|
- change urls / history when time-travelling
|
||||||
- remove duplicate threads from view (duplicate because the OP has multiple pictures) ✓
|
- remove duplicate threads from view (duplicate because the OP has multiple pictures) ✓
|
||||||
|
- optimize rendering (especially for mobile)
|
||||||
|
- need to profile the code, perhaps profiling the views by removing certain elements (like the body of a post)
|
||||||
|
and measuring the rendering speed
|
||||||
- server-side rendering
|
- server-side rendering
|
||||||
|
- make new servant project
|
||||||
|
- copy isomorphic example
|
||||||
- control to manually put in the datetime instead of using the slider
|
- control to manually put in the datetime instead of using the slider
|
||||||
for fine-grained control
|
for fine-grained control
|
||||||
- have some process respond to http calls from the board to inform the db of new posts
|
- have some process respond to http calls from the board to inform the db of new posts
|
||||||
|
@ -15,7 +20,6 @@
|
||||||
just there to preserve links. the time travel thing is a bit of a gimmick
|
just there to preserve links. the time travel thing is a bit of a gimmick
|
||||||
- "infinite" scrolling
|
- "infinite" scrolling
|
||||||
- just load more!
|
- just load more!
|
||||||
- more granular actions to display what is causing slowdowns (esp on mobile)
|
|
||||||
- fix thumbnails for older posts ✓
|
- fix thumbnails for older posts ✓
|
||||||
- need to support flags
|
- need to support flags
|
||||||
- need to support mod actions like saging a thread or deleting a post
|
- need to support mod actions like saging a thread or deleting a post
|
||||||
|
|
|
@ -63,7 +63,7 @@ executable chandlr
|
||||||
|
|
||||||
-- Modules included in this executable, other than Main.
|
-- Modules included in this executable, other than Main.
|
||||||
other-modules: Component.CatalogGrid
|
other-modules: Component.CatalogGrid
|
||||||
Action
|
Common.FrontEnd.Action
|
||||||
Network.Http
|
Network.Http
|
||||||
Network.Client
|
Network.Client
|
||||||
Network.ClientTypes
|
Network.ClientTypes
|
||||||
|
@ -78,7 +78,7 @@ executable chandlr
|
||||||
Component.Thread.Model
|
Component.Thread.Model
|
||||||
Component.Thread.Embed
|
Component.Thread.Embed
|
||||||
Component.BodyRender
|
Component.BodyRender
|
||||||
Routes
|
Common.FrontEnd.Routes
|
||||||
Common.AttachmentType
|
Common.AttachmentType
|
||||||
Parsing.BodyParser
|
Parsing.BodyParser
|
||||||
Parsing.QuoteLinkParser
|
Parsing.QuoteLinkParser
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="postgrest-root" content="http://10.4.0.96:3000">
|
<meta name="postgrest-root" content="http://10.4.0.96:3000">
|
||||||
<meta name="postgrest-fetch-count" content="500">
|
<meta name="postgrest-fetch-count" content="50">
|
||||||
<meta name="media-root" content="http://10.4.0.1:8888">
|
<meta name="media-root" content="http://10.4.0.1:8888">
|
||||||
<title>Chandlr</title>
|
<title>Chandlr</title>
|
||||||
<link href="static/style.css" rel="stylesheet" />
|
<link href="static/style.css" rel="stylesheet" />
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
{-# LANGUAGE ExistentialQuantification #-}
|
|
||||||
|
|
||||||
module Action where
|
|
||||||
|
|
||||||
import Data.Text (Text)
|
|
||||||
import Data.Aeson (FromJSON)
|
|
||||||
import Data.Int (Int64)
|
|
||||||
import Data.Time.Clock (UTCTime)
|
|
||||||
import Data.JSString (JSString)
|
|
||||||
import Miso (URI)
|
|
||||||
|
|
||||||
import qualified Component.CatalogGrid as Grid
|
|
||||||
import qualified Network.ClientTypes as C
|
|
||||||
import Network.CatalogPostType (CatalogPost)
|
|
||||||
import Network.Http (HttpResult)
|
|
||||||
import Network.SiteType (Site)
|
|
||||||
import qualified Component.ThreadView as Thread
|
|
||||||
import qualified Component.TimeControl as TC
|
|
||||||
import qualified Component.Search.SearchTypes as Search
|
|
||||||
|
|
||||||
data GetThreadArgs = GetThreadArgs
|
|
||||||
{ website :: Text
|
|
||||||
, board_pathpart :: Text
|
|
||||||
, board_thread_id :: Int64
|
|
||||||
}
|
|
||||||
|
|
||||||
data Action
|
|
||||||
= GridAction Grid.Action
|
|
||||||
| GetThread GetThreadArgs
|
|
||||||
| HaveLatest (HttpResult [ CatalogPost ])
|
|
||||||
| HaveThread (HttpResult [ Site ])
|
|
||||||
| forall a. (FromJSON a) => ClientAction (HttpResult a -> Action) (C.Action a)
|
|
||||||
| ThreadAction Thread.Action
|
|
||||||
| TimeAction TC.Time
|
|
||||||
| SearchAction Search.Action
|
|
||||||
| GoToTime UTCTime
|
|
||||||
| ChangeURI URI
|
|
||||||
| SearchResults JSString
|
|
||||||
| NoAction
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 53e9a74af4083bf9dd567d94b6ab9a701c5e20ae
|
Subproject commit a77cfddc7a757bef9c1ef578c3a5eab54795cb37
|
|
@ -59,7 +59,7 @@ update iface (SearchResult result) model = model <# do
|
||||||
case result of
|
case result of
|
||||||
Error -> do
|
Error -> do
|
||||||
consoleLog $ "Error!"
|
consoleLog $ "Error!"
|
||||||
return $ (passAction iface) NoAction
|
return $ passAction iface $ PassPostsToSelf []
|
||||||
|
|
||||||
HttpResponse {..} -> do
|
HttpResponse {..} -> do
|
||||||
consoleLog $ (pack $ show $ status_code) <> " " <> (pack $ status_text)
|
consoleLog $ (pack $ show $ status_code) <> " " <> (pack $ status_text)
|
||||||
|
|
|
@ -20,6 +20,7 @@ import Miso
|
||||||
, p_
|
, p_
|
||||||
, Attribute
|
, Attribute
|
||||||
, text
|
, text
|
||||||
|
, target_
|
||||||
)
|
)
|
||||||
|
|
||||||
import Data.Foldable (toList)
|
import Data.Foldable (toList)
|
||||||
|
@ -83,6 +84,7 @@ file media_root site multifile a = div_
|
||||||
]
|
]
|
||||||
, a_
|
, a_
|
||||||
[ href_ file_url
|
[ href_ file_url
|
||||||
|
, target_ "blank_"
|
||||||
]
|
]
|
||||||
[ img_
|
[ img_
|
||||||
(
|
(
|
||||||
|
|
|
@ -43,8 +43,8 @@ import GHCJS.DOM.ParentNode (querySelector)
|
||||||
import GHCJS.DOM.Element (getAttribute)
|
import GHCJS.DOM.Element (getAttribute)
|
||||||
import Servant.API
|
import Servant.API
|
||||||
|
|
||||||
import Action
|
import Common.FrontEnd.Action
|
||||||
import Routes
|
import Common.FrontEnd.Routes
|
||||||
import qualified Network.Client as Client
|
import qualified Network.Client as Client
|
||||||
import Network.CatalogPostType (CatalogPost)
|
import Network.CatalogPostType (CatalogPost)
|
||||||
import qualified Network.CatalogPostType as CatalogPost
|
import qualified Network.CatalogPostType as CatalogPost
|
||||||
|
@ -267,10 +267,11 @@ mainUpdate (GetThread GetThreadArgs {..}) m = m <# do
|
||||||
|
|
||||||
where
|
where
|
||||||
new_current_uri :: URI
|
new_current_uri :: URI
|
||||||
new_current_uri = (current_uri m) {
|
new_current_uri = (current_uri m)
|
||||||
uriPath = T.unpack website
|
{ uriPath = T.unpack website
|
||||||
</> T.unpack board_pathpart
|
</> T.unpack board_pathpart
|
||||||
</> show board_thread_id
|
</> show board_thread_id
|
||||||
|
, uriQuery = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
mainUpdate (ChangeURI uri) m = m { current_uri = uri } <# do
|
mainUpdate (ChangeURI uri) m = m { current_uri = uri } <# do
|
||||||
|
|
|
@ -31,7 +31,7 @@ import Miso.String (toMisoString)
|
||||||
import qualified Network.Http as Http
|
import qualified Network.Http as Http
|
||||||
import Network.CatalogPostType (CatalogPost)
|
import Network.CatalogPostType (CatalogPost)
|
||||||
import Network.SiteType (Site)
|
import Network.SiteType (Site)
|
||||||
import qualified Action as A
|
import qualified Common.FrontEnd.Action as A
|
||||||
import Network.ClientTypes
|
import Network.ClientTypes
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,10 @@ data FetchCatalogArgs = FetchCatalogArgs
|
||||||
} deriving (Generic, ToJSON)
|
} deriving (Generic, ToJSON)
|
||||||
|
|
||||||
|
|
||||||
data SearchPostsArgs = SearchPostsArgs { search_text :: JSString }
|
data SearchPostsArgs = SearchPostsArgs
|
||||||
|
{ search_text :: JSString
|
||||||
|
, max_rows :: Int
|
||||||
|
}
|
||||||
deriving (Generic, ToJSON)
|
deriving (Generic, ToJSON)
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,5 +105,6 @@ search m query iface =
|
||||||
where
|
where
|
||||||
payload = Just $ SearchPostsArgs
|
payload = Just $ SearchPostsArgs
|
||||||
{ search_text = query
|
{ search_text = query
|
||||||
|
, max_rows = 100
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
{-# LANGUAGE DataKinds #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
|
|
||||||
module Routes where
|
|
||||||
|
|
||||||
import Data.Text (Text)
|
|
||||||
import Data.Int (Int64)
|
|
||||||
|
|
||||||
import Miso (View)
|
|
||||||
|
|
||||||
import Servant.API
|
|
||||||
|
|
||||||
import Action
|
|
||||||
|
|
||||||
type Route
|
|
||||||
= R_Latest
|
|
||||||
:<|> R_Thread
|
|
||||||
:<|> R_SearchResults
|
|
||||||
|
|
||||||
type R_Latest = View Action
|
|
||||||
|
|
||||||
-- Show selected thread
|
|
||||||
-- - <website>/<board>/res/<thread_id>
|
|
||||||
type R_Thread
|
|
||||||
= Capture "website" Text
|
|
||||||
:> Capture "board" Text
|
|
||||||
:> Capture "board_thread_id" BoardThreadId
|
|
||||||
:> View Action
|
|
||||||
|
|
||||||
type R_SearchResults
|
|
||||||
= "search"
|
|
||||||
:> QueryParam "search" Text
|
|
||||||
:> View Action
|
|
||||||
|
|
||||||
type BoardThreadId = Int64
|
|
Loading…
Reference in New Issue