diff --git a/CHANGELOG.md b/CHANGELOG.md index 066e6266..1942eab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ written while it was being built. See [RELEASING.md](RELEASING.md). ### Added +- Manage Teams makes unsaved changes hard to lose: a bar at the top stays in + view while you scroll and shows what is unsaved with Save and Discard, the + people and teams that changed are marked until saved, and following a link + away from the page asks first. - Manage Teams fixes the teams once a team has a submission or teams are published: a notice says why, and uploading, adding and deleting teams are disabled. People can still be moved between teams or to Unassigned by hand, diff --git a/components/frontend/src/lib/components/layout/ConfirmDialog.svelte b/components/frontend/src/lib/components/layout/ConfirmDialog.svelte new file mode 100644 index 00000000..5138ca89 --- /dev/null +++ b/components/frontend/src/lib/components/layout/ConfirmDialog.svelte @@ -0,0 +1,73 @@ + + + + + answer(false)} + onclick={(e) => { + if (e.target === dialog) answer(false); + }} + class="m-auto w-[min(28rem,calc(100vw-2rem))] rounded-card border border-line bg-surface p-0 + text-ink shadow-lg backdrop:bg-scrim" +> + {#if current} +
+

{current.title}

+

{current.message}

+
+ + + +
+
+ {/if} +
diff --git a/components/frontend/src/routes/(app)/my/hackathon/[id]/teams/manage/+page.svelte b/components/frontend/src/routes/(app)/my/hackathon/[id]/teams/manage/+page.svelte index a48e1635..191a56e2 100644 --- a/components/frontend/src/routes/(app)/my/hackathon/[id]/teams/manage/+page.svelte +++ b/components/frontend/src/routes/(app)/my/hackathon/[id]/teams/manage/+page.svelte @@ -1,5 +1,6 @@ + + {#snippet personRow( person: Person, from: string, @@ -599,14 +665,20 @@ )} {@const matches = projectId !== null && person.preferredProjectIds.includes(projectId)} {@const answers = answersFor(person)} + {@const unsaved = changes.movedIds.has(person.id)} +
startDrag(e, person.id, from)} ondragend={endDrag} - class="flex cursor-grab items-center gap-1.5 rounded-card border border-line bg-raised - px-2 py-1 active:cursor-grabbing" + class="flex cursor-grab items-center gap-1.5 rounded-card border px-2 py-1 + active:cursor-grabbing {unsaved + ? 'border-warning bg-warning/10' + : 'border-line bg-raised'}" class:opacity-40={draggedId === person.id} + title={unsaved ? 'Moved — not saved yet' : undefined} >
@@ -683,6 +755,50 @@

Manage Teams

+ +
+ + {#if pending} + Saving… + {:else if changes.total > 0} + Unsaved changes, marked on the page: {changes.summary} + {:else} + No unsaved changes + {/if} + + {#if form?.message && !pending} + {form.message} + {/if} + + +
+ {#if locked}
- {#if changes.total > 0} - Unsaved: {changes.summary} - {:else} - No unsaved changes - {/if} - - -