Skip to content

Commit

Permalink
improved plan view updates hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
SachsenspieltCoding committed Jan 13, 2024
1 parent d60286a commit 92d7c0c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
4 changes: 2 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ bonus:
- [ ] Implement credentials
- [ ] Implement theming (?)
- [ ] Implement general info on home screen
- [ ] make PWA
- [ ] Implement offline mode
- [x] make PWA
- [x] Implement offline mode
- [ ] Implement search

## Bug fixes
Expand Down
9 changes: 3 additions & 6 deletions src/lib/components/plan/PlanLessonDisplay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
import type { PlannedLesson } from 'indiware-api';
import PlanLessonItem from './PlanLessonItem.svelte';
import type { PlanType } from '$lib/api/planTypes';
import { page } from '$app/stores';
export let lessons: PlannedLesson[] = [];
export let type: PlanType;
</script>

<div class="flex flex-col gap-2 overflow-y-auto">
{#key $page.url}
{#each lessons as lesson}
<PlanLessonItem {lesson} {type} />
{/each}
{/key}
{#each lessons as lesson}
<PlanLessonItem {lesson} {type} />
{/each}
</div>
20 changes: 9 additions & 11 deletions src/lib/components/plan/PlanNavigation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@
}
</script>

{#key $page.url}
<div class="flex w-full items-center justify-between py-2">
<a href={getHrefLink(addDays(-1), short, type)}>
<Icon icon={faCircleChevronLeft} scale={1.5} />
</a>
<div class="flex w-full items-center justify-between py-2">
<a href={getHrefLink(addDays(-1), short, type)}>
<Icon icon={faCircleChevronLeft} scale={1.5} />
</a>

<slot />
<slot />

<a href={getHrefLink(addDays(1), short, type)}>
<Icon icon={faCircleChevronRight} scale={1.5} />
</a>
</div>
{/key}
<a href={getHrefLink(addDays(1), short, type)}>
<Icon icon={faCircleChevronRight} scale={1.5} />
</a>
</div>
22 changes: 12 additions & 10 deletions src/routes/(app)/plan/[type]/[short]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@
<PlanInformation plan={data.substitutionPlan || undefined} />
{/key}

{#if data.plan && data.substitutionPlan}
<PlanLessonDisplay
lessons={data.plan.plannedLessons.sort((a, b) => a.order - b.order)}
type={data.type}
/>
{:else}
<p class="flex items-center justify-center gap-2 font-bold text-secondary-600">
<Icon icon={faFaceFrown} />Kein Plan verfügbar
</p>
{/if}
{#key $planStore.currentDate}
{#if data.plan && data.substitutionPlan}
<PlanLessonDisplay
lessons={data.plan.plannedLessons.sort((a, b) => a.order - b.order)}
type={data.type}
/>
{:else}
<p class="flex items-center justify-center gap-2 font-bold text-secondary-600">
<Icon icon={faFaceFrown} />Kein Plan verfügbar
</p>
{/if}
{/key}
</div>

0 comments on commit 92d7c0c

Please sign in to comment.