Skip to content

Commit

Permalink
Show sponsor modal before contact modal
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquecbuss committed Oct 15, 2021
1 parent 205c2ca commit 0c6a515
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/elm/Page/Dashboard.elm
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ init loggedIn =
initModel loggedIn.shared
in
( model
, Cmd.batch
[ LoggedIn.maybeInitWith CompletedLoadCommunity .selectedCommunity loggedIn
, LoggedIn.maybeInitWith (\_ -> CompletedLoadProfile) .profile loggedIn
]
, LoggedIn.maybeInitWith CompletedLoadCommunity .selectedCommunity loggedIn
)


Expand Down Expand Up @@ -1022,7 +1019,6 @@ type Msg
= NoOp
| ClosedAuthModal
| CompletedLoadCommunity Community.Model
| CompletedLoadProfile
| CompletedLoadBalance (Result Http.Error (Maybe Balance))
| CompletedLoadUserTransfers (RemoteData (Graphql.Http.Error (Maybe QueryTransfers)) (Maybe QueryTransfers))
| ClaimsLoaded (RemoteData (Graphql.Http.Error (Maybe Claim.Paginated)) (Maybe Claim.Paginated))
Expand Down Expand Up @@ -1082,22 +1078,22 @@ update msg model ({ shared, accountName } as loggedIn) =

else
identity

showModalRequestingSponsor =
hasContributionConfiguration && not shared.hasSeenSponsorModal
in
UR.init
{ model
| balance = RemoteData.Loading
, analysis = LoadingGraphql Nothing
, showModalRequestingSponsor = hasContributionConfiguration && not shared.hasSeenSponsorModal
, showModalRequestingSponsor = showModalRequestingSponsor
, showContactModal = not showModalRequestingSponsor && shouldShowContactModal loggedIn model
}
|> UR.addCmd (fetchBalance shared accountName community)
|> UR.addCmd (fetchAvailableAnalysis loggedIn Nothing model.analysisFilter community)
|> UR.addCmd (fetchTransfers loggedIn community Nothing model)
|> markSponsorModalAsSeen

CompletedLoadProfile ->
{ model | showContactModal = shouldShowContactModal loggedIn model }
|> UR.init

CompletedLoadBalance (Ok balance) ->
UR.init { model | balance = RemoteData.Success balance }

Expand Down Expand Up @@ -1871,9 +1867,6 @@ receiveBroadcast broadcastMsg =
LoggedIn.CommunityLoaded community ->
Just (CompletedLoadCommunity community)

LoggedIn.ProfileLoaded _ ->
Just CompletedLoadProfile

_ ->
Nothing

Expand Down Expand Up @@ -1918,9 +1911,6 @@ msgToString msg =
CompletedLoadCommunity _ ->
[ "CompletedLoadCommunity" ]

CompletedLoadProfile ->
[ "CompletedLoadProfile" ]

CompletedLoadBalance result ->
[ "CompletedLoadBalance", UR.resultToString result ]

Expand Down

0 comments on commit 0c6a515

Please sign in to comment.