diff --git a/TODO.txt b/TODO.txt
index 4b7d278..5a868b3 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,8 +1,13 @@
- get embeds working ✓
-- need to implement search
+- need to implement search ✓
- change urls / history when time-travelling
- 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
+ - make new servant project
+ - copy isomorphic example
- control to manually put in the datetime instead of using the slider
for fine-grained control
- 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
- "infinite" scrolling
- just load more!
-- more granular actions to display what is causing slowdowns (esp on mobile)
- fix thumbnails for older posts ✓
- need to support flags
- need to support mod actions like saging a thread or deleting a post
diff --git a/chandlr.cabal b/chandlr.cabal
index 6ba0acb..abb3594 100644
--- a/chandlr.cabal
+++ b/chandlr.cabal
@@ -63,7 +63,7 @@ executable chandlr
-- Modules included in this executable, other than Main.
other-modules: Component.CatalogGrid
- Action
+ Common.FrontEnd.Action
Network.Http
Network.Client
Network.ClientTypes
@@ -78,7 +78,7 @@ executable chandlr
Component.Thread.Model
Component.Thread.Embed
Component.BodyRender
- Routes
+ Common.FrontEnd.Routes
Common.AttachmentType
Parsing.BodyParser
Parsing.QuoteLinkParser
diff --git a/index.html b/index.html
index 1ef4bec..fc0c737 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,7 @@
-
+
Chandlr
diff --git a/src/Action.hs b/src/Action.hs
deleted file mode 100644
index ea59cc4..0000000
--- a/src/Action.hs
+++ /dev/null
@@ -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
diff --git a/src/Common b/src/Common
index 53e9a74..a77cfdd 160000
--- a/src/Common
+++ b/src/Common
@@ -1 +1 @@
-Subproject commit 53e9a74af4083bf9dd567d94b6ab9a701c5e20ae
+Subproject commit a77cfddc7a757bef9c1ef578c3a5eab54795cb37
diff --git a/src/Component/Search.hs b/src/Component/Search.hs
index ab9219f..1c0a270 100644
--- a/src/Component/Search.hs
+++ b/src/Component/Search.hs
@@ -59,7 +59,7 @@ update iface (SearchResult result) model = model <# do
case result of
Error -> do
consoleLog $ "Error!"
- return $ (passAction iface) NoAction
+ return $ passAction iface $ PassPostsToSelf []
HttpResponse {..} -> do
consoleLog $ (pack $ show $ status_code) <> " " <> (pack $ status_text)
diff --git a/src/Component/Thread/Files.hs b/src/Component/Thread/Files.hs
index f01021b..327b451 100644
--- a/src/Component/Thread/Files.hs
+++ b/src/Component/Thread/Files.hs
@@ -20,6 +20,7 @@ import Miso
, p_
, Attribute
, text
+ , target_
)
import Data.Foldable (toList)
@@ -83,6 +84,7 @@ file media_root site multifile a = div_
]
, a_
[ href_ file_url
+ , target_ "blank_"
]
[ img_
(
diff --git a/src/Main.hs b/src/Main.hs
index 05b9207..4b66c90 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -43,8 +43,8 @@ import GHCJS.DOM.ParentNode (querySelector)
import GHCJS.DOM.Element (getAttribute)
import Servant.API
-import Action
-import Routes
+import Common.FrontEnd.Action
+import Common.FrontEnd.Routes
import qualified Network.Client as Client
import Network.CatalogPostType (CatalogPost)
import qualified Network.CatalogPostType as CatalogPost
@@ -267,11 +267,12 @@ mainUpdate (GetThread GetThreadArgs {..}) m = m <# do
where
new_current_uri :: URI
- new_current_uri = (current_uri m) {
- uriPath = T.unpack website
- > T.unpack board_pathpart
- > show board_thread_id
- }
+ new_current_uri = (current_uri m)
+ { uriPath = T.unpack website
+ > T.unpack board_pathpart
+ > show board_thread_id
+ , uriQuery = ""
+ }
mainUpdate (ChangeURI uri) m = m { current_uri = uri } <# do
consoleLog $ "ChangeURI! " `append` (pack $ show $ uri)
diff --git a/src/Network/Client.hs b/src/Network/Client.hs
index c659873..097d543 100644
--- a/src/Network/Client.hs
+++ b/src/Network/Client.hs
@@ -31,7 +31,7 @@ import Miso.String (toMisoString)
import qualified Network.Http as Http
import Network.CatalogPostType (CatalogPost)
import Network.SiteType (Site)
-import qualified Action as A
+import qualified Common.FrontEnd.Action as A
import Network.ClientTypes
@@ -51,7 +51,10 @@ data FetchCatalogArgs = FetchCatalogArgs
} deriving (Generic, ToJSON)
-data SearchPostsArgs = SearchPostsArgs { search_text :: JSString }
+data SearchPostsArgs = SearchPostsArgs
+ { search_text :: JSString
+ , max_rows :: Int
+ }
deriving (Generic, ToJSON)
@@ -102,5 +105,6 @@ search m query iface =
where
payload = Just $ SearchPostsArgs
{ search_text = query
+ , max_rows = 100
}
diff --git a/src/Routes.hs b/src/Routes.hs
deleted file mode 100644
index 996cdda..0000000
--- a/src/Routes.hs
+++ /dev/null
@@ -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
--- - //res/
-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