feat: implement LoaderPersons to fetch person data and integrate into year page
This commit is contained in:
5
src/lib/loaders/LoaderPerson.ts
Normal file
5
src/lib/loaders/LoaderPerson.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { DB } from '$lib/integrations/db';
|
||||
|
||||
export const LoaderPersons = (yearId: string) => {
|
||||
return () => DB.getPersons(yearId);
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
import { orchestrateLoaders } from '$lib/loaders';
|
||||
import { LoaderPersons } from '$lib/loaders/LoaderPerson';
|
||||
import { LoaderYear } from '$lib/loaders/LoaderYear';
|
||||
import { LoaderYears } from '$lib/loaders/LoaderYear';
|
||||
|
||||
@@ -8,8 +9,11 @@ export const load = async ({ params }: { params: { year: string } }) => {
|
||||
LoaderYears()
|
||||
]);
|
||||
|
||||
const personsData = await LoaderPersons(yearData.id)();
|
||||
|
||||
return {
|
||||
year: yearData,
|
||||
years: yearsData
|
||||
years: yearsData,
|
||||
persons: personsData
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script>
|
||||
import PersonCard from '$lib/components/molecules/PersonCard.svelte';
|
||||
import YearNav from '$lib/components/molecules/YearNav.svelte';
|
||||
import YearControls from '$lib/components/organisms/YearControls.svelte';
|
||||
import YearOverview from '$lib/components/organisms/YearOverview.svelte';
|
||||
@@ -9,3 +10,8 @@
|
||||
<YearOverview data={data.year} />
|
||||
<YearNav years={data.years} />
|
||||
<YearControls />
|
||||
<section class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
{#each data.persons as person}
|
||||
<PersonCard {...person} />
|
||||
{/each}
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user