summaryrefslogtreecommitdiff
path: root/elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-08-25 09:31:30 +0200
committerYorhel <git@yorhel.nl>2020-08-25 09:33:00 +0200
commitb608999b020fce26fd7dd07078b240d18a312953 (patch)
treef46fd186b2bbfd5dd175ff298cc1819b668855ef /elm
parent00ef4b38f81df579b2eae6fc042ca95c8083d0d5 (diff)
UList.VNPage: Use schema to normalize data + disallow undef schema
Mistyping a namespaced variable results in undef, which was interpreted to mean "don't use a schema", which is rarely what you want. Throwing a hard error makes such typos a lot more visible.
Diffstat (limited to 'elm')
-rw-r--r--elm/UList/VNPage.elm25
1 files changed, 3 insertions, 22 deletions
diff --git a/elm/UList/VNPage.elm b/elm/UList/VNPage.elm
index 64c5f99a..7746e836 100644
--- a/elm/UList/VNPage.elm
+++ b/elm/UList/VNPage.elm
@@ -18,26 +18,7 @@ import Gen.UListDel as GDE
import UList.LabelEdit as LE
import UList.VoteEdit as VE
--- We don't have a Gen.* module for this (yet), so define these manually
-type alias RecvLabels =
- { id : Int
- , label : String
- , private : Bool
- }
-
-type alias Recv =
- { uid : Int
- , vid : Int
- , onlist : Bool
- , canvote : Bool
- , vote : Maybe String
- , labels : List RecvLabels
- , selected : List Int
- , notes : String
- }
-
-
-main : Program Recv Model Msg
+main : Program GVN.VNPage Model Msg
main = Browser.element
{ init = \f -> (init f, Cmd.none)
, subscriptions = \model -> Sub.batch [ Sub.map Labels (DD.sub model.labels.dd), Sub.map Vote (DD.sub model.vote.dd) ]
@@ -46,7 +27,7 @@ main = Browser.element
}
type alias Model =
- { flags : Recv
+ { flags : GVN.VNPage
, onlist : Bool
, del : Bool
, state : Api.State -- For adding/deleting; Vote and label edit widgets have their own state
@@ -58,7 +39,7 @@ type alias Model =
, notesVis : Bool
}
-init : Recv -> Model
+init : GVN.VNPage -> Model
init f =
{ flags = f
, onlist = f.onlist