Skip to content

Commit

Permalink
Fix note id display
Browse files Browse the repository at this point in the history
  • Loading branch information
cblp committed Aug 22, 2018
1 parent 6bf56ae commit 28f01a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ff-core/lib/FF/Storage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class (CvRDT doc, FromJSON doc, ToJSON doc) => Collection doc where
collectionName :: CollectionName

newtype DocId doc = DocId FilePath
deriving (Eq, Ord, ToJSON, ToJSONKey)
deriving (Eq, Ord, Show, ToJSON, ToJSONKey)

instance Collection doc => Show (DocId doc) where
show (DocId path) = collectionName @doc </> path
rawDocId :: DocId doc -> FilePath
rawDocId (DocId name) = name

-- Environment is the dataDir
newtype StorageT clock a = Storage (ReaderT FilePath clock a)
Expand Down
7 changes: 4 additions & 3 deletions ff-core/lib/FF/UI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import Text.PrettyPrint.Mainland (Doc, hang, indent, sep, space,
import qualified Text.PrettyPrint.Mainland as Pretty
import Text.PrettyPrint.Mainland.Class (Pretty, ppr)

import FF.Types (ModeMap, NoteId, NoteView (..), Sample (..),
import FF.Storage (rawDocId)
import FF.Types (ModeMap, NoteView (..), Sample (..),
TaskMode (..), Tracked (..), omitted)

type Template a = a -> String
Expand Down Expand Up @@ -81,7 +82,7 @@ sampleLabel = \case
noteViewBrief :: NoteView -> Doc
noteViewBrief NoteView{..} = title <+/> meta
where
meta = foldMap (\i -> "| id" <+> pshow @NoteId i) nid
meta = foldMap (\i -> "| id" <+> string (rawDocId i)) nid
title
= stack
. map (sep . map strictText . Text.split isSpace)
Expand All @@ -93,7 +94,7 @@ noteViewFull NoteView{..} = sparsedStack [wrapLines text, sep meta]
where
meta
= concat
[ ["| id" <+> pshow @NoteId i | Just i <- [nid]]
[ ["| id" <+> string (rawDocId i) | Just i <- [nid]]
, ["| start" <+> pshow @Day start]
, ["| end" <+> pshow @Day e | Just e <- [end]]
]
Expand Down

0 comments on commit 28f01a6

Please sign in to comment.