This repository was archived by the owner on Jun 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Project metric #163
Open
Open
Project metric #163
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7414a24
Add project check-ins feature
thienkq a836b63
Refactor project check-in UI and add styles
thienkq 84cb9fb
Update ProjectCheckinSession.tsx
thienkq c91911f
Add My Projects dashboard and dashboard query
thienkq 3aa84bb
Add All Projects dashboard and week selector
thienkq 44149ce
fix lint
thienkq 67b698b
Monthly aggregation & transactional checkin RPC
thienkq 55a4adb
Update queries.ts
thienkq eacb945
Require evidence comments for extreme scores
thienkq f77f3b4
Add benchmark guide dialog and show full notes
thienkq f5c823a
Add leadership dashboard & submission tracking
thienkq 726f68c
fix lint
thienkq 524c686
Use /check-ins for reminder email links
thienkq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
src/app/(authenticated)/check-ins/[projectId]/page.tsx
This file contains hidden or 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,82 @@ | ||
| import Link from 'next/link'; | ||
|
|
||
| import { getISOWeek } from 'date-fns/getISOWeek'; | ||
| import { getISOWeekYear } from 'date-fns/getISOWeekYear'; | ||
|
|
||
| import { Button } from '@/components/ui/button'; | ||
| import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; | ||
| import { createClient } from '@/utils/supabase/server'; | ||
| import { getProjectCheckinPageData } from '@/lib/project-checkins/queries'; | ||
| import ProjectCheckinSession from '../components/ProjectCheckinSession'; | ||
|
|
||
| type ProjectCheckinProjectPageProps = { | ||
| params: Promise<{ projectId: string }>; | ||
| searchParams: Promise<{ year?: string; week?: string }>; | ||
| }; | ||
|
|
||
| function parseYearWeek(searchYear?: string, searchWeek?: string): { year: number; weekNumber: number } { | ||
| const now = new Date(); | ||
| const year = searchYear ? parseInt(searchYear, 10) : getISOWeekYear(now); | ||
| const weekNumber = searchWeek ? parseInt(searchWeek, 10) : getISOWeek(now); | ||
| if (Number.isNaN(year) || Number.isNaN(weekNumber)) { | ||
| return { year: getISOWeekYear(now), weekNumber: getISOWeek(now) }; | ||
| } | ||
| return { | ||
| year: year >= 2000 && year <= 2100 ? year : getISOWeekYear(now), | ||
| weekNumber: weekNumber >= 1 && weekNumber <= 53 ? weekNumber : getISOWeek(now), | ||
| }; | ||
| } | ||
|
|
||
| export default async function ProjectCheckinProjectPage({ params, searchParams }: ProjectCheckinProjectPageProps) { | ||
| const { projectId } = await params; | ||
| const { year: searchYear, week: searchWeek } = await searchParams; | ||
| const { year, weekNumber } = parseYearWeek(searchYear, searchWeek); | ||
|
|
||
| const supabase = await createClient(); | ||
| const { | ||
| data: { user }, | ||
| } = await supabase.auth.getUser(); | ||
|
|
||
| if (!user) { | ||
| return null; | ||
| } | ||
|
|
||
| const data = await getProjectCheckinPageData(user.id, projectId, year, weekNumber); | ||
|
|
||
| if (!data.project) { | ||
| return ( | ||
| <div className="mx-auto max-w-3xl px-4 py-8"> | ||
| <Card className="border-slate-200"> | ||
| <CardHeader> | ||
| <CardTitle>Project not found</CardTitle> | ||
| <CardDescription> | ||
| This project does not exist or is not available for check-in. | ||
| </CardDescription> | ||
| </CardHeader> | ||
| <CardContent className="flex gap-3"> | ||
| <Button asChild> | ||
| <Link href="/check-ins">Back to check-ins</Link> | ||
| </Button> | ||
| <Button asChild variant="outline"> | ||
| <Link href="/check-ins/new">Start new check-in</Link> | ||
| </Button> | ||
| </CardContent> | ||
| </Card> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="mx-auto max-w-4xl px-4 py-8 sm:px-6"> | ||
| <ProjectCheckinSession | ||
| project={data.project} | ||
| year={year} | ||
| weekNumber={weekNumber} | ||
| definitions={data.definitions} | ||
| previousResponsesByMetric={data.previousResponsesByMetric} | ||
| currentSubmission={data.currentSubmission} | ||
| currentResponses={data.currentResponses} | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.