Skip to content

Commit

Permalink
added no duplicate splitDayName UI and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyAsh5114 committed Dec 29, 2023
1 parent 52c83d8 commit 18d3297
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/routes/exerciseSplits/[mode]/structure/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { goto } from "$app/navigation";
$: ({ params } = $page);
let noDuplicatesModal: HTMLDialogElement;
let atLeastOneWorkoutModal: HTMLDialogElement;
let deleteSplitDataModal: HTMLDialogElement;
let notMatchedDays: Set<string> = new Set();
Expand All @@ -29,6 +30,13 @@
atLeastOneWorkoutModal.show();
return false;
}
const noDuplicates = new Set($splitStructure.filter((splitDay) => splitDay !== null));
console.log(noDuplicates, nonRestDays);
if (noDuplicates.size < nonRestDays) {
noDuplicatesModal.show();
return false;
}
return true;
}
Expand Down Expand Up @@ -71,6 +79,13 @@
}
</script>

<MyModal title="Error" bind:dialogElement={noDuplicatesModal}>
<p>
Avoid duplicate workout names, you can copy exercises if needed. For example:
<i class="text-accent">Pull A, Pull B</i> instead of <i class="text-error">Pull, Pull</i>
</p>
</MyModal>

<MyModal title="Error" bind:dialogElement={atLeastOneWorkoutModal}>
<p>Add at least one workout to the exercise split</p>
</MyModal>
Expand Down

0 comments on commit 18d3297

Please sign in to comment.