@@ -29,7 +29,6 @@ update ∷ Update ExperimentsModel ExperimentsMessage
2929update model =
3030 case _ of
3131 ToggleVisibility modal → model { visible = modal == ShowExperiments } /\ []
32- ToggleSection section → F .noMessages model { section = section }
3332 RedirectKarma → model /\
3433 [ do
3534 liftEffect <<< FS .send imAppId <<< SIT.SpecialRequest <<< ToggleModal $ Screen ShowKarmaPrivileges
@@ -41,6 +40,7 @@ update model =
4140 DisplayQuestions questions → displayQuestions questions model
4241 SelectChoice question choice → selectChoice question choice model
4342 AnswerQuestion → answerQuestion model
43+ ToggleDoppelgangerSection section → F .noMessages model { doppelganger = model.doppelganger { section = section } }
4444 AfterAnswerQuestion → afterAnswerQuestion model
4545 FetchMatches → fetchMatches model
4646 DisplayMatches matches → displayMatches matches model
@@ -50,6 +50,21 @@ update model =
5050 ThrowPlane → throwPlane model
5151 AfterThrowPlane id → afterThrowPlane id model
5252 ResizeMessageInput event → SIR .resizeInputFrom event model
53+ TogglePaperPlaneSection section → togglePaperPlaneSection section model
54+ DisplayFlyingPaperPlanes planes -> displayFlyingPaperPlanes planes model
55+
56+ displayFlyingPaperPlanes ∷ Array PaperPlane → ExperimentsModel → ExperimentsModel /\ (Array (Aff (Maybe ExperimentsMessage )))
57+ displayFlyingPaperPlanes planes model = model { paperPlane = model.paperPlane { flyingBy = planes } } /\ []
58+
59+ togglePaperPlaneSection ∷ PaperPlaneSection → ExperimentsModel → ExperimentsModel /\ (Array (Aff (Maybe ExperimentsMessage )))
60+ togglePaperPlaneSection section model = model { paperPlane = model.paperPlane { section = section } } /\ effects
61+ where
62+ fetch = do
63+ r ← CCN .silentResponse $ request.experiments.flying { }
64+ pure <<< Just $ DisplayFlyingPaperPlanes r
65+ effects
66+ | model.paperPlane.section /= section && section == ShowFlyingBy && DA .null model.paperPlane.flyingBy = [fetch]
67+ | otherwise = []
5368
5469setPlaneMessage ∷ String → ExperimentsModel → ExperimentsModel /\ (Array (Aff (Maybe ExperimentsMessage )))
5570setPlaneMessage message model = model { paperPlane = model.paperPlane { message = if DS .null message then Nothing else Just message } } /\ []
@@ -79,7 +94,7 @@ resumeQuestions model = model /\ [ resume ]
7994 pure <<< Just $ DisplayQuestions questions
8095
8196displayQuestions ∷ Array Question → ExperimentsModel → ExperimentsModel /\ (Array (Aff (Maybe ExperimentsMessage )))
82- displayQuestions questions model = model { section = ShowingDoppelganger ShowNextQuestion , doppelganger { questions = questions } } /\ []
97+ displayQuestions questions model = model { doppelganger { section = ShowNextQuestion , questions = questions } } /\ []
8398
8499selectChoice ∷ Int → Int → ExperimentsModel → ExperimentsModel /\ (Array (Aff (Maybe ExperimentsMessage )))
85100selectChoice question choice model = model { doppelganger = model.doppelganger { selectedChoice = Just { question, choice } } } /\ []
@@ -124,7 +139,7 @@ fetchMatches model = model /\ [ fetch ]
124139 pure <<< Just $ DisplayMatches response
125140
126141displayMatches ∷ Array Match → ExperimentsModel → ExperimentsModel /\ (Array (Aff (Maybe ExperimentsMessage )))
127- displayMatches matches model = model { section = ShowingDoppelganger ShowMatches , doppelganger = model.doppelganger { matches = matches } } /\ []
142+ displayMatches matches model = model { doppelganger = model.doppelganger { section = ShowMatches , matches = matches } } /\ []
128143
129144messageDoppelganger ∷ Int → ExperimentsModel → ExperimentsModel /\ (Array (Aff (Maybe ExperimentsMessage )))
130145messageDoppelganger userId model = model /\ [ send ]
0 commit comments