Skip to content

Commit add202c

Browse files
fix: fullscreen transition visibility issue (#182)
<!-- CURSOR_SUMMARY --> > [!NOTE] > Always render the chart card and the fullscreen dialog, controlling visibility via Dialog open and passing explicit isFullscreen flags to prevent transition flicker. > > - **Dashboard/Usage Chart (`src/features/dashboard/usage/usage-metric-chart.tsx`)**: > - Always render base `Card` with `UsageMetricChartContent` (`isFullscreen: false`); remove conditional non-fullscreen wrapper. > - Always render `Dialog` (visibility via `open={isFullscreen}`) with `DialogContent` and nested `Card` containing `UsageMetricChartContent` (`isFullscreen: true`). > - Clean up classes on `DialogContent` (drop `border-0`) and inner fullscreen `Card` retains `border-0`. > - Simplify fullscreen toggle handling via `onOpenChange` without conditional JSX blocks. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4f29090. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 4efd81e commit add202c

File tree

1 file changed

+27
-31
lines changed

1 file changed

+27
-31
lines changed

src/features/dashboard/usage/usage-metric-chart.tsx

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -131,39 +131,35 @@ export function UsageMetricChart({
131131

132132
return (
133133
<>
134-
{!isFullscreen && (
135-
<Card className={cn('h-full flex flex-col', className)}>
136-
<UsageMetricChartContent
137-
metric={metric}
138-
timeRangeControlsClassName={timeRangeControlsClassName}
139-
isFullscreen={isFullscreen}
140-
/>
141-
</Card>
142-
)}
134+
<Card className={cn('h-full flex flex-col', className)}>
135+
<UsageMetricChartContent
136+
metric={metric}
137+
timeRangeControlsClassName={timeRangeControlsClassName}
138+
isFullscreen={false}
139+
/>
140+
</Card>
143141

144-
{isFullscreen && (
145-
<Dialog
146-
open={isFullscreen}
147-
onOpenChange={(open) => !open && setFullscreenMetric(null)}
142+
<Dialog
143+
open={isFullscreen}
144+
onOpenChange={(open) => !open && setFullscreenMetric(null)}
145+
>
146+
<DialogContent
147+
className="sm:max-w-[min(90svw,2200px)] w-full max-h-[min(70svh,1200px)] h-full p-0"
148+
closeButtonClassName="top-7.5 right-6.5"
148149
>
149-
<DialogContent
150-
className="sm:max-w-[min(90svw,2200px)] w-full max-h-[min(70svh,1200px)] h-full border-0 p-0"
151-
closeButtonClassName="top-7.5 right-6.5"
152-
>
153-
{/* title just here to avoid accessibility dev error from radix */}
154-
<DialogTitle className="sr-only">
155-
{METRIC_CONFIGS[metric].title}
156-
</DialogTitle>
157-
<Card className="h-full flex flex-col border-0">
158-
<UsageMetricChartContent
159-
metric={metric}
160-
timeRangeControlsClassName={timeRangeControlsClassName}
161-
isFullscreen={isFullscreen}
162-
/>
163-
</Card>
164-
</DialogContent>
165-
</Dialog>
166-
)}
150+
{/* title just here to avoid accessibility dev error from radix */}
151+
<DialogTitle className="sr-only">
152+
{METRIC_CONFIGS[metric].title}
153+
</DialogTitle>
154+
<Card className="h-full flex flex-col border-0">
155+
<UsageMetricChartContent
156+
metric={metric}
157+
timeRangeControlsClassName={timeRangeControlsClassName}
158+
isFullscreen={true}
159+
/>
160+
</Card>
161+
</DialogContent>
162+
</Dialog>
167163
</>
168164
)
169165
}

0 commit comments

Comments
 (0)