add new collection page

This commit is contained in:
Alexander Foremny
2024-06-06 23:05:41 +02:00
parent 3add980b73
commit 378e007141
5 changed files with 64 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ data Route
= Home
| ListCollection String
| EditValue String String
| NewCollection
deriving (Show, Eq)
instance Default Route where
@@ -27,6 +28,7 @@ parseURI uri =
[ EditValue
<$> (P.string "#collection/" *> P.manyTill P.anyChar (P.string "/"))
<*> (P.many1 P.anyChar),
pure NewCollection <* (P.string "#collection/new"),
ListCollection <$> (P.string "#collection/" *> P.many1 P.anyChar),
pure Home
]
@@ -38,3 +40,4 @@ routeToString :: Route -> String
routeToString Home = "#"
routeToString (ListCollection collection) = "#collection/" <> collection
routeToString (EditValue collection fileName) = "#collection/" <> collection <> "/" <> fileName
routeToString NewCollection = "#collection/new"