-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add promise global events (#157)
* feat: retrieve global events data * feat: add global events in promise details page * refactor: remove type error * feat: show event links * style: add border dashed for global events --------- Co-authored-by: Th1nkK1D <[email protected]> Co-authored-by: Poppap <[email protected]>
- Loading branch information
1 parent
2fd5128
commit 96c506b
Showing
6 changed files
with
58 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { GlobalEvent } from '$models/global-event'; | ||
import { sheets, withCache } from './shared'; | ||
import { asDate, asString, Column, Object } from 'sheethuahua'; | ||
|
||
export const fetchGlobalEvents = withCache('Global Events', (): Promise<GlobalEvent[]> => { | ||
const partySchema = Object({ | ||
title: Column('title', asString()), | ||
description: Column('description', asString()), | ||
date: Column('date', asDate()), | ||
url: Column('url', asString()) | ||
}); | ||
|
||
return sheets.get('Global Events', partySchema); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface GlobalEvent { | ||
title: string; | ||
description: string; | ||
date: Date; | ||
url: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { fetchFromIdOr404, fetchPromises } from '$lib/datasheets/index.js'; | ||
import { fetchFromIdOr404, fetchGlobalEvents, fetchPromises } from '$lib/datasheets/index.js'; | ||
|
||
export async function load({ params }) { | ||
const promise = await fetchFromIdOr404(fetchPromises, params.id); | ||
const globalEvents = await fetchGlobalEvents(); | ||
|
||
return { | ||
promise | ||
promise, | ||
globalEvents | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters