Repository navigation
club import fix #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
club import fix #61
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| import ValidatedInput from '$components/form/ValidatedInput.svelte'; | ||
| import ValidatedTextarea from '$components/form/ValidatedTextarea.svelte'; | ||
| import ExternalLink from '$components/ExternalLink.svelte'; | ||
| import { GradientButton, Helper, Modal, Tooltip } from 'flowbite-svelte'; | ||
| import { GradientButton, Helper, Modal, Tooltip, Checkbox } from 'flowbite-svelte'; | ||
| import { InfoCircleOutline } from 'flowbite-svelte-icons'; | ||
| import { string } from 'yup'; | ||
| import Papa from 'papaparse'; | ||
|
|
@@ -15,15 +15,15 @@ https://lhs.cx/old-clubs | |
| */ | ||
|
|
||
| interface Props { | ||
| onSubmit: (clubs: WithoutID<IClub>[]) => void; | ||
| onSubmit: (clubs: WithoutID<IClub>[], overwrite: boolean) => void; | ||
| } | ||
|
|
||
| let { onSubmit: submit }: Props = $props(); | ||
|
|
||
| const notificationContext = getNotificationContext(); | ||
|
|
||
| let modalOpen = $state(false); | ||
|
|
||
| let overwriteCheckbox = $state(false); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| let startInput: ValidatedInput | undefined = $state(); | ||
| let endInput: ValidatedInput | undefined = $state(); | ||
| let csvInput: ValidatedTextarea | undefined = $state(); | ||
|
|
@@ -84,7 +84,7 @@ https://lhs.cx/old-clubs | |
| }, | ||
| complete() { | ||
| notificationContext.show('Imported ' + records.length + ' clubs', 'success'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer accurate to the amount of clubs that are actually imported |
||
| submit(records); | ||
| submit(records, overwriteCheckbox); | ||
| modalOpen = false; | ||
| }, | ||
| }); | ||
|
|
@@ -143,6 +143,9 @@ https://lhs.cx/old-clubs | |
| /> | ||
| </div> | ||
| </div> | ||
| <Checkbox bind:checked={overwriteCheckbox} id="overwrite"> | ||
| <span class="text-amber-500 dark:text-amber-600">Overwrite existing clubs</span> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Amber looks good on light mode but it looks bad on darkmode. maybe a lighter color would work better for darkmode. |
||
| </Checkbox> | ||
| <div class="w-full"> | ||
| <ValidatedTextarea | ||
| bind:this={csvInput} | ||
|
|
@@ -160,7 +163,6 @@ https://lhs.cx/old-clubs | |
| }} | ||
| /> | ||
| </div> | ||
| <Helper>Note: This will overwrite everything already in the table.</Helper> | ||
| <GradientButton type="submit" color="purpleToPink">Import</GradientButton> | ||
| </form> | ||
| </Modal> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is never used