Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Optimized lesson deletion and subject list for autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlurak committed Jan 18, 2024
1 parent 5aa1be5 commit 8d11b6d
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/routes/settings/timetable/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { getWeekdayByAbbreviation } from '$lib/dates/dataWeekday';
import QuickActionButton from '$lib/QuickActionButton.svelte';
import I18n from '$lib/I18n.svelte';
import { subjectsSortetCapitalized } from '../../../constants/subjecticons';
const getWeekdays = () =>
(Object.keys($timetable) as WeekDay[]).map((abbr) => ({
Expand Down Expand Up @@ -108,17 +109,25 @@
sanitizeTimetable();
}}
class="rounded-sm text-light-text dark:text-light-text px-2 py-0.5 bg-gray-200"
list="subjects"
/>
<QuickActionButton
iconName="bx bx-trash"
color="text-red-500"
on:click={() => {
const lessons = $timetable[weekdays[j].abbr];
const splicedLessons = lessons.toSpliced(i, 1);

timetable.update((t) => ({ ...t, [weekdays[j].abbr]: splicedLessons }));
}}
/>
<datalist id="subjects">
{#each subjectsSortetCapitalized as subj}
<option value={subj} />
{/each}
</datalist>
{#if lesson.trim()}
<QuickActionButton
iconName="bx bx-trash"
color="text-red-500"
on:click={() => {
const lessons = $timetable[weekdays[j].abbr];
const splicedLessons = lessons.toSpliced(i, 1);

timetable.update((t) => ({ ...t, [weekdays[j].abbr]: splicedLessons }));
}}
/>
{/if}
</div>
</td>
{/each}
Expand Down

0 comments on commit 8d11b6d

Please sign in to comment.