Skip to content

Commit edf2567

Browse files
committed
Close contribution edit modal on save
Instead of waiting 1.5s and showing a success message, just close the modal and let the user get on with it.
1 parent b1017fd commit edf2567

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

src/UnisonShare/Page/ProjectContributionPage.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ update appContext projectRef contribRef _ project msg model =
171171

172172
( modal, contribution ) =
173173
case out of
174-
ProjectContributionFormModal.None ->
174+
ProjectContributionFormModal.NoOut ->
175175
( EditModal projectContributionFormModal, model.contribution )
176176

177177
ProjectContributionFormModal.RequestToCloseModal ->

src/UnisonShare/Page/ProjectContributionsPage.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ update appContext projectRef _ project msg model =
203203

204204
( modal, tab, out_ ) =
205205
case ( out, model.tab ) of
206-
( ProjectContributionFormModal.None, _ ) ->
206+
( ProjectContributionFormModal.NoOut, _ ) ->
207207
( SubmitContributionModal projectContributionFormModal, model.tab, NoOut )
208208

209209
( ProjectContributionFormModal.RequestToCloseModal, _ ) ->

src/UnisonShare/ProjectContributionFormModal.elm

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ type Msg
125125

126126

127127
type OutMsg
128-
= None
128+
= NoOut
129129
| RequestToCloseModal
130130
| Saved ContributionSummary
131131

@@ -151,10 +151,10 @@ update appContext project account msg model =
151151
, validity = NotChecked
152152
}
153153
in
154-
( { model | form = Success form }, Cmd.none, None )
154+
( { model | form = Success form }, Cmd.none, NoOut )
155155

156156
Err e ->
157-
( { model | form = Failure e }, Cmd.none, None )
157+
( { model | form = Failure e }, Cmd.none, NoOut )
158158

159159
( FetchRecentBranchesFinished recentBranches, _, Create ) ->
160160
case recentBranches of
@@ -176,10 +176,10 @@ update appContext project account msg model =
176176
, validity = NotChecked
177177
}
178178
in
179-
( { model | form = Success form }, Cmd.none, None )
179+
( { model | form = Success form }, Cmd.none, NoOut )
180180

181181
Err e ->
182-
( { model | form = Failure e }, Cmd.none, None )
182+
( { model | form = Failure e }, Cmd.none, NoOut )
183183

184184
( ToggleSelectSourceBranchSheet, Success form, _ ) ->
185185
let
@@ -205,7 +205,7 @@ update appContext project account msg model =
205205
in
206206
{ form | selectBranchSheet = selectBranchSheet }
207207
in
208-
( { model | form = Success form_ }, Cmd.none, None )
208+
( { model | form = Success form_ }, Cmd.none, NoOut )
209209

210210
( ToggleSelectTargetBranchSheet, Success form, _ ) ->
211211
let
@@ -224,7 +224,7 @@ update appContext project account msg model =
224224
in
225225
{ form | selectBranchSheet = selectBranchSheet }
226226
in
227-
( { model | form = Success form_ }, Cmd.none, None )
227+
( { model | form = Success form_ }, Cmd.none, NoOut )
228228

229229
( SearchBranchSheetMsg sbsMsg, Success form, _ ) ->
230230
case form.selectBranchSheet of
@@ -246,7 +246,7 @@ update appContext project account msg model =
246246
in
247247
( { model | form = Success newForm }
248248
, Cmd.map SearchBranchSheetMsg cmd
249-
, None
249+
, NoOut
250250
)
251251

252252
OpenForTarget t ->
@@ -264,25 +264,25 @@ update appContext project account msg model =
264264
in
265265
( { model | form = Success newForm }
266266
, Cmd.map SearchBranchSheetMsg cmd
267-
, None
267+
, NoOut
268268
)
269269

270270
Closed ->
271-
( model, Cmd.none, None )
271+
( model, Cmd.none, NoOut )
272272

273273
( UpdateSubmissionTitle t, Success form, _ ) ->
274274
let
275275
newForm =
276276
{ form | title = t }
277277
in
278-
( { model | form = Success newForm }, Cmd.none, None )
278+
( { model | form = Success newForm }, Cmd.none, NoOut )
279279

280280
( UpdateSubmissionDescription d, Success form, _ ) ->
281281
let
282282
newForm =
283283
{ form | description = d }
284284
in
285-
( { model | form = Success newForm }, Cmd.none, None )
285+
( { model | form = Success newForm }, Cmd.none, NoOut )
286286

287287
( SaveContribution, Success form, Create ) ->
288288
let
@@ -325,14 +325,14 @@ update appContext project account msg model =
325325
in
326326
( { model | form = Success newForm }
327327
, createProjectContribution appContext project.ref newContribution
328-
, None
328+
, NoOut
329329
)
330330

331331
else
332-
( model, Cmd.none, None )
332+
( model, Cmd.none, NoOut )
333333

334334
_ ->
335-
( { model | form = Success { form | validity = validity } }, Cmd.none, None )
335+
( { model | form = Success { form | validity = validity } }, Cmd.none, NoOut )
336336

337337
( SaveContribution, Success form, Edit c ) ->
338338
case form.sourceBranchRef of
@@ -354,29 +354,26 @@ update appContext project account msg model =
354354
project.ref
355355
c.ref
356356
updatedContribution
357-
, None
357+
, NoOut
358358
)
359359

360360
_ ->
361-
( model, Cmd.none, None )
361+
( model, Cmd.none, NoOut )
362362

363363
( SaveContributionFinished contribution, Success form, _ ) ->
364364
let
365-
cmd =
365+
out =
366366
case contribution of
367367
Success c ->
368-
Util.delayMsg 1500 (SuccessfullySaved c)
368+
Saved c
369369

370370
_ ->
371-
Cmd.none
371+
NoOut
372372
in
373-
( { model | form = Success { form | save = contribution } }, cmd, None )
374-
375-
( SuccessfullySaved contrib, _, _ ) ->
376-
( model, Cmd.none, Saved contrib )
373+
( { model | form = Success { form | save = contribution } }, Cmd.none, out )
377374

378375
_ ->
379-
( model, Cmd.none, None )
376+
( model, Cmd.none, NoOut )
380377

381378

382379

0 commit comments

Comments
 (0)