Conversation
Greptile SummaryThis PR adds a volunteer dashboard with three widgets — upcoming shifts, shifts needing coverage, and a check-in countdown — and refactors
Confidence Score: 4/5Safe to merge after fixing the One P1 logic bug (excused treated as checked-in) should be resolved before merging; remaining findings are P2 style/UX issues that don't block the feature. src/components/dashboard/dashboard-checkin-widget.tsx — incorrect
|
| Filename | Overview |
|---|---|
| src/components/dashboard/dashboard-checkin-widget.tsx | New check-in countdown widget; excused attendance status is incorrectly treated as checked-in, causing the success card to display for volunteers who are merely excused from the shift. |
| src/components/dashboard/dashboard-upcoming-shifts.tsx | New upcoming-shifts card using useShiftRange; now is captured once at mount so ended shifts won't be filtered out without a page reload; minor indentation inconsistency in the Link block. |
| src/components/dashboard/dashboard-coverage-shifts.tsx | New coverage-shifts card; coverage take/withdraw mutations and query integration look correct; stale now used as query from param (same pattern as upcoming-shifts). |
| src/components/schedule/shift-item.tsx | Refactored to accept optional onOpen prop; falls back gracefully to SchedulePageContext or a no-op, allowing reuse outside the schedule page without breaking existing callers. |
| src/components/schedule/schedule-page-context.tsx | Exports SchedulePageContext directly so shift-item.tsx can use useContext instead of the throwing useSchedulePage hook; no behavioural change for existing consumers. |
| src/app/(authorized)/page.tsx | Routes volunteers to the new VolunteerDashboard layout; non-volunteer roles still see the "under construction" empty state; missing trailing newline. |
Reviews (1): Last reviewed commit: "basic volunteer dashboard" | Re-trigger Greptile
|
|
||
| export function DashboardUpcomingShifts() { | ||
| const router = useRouter(); | ||
| const now = useMemo(() => new Date(), []); |
There was a problem hiding this comment.
Stale
now reference for shift filtering
now is captured once at mount and never updated, so upcomingShifts won't drop a shift that ends while the page is open. The same pattern exists in DashboardCoverageShifts. If the page stays open past a shift's end time, the ended shift will remain visible until a full reload.
| const now = useMemo(() => new Date(), []); | |
| const now = new Date(); |
| <Link | ||
| href="/schedule" | ||
| className="flex items-center gap-1" | ||
| > | ||
| <CardTitle className="text-base font-semibold">My Upcoming Shifts</CardTitle> | ||
| <ChevronRight className="size-4 text-muted-foreground" /> | ||
| </Link> |
There was a problem hiding this comment.
Inconsistent indentation in
Link block
The inner elements of the Link are indented with extra spaces relative to the surrounding code. The same pattern appears in dashboard-checkin-widget.tsx.
| <Link | |
| href="/schedule" | |
| className="flex items-center gap-1" | |
| > | |
| <CardTitle className="text-base font-semibold">My Upcoming Shifts</CardTitle> | |
| <ChevronRight className="size-4 text-muted-foreground" /> | |
| </Link> | |
| <Link href="/schedule" className="flex items-center gap-1"> | |
| <CardTitle className="text-base font-semibold">My Upcoming Shifts</CardTitle> | |
| <ChevronRight className="size-4 text-muted-foreground" /> | |
| </Link> |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| </PageLayout> | ||
| ); | ||
| } | ||
| } No newline at end of file |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
implemented as per #184. Slightly modified the existing shift item in
src/app/components/scheduleso we can re use the code in the dashboard