Skip to content

Commit

Permalink
chore: Info-Blöcke werden pro Tag zusammengefasst (#293)
Browse files Browse the repository at this point in the history
* fixed

* fixed
  • Loading branch information
SachsenspieltCoding authored Sep 8, 2024
1 parent 559f5f9 commit 76a1c4f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
12 changes: 5 additions & 7 deletions src/lib/cache/cacheHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,16 @@ export function getAllTeachers(credentials: Credentials): string[] {
return getAllEntities(credentials, PlanTypePlural.TEACHER);
}

export function getAllInfos(credentials: Credentials): Array<{ info: string; date: Date }> {
export function getAllInfos(credentials: Credentials): { infos: string[]; date: Date }[] {
const plans = getPlans(credentials.schoolnumber);
const infos: Array<{ info: string; date: Date }> = [];
const information: Array<{ infos: string[]; date: Date }> = [];
plans.forEach((plan) => {
if (plan.info) {
plan.info.forEach((info) => {
infos.push({ info, date: new Date(plan.date) });
});
information.push({ infos: plan.info, date: new Date(plan.date) });
}
});
infos.sort((a, b) => a.date.getTime() - b.date.getTime());
return infos.filter((info) => info.date.getTime() >= new Date().setHours(0, 0, 0, 0));
information.sort((a, b) => a.date.getTime() - b.date.getTime());
return information.filter((info) => info.date.getTime() >= new Date().setHours(0, 0, 0, 0));
}

function isLessonTimetableValid(lesson: PlannedLesson): boolean {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/favorites/NextLessonWidget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

{#if primary}
<a href={getHrefLink(primary.name, primary.type)}>
<div class="max-h-[20%] space-y-2 overflow-y-auto">
<div class="max-h-[30%] space-y-2 overflow-y-auto">
{#if lessons.length !== 0}
{#each lessons as lesson}
{#key lesson.id}
Expand Down
13 changes: 7 additions & 6 deletions src/routes/(app)/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,26 @@

<p>{greeting}</p>

<div class="py-4"></div>
<div class="py-5"></div>

{#if data.infos.length > 0}
<h3>Informationen</h3>
<div class="max-h-[40%] overflow-y-auto">
<div class="max-h-[25%] overflow-y-auto">
{#each data.infos as info}
<div class="bg-display mb-2 rounded-lg p-4">
<p class="text-xs font-bold">{info.date.toLocaleDateString()}</p>
<p>{info.info}</p>
<p class="text-sm font-bold">{info.date.toLocaleDateString()}</p>
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
<p class="">{@html info.infos.join('<br>')}</p>
</div>
{/each}
</div>

<div class="py-4"></div>
<div class="py-5"></div>
{/if}

<NextLessonWidget primary={data.primaryFavorite} favorites={data.favorites} />

<div class="py-4"></div>
<div class="py-5"></div>

<h3>Deine Favoriten</h3>
<FavoritesDisplay favorites={data.favorites} />
Expand Down

0 comments on commit 76a1c4f

Please sign in to comment.