fix: scope observer reports preview dialog to selected round

Threads the active roundId through ProjectPreviewDialog and its two
callers (filtering tabs, expandable juror table). When a round is in
scope, the preview's stats card now matches the per-juror list and
the page-level round selector. The roundId prop is optional so the
component still works in any future caller that lacks round context.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt
2026-04-27 13:17:18 +02:00
parent 9a2c10a6f8
commit cfd9dc6afe
4 changed files with 8 additions and 4 deletions

View File

@@ -546,7 +546,7 @@ function JurorsSubTab({ roundId, selectedValue }: { roundId: string; selectedVal
{isLoading ? ( {isLoading ? (
<Skeleton className="h-[400px]" /> <Skeleton className="h-[400px]" />
) : jurors.length > 0 ? ( ) : jurors.length > 0 ? (
<ExpandableJurorTable jurors={jurors} /> <ExpandableJurorTable jurors={jurors} roundId={roundId} />
) : hasSelection ? ( ) : hasSelection ? (
<Card> <Card>
<CardContent className="flex items-center justify-center py-12"> <CardContent className="flex items-center justify-center py-12">

View File

@@ -30,6 +30,7 @@ interface JurorRow {
interface ExpandableJurorTableProps { interface ExpandableJurorTableProps {
jurors: JurorRow[] jurors: JurorRow[]
roundId?: string
} }
function evalStatusBadge(status: string) { function evalStatusBadge(status: string) {
@@ -56,7 +57,7 @@ function ScorePill({ score }: { score: number }) {
) )
} }
export function ExpandableJurorTable({ jurors }: ExpandableJurorTableProps) { export function ExpandableJurorTable({ jurors, roundId }: ExpandableJurorTableProps) {
const [expanded, setExpanded] = useState<string | null>(null) const [expanded, setExpanded] = useState<string | null>(null)
const [previewProjectId, setPreviewProjectId] = useState<string | null>(null) const [previewProjectId, setPreviewProjectId] = useState<string | null>(null)
@@ -260,6 +261,7 @@ export function ExpandableJurorTable({ jurors }: ExpandableJurorTableProps) {
{/* Project Preview Dialog */} {/* Project Preview Dialog */}
<ProjectPreviewDialog <ProjectPreviewDialog
projectId={previewProjectId} projectId={previewProjectId}
roundId={roundId}
open={!!previewProjectId} open={!!previewProjectId}
onOpenChange={(open) => { if (!open) setPreviewProjectId(null) }} onOpenChange={(open) => { if (!open) setPreviewProjectId(null) }}
/> />

View File

@@ -334,6 +334,7 @@ export function FilteringReportTabs({ roundId }: FilteringReportTabsProps) {
<ProjectPreviewDialog <ProjectPreviewDialog
projectId={previewProjectId} projectId={previewProjectId}
roundId={roundId}
open={!!previewProjectId} open={!!previewProjectId}
onOpenChange={(open) => { if (!open) setPreviewProjectId(null) }} onOpenChange={(open) => { if (!open) setPreviewProjectId(null) }}
/> />

View File

@@ -21,6 +21,7 @@ import { scoreGradient } from '@/components/charts/chart-theme'
interface ProjectPreviewDialogProps { interface ProjectPreviewDialogProps {
projectId: string | null projectId: string | null
roundId?: string
open: boolean open: boolean
onOpenChange: (open: boolean) => void onOpenChange: (open: boolean) => void
} }
@@ -38,9 +39,9 @@ function ScorePill({ score }: { score: number }) {
) )
} }
export function ProjectPreviewDialog({ projectId, open, onOpenChange }: ProjectPreviewDialogProps) { export function ProjectPreviewDialog({ projectId, roundId, open, onOpenChange }: ProjectPreviewDialogProps) {
const { data, isLoading } = trpc.analytics.getProjectDetail.useQuery( const { data, isLoading } = trpc.analytics.getProjectDetail.useQuery(
{ id: projectId! }, { id: projectId!, roundId },
{ enabled: !!projectId && open }, { enabled: !!projectId && open },
) )