@@ -40,6 +40,7 @@ import UnisonShare.AppDocument as AppDocument
40
40
import UnisonShare.AppError as AppError exposing (AppError )
41
41
import UnisonShare.AppHeader as AppHeader
42
42
import UnisonShare.Link as Link
43
+ import UnisonShare.NewOrgModal as NewOrgModal
43
44
import UnisonShare.Page.AcceptTermsPage as AcceptTermsPage
44
45
import UnisonShare.Page.AccountPage as AccountPage
45
46
import UnisonShare.Page.AppErrorPage as AppErrorPage
@@ -86,6 +87,7 @@ type Page
86
87
type AppModal
87
88
= NoModal
88
89
| KeyboardShortcuts
90
+ | NewOrg NewOrgModal . Model
89
91
90
92
91
93
type alias Model =
@@ -213,6 +215,7 @@ type Msg
213
215
| ToggleAccountMenu
214
216
| ToggleCreateAccountMenu
215
217
| ShowKeyboardShortcuts
218
+ | ShowNewOrgModal
216
219
| CloseModal
217
220
| WhatsNewFetchFinished ( HttpResult WhatsNew . LoadedWhatsNew )
218
221
| WhatsNewMarkAllAsRead
@@ -224,6 +227,7 @@ type Msg
224
227
| ProjectPageMsg ProjectPage . Msg
225
228
| AccountPageMsg AccountPage . Msg
226
229
| AcceptTermsPageMsg AcceptTermsPage . Msg
230
+ | NewOrgModalMsg NewOrgModal . Msg
227
231
228
232
229
233
update : Msg -> Model -> ( Model , Cmd Msg )
@@ -465,6 +469,9 @@ update msg ({ appContext } as model) =
465
469
( _, ShowKeyboardShortcuts ) ->
466
470
( { model | openedAppHeaderMenu = AppHeader . NoneOpened , appModal = KeyboardShortcuts }, Cmd . none )
467
471
472
+ ( _, ShowNewOrgModal ) ->
473
+ ( { model | openedAppHeaderMenu = AppHeader . NoneOpened , appModal = NewOrg NewOrgModal . init }, Cmd . none )
474
+
468
475
( _, CloseModal ) ->
469
476
( { model | appModal = NoModal }, Cmd . none )
470
477
@@ -523,6 +530,29 @@ update msg ({ appContext } as model) =
523
530
in
524
531
( { model | page = AcceptTerms continueUrl acceptTerms_ }, Cmd . map AcceptTermsPageMsg acceptTermsCmd )
525
532
533
+ ( _, NewOrgModalMsg newOrgMsg ) ->
534
+ case ( model. appModal, appContext. session ) of
535
+ ( NewOrg newOrg, Session . SignedIn account ) ->
536
+ let
537
+ ( newOrg_, cmd, out ) =
538
+ NewOrgModal . update appContext account newOrgMsg newOrg
539
+
540
+ appModal =
541
+ case out of
542
+ NewOrgModal . NoOutMsg ->
543
+ NewOrg newOrg_
544
+
545
+ NewOrgModal . RequestCloseModal ->
546
+ NoModal
547
+
548
+ NewOrgModal . AddedOrg _ ->
549
+ NoModal
550
+ in
551
+ ( { model | appModal = appModal }, Cmd . map NewOrgModalMsg cmd )
552
+
553
+ _ ->
554
+ ( model, Cmd . none )
555
+
526
556
_ ->
527
557
( model, Cmd . none )
528
558
@@ -720,6 +750,7 @@ view model =
720
750
, toggleAccountMenuMsg = ToggleAccountMenu
721
751
, toggleCreateAccountMenuMsg = ToggleCreateAccountMenu
722
752
, showKeyboardShortcutsModalMsg = ShowKeyboardShortcuts
753
+ , showNewOrgModal = ShowNewOrgModal
723
754
}
724
755
725
756
appDocument =
@@ -784,6 +815,9 @@ view model =
784
815
KeyboardShortcuts ->
785
816
{ appDocument | modal = Just ( viewKeyboardShortcutsModal appContext. operatingSystem) }
786
817
818
+ NewOrg m ->
819
+ { appDocument | modal = Just ( Html . map NewOrgModalMsg ( NewOrgModal . view m)) }
820
+
787
821
appDocumentWithWelcomeTermsModal =
788
822
-- We link to TermsOfService and PrivacyPolicy from the welcome
789
823
-- terms modal and the AcceptTerms page is used during UCM signup,
0 commit comments