diff --git a/chandlr.cabal b/chandlr.cabal index abb3594..6215824 100644 --- a/chandlr.cabal +++ b/chandlr.cabal @@ -67,7 +67,7 @@ executable chandlr Network.Http Network.Client Network.ClientTypes - Network.CatalogPostType + Common.Network.CatalogPostType Network.BoardType Network.SiteType Network.PostType @@ -86,7 +86,7 @@ executable chandlr Parsing.PostPartType Component.TimeControl Component.Search - Component.Search.SearchTypes + Common.Component.Search.SearchTypes -- LANGUAGE extensions used by modules in this package. diff --git a/src/Common b/src/Common index a77cfdd..443f2e3 160000 --- a/src/Common +++ b/src/Common @@ -1 +1 @@ -Subproject commit a77cfddc7a757bef9c1ef578c3a5eab54795cb37 +Subproject commit 443f2e37adcef18a78c9c454594132c05495026d diff --git a/src/Component/CatalogGrid.hs b/src/Component/CatalogGrid.hs index d100177..72890fd 100644 --- a/src/Component/CatalogGrid.hs +++ b/src/Component/CatalogGrid.hs @@ -23,8 +23,8 @@ import Miso ) import Miso.String (toMisoString, MisoString) -import Network.CatalogPostType (CatalogPost) -import qualified Network.CatalogPostType as CatalogPost +import Common.Network.CatalogPostType (CatalogPost) +import qualified Common.Network.CatalogPostType as CatalogPost import Parsing.EmbedParser (extractVideoId) data Model = Model diff --git a/src/Component/Search.hs b/src/Component/Search.hs index 1c0a270..3b5818a 100644 --- a/src/Component/Search.hs +++ b/src/Component/Search.hs @@ -31,7 +31,7 @@ import qualified Network.Client as Client import Network.Http (HttpResult (..)) import Control.Concurrent.MVar (tryTakeMVar, takeMVar, putMVar, swapMVar) -import Component.Search.SearchTypes +import Common.Component.Search.SearchTypes update :: Interface a -> Action -> Model -> Effect a Model update iface (SearchChange q) model = model { searchTerm = q } <# do diff --git a/src/Component/Search/SearchTypes.hs b/src/Component/Search/SearchTypes.hs deleted file mode 100644 index dea680d..0000000 --- a/src/Component/Search/SearchTypes.hs +++ /dev/null @@ -1,29 +0,0 @@ -module Component.Search.SearchTypes where - -import Data.JSString (JSString) -import Network.Http (HttpResult (..)) -import Control.Concurrent.MVar (MVar) - -import qualified Network.ClientTypes as Client -import Network.CatalogPostType (CatalogPost) - -data Action - = SearchChange JSString - | OnSubmit - | ChangeAndSubmit JSString - | SearchResult (HttpResult [ CatalogPost ]) - | PassPostsToSelf [ CatalogPost ] -- I think I don't understand something about the update type but I had to add this... - | NoAction - -data Model = Model - { searchTerm :: JSString - , searchVar :: MVar JSString - , clientModel :: Client.Model - , displayResults :: [ CatalogPost ] - } deriving Eq - -data Interface a = Interface - { passAction :: Action -> a - , clientIface :: Client.Interface a [ CatalogPost ] - , searchResults :: JSString -> a - } diff --git a/src/Main.hs b/src/Main.hs index 4b66c90..ddcf505 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -46,13 +46,13 @@ import Servant.API import Common.FrontEnd.Action import Common.FrontEnd.Routes import qualified Network.Client as Client -import Network.CatalogPostType (CatalogPost) -import qualified Network.CatalogPostType as CatalogPost +import Common.Network.CatalogPostType (CatalogPost) +import qualified Common.Network.CatalogPostType as CatalogPost import qualified Component.CatalogGrid as Grid import qualified Component.ThreadView as Thread import qualified Component.TimeControl as TC import qualified Component.Search as Search -import qualified Component.Search.SearchTypes as Search +import qualified Common.Component.Search.SearchTypes as Search data Model = Model diff --git a/src/Network/CatalogPostType.hs b/src/Network/CatalogPostType.hs deleted file mode 100644 index 8a1742e..0000000 --- a/src/Network/CatalogPostType.hs +++ /dev/null @@ -1,38 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveAnyClass #-} - -module Network.CatalogPostType - ( CatalogPost (..) ) - where - -import GHC.Generics -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 - , board_post_id :: Int64 - , board_thread_id :: Int64 - , creation_time :: UTCTime - , bump_time :: UTCTime - , body :: Maybe Text - , name :: Maybe Text - , subject :: Maybe Text - , email :: Maybe Text - , thread_id :: Int - -- , post_count :: Int - , embed :: Maybe Text - , estimated_post_count :: Int - , site_name :: Text - , pathpart :: Text - -- , site_id :: Int - , file_mimetype :: Maybe Text - , file_illegal :: Maybe Bool - -- , file_resolution :: Maybe Dimension - , file_name :: Maybe Text - , file_extension :: Maybe Text - , file_thumb_extension :: Maybe Text - } deriving (Show, Generic, FromJSON, ToJSON, Eq) diff --git a/src/Network/Client.hs b/src/Network/Client.hs index 097d543..374069f 100644 --- a/src/Network/Client.hs +++ b/src/Network/Client.hs @@ -29,7 +29,7 @@ import Miso (effectSub, Effect) import Miso.String (toMisoString) import qualified Network.Http as Http -import Network.CatalogPostType (CatalogPost) +import Common.Network.CatalogPostType (CatalogPost) import Network.SiteType (Site) import qualified Common.FrontEnd.Action as A import Network.ClientTypes