1- import { ChartBarSquareIcon } from "@heroicons/react/20/solid" ;
21import { DialogClose } from "@radix-ui/react-dialog" ;
32import { Form , useNavigation } from "@remix-run/react" ;
3+ import { IconChartHistogram } from "@tabler/icons-react" ;
44import { useEffect , useState } from "react" ;
55import { useEnvironment } from "~/hooks/useEnvironment" ;
66import {
77 useCustomDashboards ,
8+ useOrganization ,
89 useWidgetLimitPerDashboard ,
910} from "~/hooks/useOrganizations" ;
1011import { useProject } from "~/hooks/useProject" ;
11- import { useOrganization } from "~/hooks/useOrganizations " ;
12+ import { cn } from "~/utils/cn " ;
1213import { Button } from "../primitives/Buttons" ;
1314import { Dialog , DialogContent , DialogHeader } from "../primitives/Dialog" ;
1415import { FormButtons } from "../primitives/FormButtons" ;
1516import { Paragraph } from "../primitives/Paragraph" ;
16- import { cn } from "~/utils/cn" ;
1717import type { QueryWidgetConfig } from "./QueryWidget" ;
1818
1919export type SaveToDashboardDialogProps = {
@@ -42,7 +42,7 @@ export function SaveToDashboardDialog({
4242 const firstAvailableDashboard = customDashboards . find ( ( d ) => d . widgetCount < widgetLimit ) ;
4343
4444 const [ selectedDashboardId , setSelectedDashboardId ] = useState < string | null > (
45- firstAvailableDashboard ?. friendlyId ?? ( customDashboards [ 0 ] ?. friendlyId ?? null )
45+ firstAvailableDashboard ?. friendlyId ?? customDashboards [ 0 ] ?. friendlyId ?? null
4646 ) ;
4747
4848 // Build the form action URL
@@ -54,7 +54,9 @@ export function SaveToDashboardDialog({
5454
5555 // Check if selected dashboard is at widget limit
5656 const selectedDashboard = customDashboards . find ( ( d ) => d . friendlyId === selectedDashboardId ) ;
57- const isSelectedAtLimit = selectedDashboard ? selectedDashboard . widgetCount >= widgetLimit : false ;
57+ const isSelectedAtLimit = selectedDashboard
58+ ? selectedDashboard . widgetCount >= widgetLimit
59+ : false ;
5860
5961 // Close dialog when navigation completes (redirect is happening)
6062 useEffect ( ( ) => {
@@ -74,16 +76,17 @@ export function SaveToDashboardDialog({
7476 if ( customDashboards . length === 0 ) {
7577 return (
7678 < Dialog open = { isOpen } onOpenChange = { onOpenChange } >
77- < DialogContent >
78- < DialogHeader > Save to Dashboard </ DialogHeader >
79- < div className = "space-y-4 pt-3 " >
79+ < DialogContent className = "sm:max-w-sm" >
80+ < DialogHeader > Save to dashboard </ DialogHeader >
81+ < div className = "!mt-1 space-y-4" >
8082 < Paragraph variant = "small" className = "text-text-dimmed" >
8183 You don't have any custom dashboards yet. Create one first from the sidebar menu.
8284 </ Paragraph >
8385 < FormButtons
86+ className = "justify-end"
8487 cancelButton = {
8588 < DialogClose asChild >
86- < Button variant = "tertiary /medium" > Close</ Button >
89+ < Button variant = "secondary /medium" > Close</ Button >
8790 </ DialogClose >
8891 }
8992 />
@@ -95,17 +98,17 @@ export function SaveToDashboardDialog({
9598
9699 return (
97100 < Dialog open = { isOpen } onOpenChange = { onOpenChange } >
98- < DialogContent >
99- < DialogHeader > Save to Dashboard </ DialogHeader >
100- < Form method = "post" action = { formAction } className = "space-y-4 pt-3 " >
101+ < DialogContent className = "sm:max-w-sm" >
102+ < DialogHeader > Save to dashboard </ DialogHeader >
103+ < Form method = "post" action = { formAction } className = "space-y-4" >
101104 < input type = "hidden" name = "action" value = "add" />
102105 < input type = "hidden" name = "title" value = { title } />
103106 < input type = "hidden" name = "query" value = { query } />
104107 < input type = "hidden" name = "config" value = { JSON . stringify ( config ) } />
105108
106- < div className = "space-y-2" >
109+ < div className = "!mt-1 space-y-2" >
107110 < Paragraph variant = "small" className = "text-text-dimmed" >
108- Select a dashboard to add this widget to:
111+ Select a dashboard to add this chart to:
109112 </ Paragraph >
110113 < div className = "max-h-64 space-y-1 overflow-y-auto" >
111114 { customDashboards . map ( ( dashboard ) => {
@@ -121,11 +124,11 @@ export function SaveToDashboardDialog({
121124 isAtLimit
122125 ? "cursor-not-allowed opacity-50"
123126 : selectedDashboardId === dashboard . friendlyId
124- ? "bg-charcoal-700 text-text-bright"
125- : "text-text-dimmed hover:bg-charcoal-750 hover:text-text-bright"
127+ ? "bg-charcoal-700 text-text-bright"
128+ : "text-text-dimmed hover:bg-charcoal-750 hover:text-text-bright"
126129 ) }
127130 >
128- < ChartBarSquareIcon className = "size-4 shrink-0 text-purple-500 " />
131+ < IconChartHistogram className = "size-4 shrink-0 text-text-dimmed " />
129132 < span className = "flex-1 truncate" > { dashboard . title } </ span >
130133 < span
131134 className = { cn (
@@ -153,7 +156,7 @@ export function SaveToDashboardDialog({
153156 }
154157 cancelButton = {
155158 < DialogClose asChild >
156- < Button variant = "tertiary /medium" > Cancel</ Button >
159+ < Button variant = "secondary /medium" > Cancel</ Button >
157160 </ DialogClose >
158161 }
159162 />
0 commit comments