-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
236 select week #244
236 select week #244
Conversation
|
||
function handleNextWeekClick() { | ||
if (selectedWeek) { | ||
setSelectedWeek({ year: 2023, weekNumber: selectedWeek.weekNumber + 1 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Denne vil vel ikke ta hensyn til årskifte? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Veldig bra!
I framtiden kan vi kanskje tenke på å prefetche data for 1-2 uker rundt nåværende seleksjon, får å gjøre navigering av uker smoothere
export function stringToWeek(urlString?: string): Week | undefined { | ||
if (!urlString) return; | ||
try { | ||
const args = urlString.split("-"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kan du kanskje bruke destrukturering her for å gjøre koden lettere å lese? Eks:
const [yearStr, weekStr] = urlString.split("-");
const year = Number.parseInt(yearStr);
const week = Number.parseInt(weekStr);
@@ -0,0 +1,22 @@ | |||
import { Week } from "@/types"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Litt usikker på å plassere denne filen i data-mappen. Forstår ulempen med en utils-mappe, men jeg tenker personlig det hadde vært enklere å lokalisere denne filen i en mappe som heter utils enn en som heter data 😅 Hva tenker dere?
Adds possibility to change active week.
Note that this does not show which week is the current one.