Skip to content

Commit

Permalink
Remove some code from common package
Browse files Browse the repository at this point in the history
  • Loading branch information
dfordivam committed Feb 8, 2018
1 parent 4fad50b commit 8f729c4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 31 deletions.
20 changes: 0 additions & 20 deletions common/src/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,6 @@ newtype BookId = BookId { unBookId :: Int }
newtype ArticleId = ArticleId { unArticleId :: Int }
deriving (Eq, Ord, Generic, Show, Typeable, ToJSON, FromJSON)

type family ReaderDocument t
type instance ReaderDocument t = ReaderDocumentTree t

data ReaderDocumentTree t = ReaderDocument
{ _readerDocId :: ReaderDocumentId
, _readerDoc :: ReaderDocumentType t
, _readerDocProgress :: (Int, Maybe Int) -- (Para, offset)
}
deriving (Generic, Show, ToJSON, FromJSON)

type family ReaderDocumentType t
type instance ReaderDocumentType t = ReaderDocumentTypeCurrent

data ReaderDocumentTypeCurrent
= MyDocument Text AnnotatedDocument
| Book BookId
| Article ArticleId
deriving (Generic, Show, ToJSON, FromJSON)

type family ReaderSettings t
type instance ReaderSettings t
= ReaderSettingsTree t
Expand Down Expand Up @@ -345,7 +326,6 @@ testMakeFurigana = map (\(a,b) -> makeFurigana (KanjiPhrase a) (ReadingPhrase b)
makeLenses ''SrsReviewStats
makeLenses ''VocabDetails
makeLenses ''KanjiDetails
makeLenses ''ReaderDocumentTree

makePrisms ''SrsEntryState
makeLenses ''SrsEntryStats
Expand Down
5 changes: 0 additions & 5 deletions common/src/Message.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ type AppRequest
:<|> GetReaderSettings
:<|> SaveReaderSettings
:<|> SaveReadingProgress
-- :<|> CreateT ReaderDocument
-- :<|> EditT ReaderDocument
-- :<|> ReadT ReaderDocument
-- :<|> ListT ReaderDocument
-- :<|> DeleteT ReaderDocument

:<|> GetVocabDetails
:<|> GetVocabSentences
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/ReadingPane.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ checkVerticalOverflow (ie,oe) r action = do

readingPane :: AppMonad t m
=> Event t (ReaderDocumentData)
-> AppMonadT t m (Event t (), Event t (ReaderDocument CurrentDb))
-> AppMonadT t m (Event t ())
readingPane docEv = do
ev <- getPostBuild
s <- getWebSocketResponse (GetReaderSettings <$ ev)
v <- widgetHold (readingPaneInt docEv def)
(readingPaneInt docEv <$> s)
return (switchPromptlyDyn (fst <$> v)
, switchPromptlyDyn (snd <$> v))
return (switchPromptlyDyn v)

readerSettingsControls rsDef = divClass "col-sm-12 well-lg form-inline" $ divClass "" $ do
let
Expand Down Expand Up @@ -128,7 +127,7 @@ divWrap rs fullscreenDyn w = do
readingPaneInt :: AppMonad t m
=> Event t (ReaderDocumentData)
-> ReaderSettings CurrentDb
-> AppMonadT t m (Event t (), Event t (ReaderDocument CurrentDb))
-> AppMonadT t m (Event t ())
readingPaneInt docEv rsDef = do
(closeEv,fullScrEv, rsDyn) <- divClass "row" $ do
rsDyn <- divClass "col-sm-9" $ readerSettingsControls rsDef
Expand All @@ -144,7 +143,7 @@ readingPaneInt docEv rsDef = do
-- (readingPaneView <$> docEv)
-- (paginatedReader rsDyn fullScrEv <$> docEv)
(verticalReader rsDyn fullScrEv <$> docEv)
return (closeEv, never)
return (closeEv)

----------------------------------------------------------------------------------
-- Vertical rendering
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/TextReader.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ textReaderTop = do
(viewEv2, cancelEv) <- handleVisibility EditDocumentView vis $
documentEditor editEv

(closeEv, editEv2) <- handleVisibility ReadingView vis $
(closeEv) <- handleVisibility ReadingView vis $
readingPane viewEv
return ()

Expand Down

0 comments on commit 8f729c4

Please sign in to comment.