Skip to content

basic volunteer dashboard#199

Open
jansm04 wants to merge 2 commits intomainfrom
184-volunteer-dashboard
Open

basic volunteer dashboard#199
jansm04 wants to merge 2 commits intomainfrom
184-volunteer-dashboard

Conversation

@jansm04
Copy link
Copy Markdown
Contributor

@jansm04 jansm04 commented Apr 9, 2026

implemented as per #184. Slightly modified the existing shift item in src/app/components/schedule so we can re use the code in the dashboard

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Greptile Summary

This PR adds a volunteer dashboard with three widgets — upcoming shifts, shifts needing coverage, and a check-in countdown — and refactors ShiftItem to accept an optional onOpen callback so it can be reused outside the schedule page context.

  • P1 — dashboard-checkin-widget.tsx lines 52–55: AttendanceStatus.excused is included in hasCheckedIn, so a volunteer who is excused (but never checked in) will incorrectly see the "Checked In!" success card. Only present and late should be treated as a real check-in.

Confidence Score: 4/5

Safe to merge after fixing the excused status logic in the check-in widget.

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 hasCheckedIn condition.

Vulnerabilities

No security concerns identified. The check-in mutation correctly delegates authorization to the server-side tRPC procedure, and no sensitive data is exposed client-side.

Important Files Changed

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(), []);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
const now = useMemo(() => new Date(), []);
const now = new Date();

Comment on lines +59 to +65
<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>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
<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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing newline at end of file

page.tsx, shift-item.tsx, and dashboard-upcoming-shifts.tsx are all missing a trailing newline. Most linters and Git tools expect files to end with a newline.

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant