Skip to content

Commit a2d991d

Browse files
committed
fix: add alert-dialog component and radix dependency
bun add @radix-ui/react-alert-dialog Add alert-dialog.tsx shadcn component (was missing from ui/) Fixes Docker build failure in APIKeysPage
1 parent c93f95c commit a2d991d

3 files changed

Lines changed: 95 additions & 0 deletions

File tree

frontend/bun.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@radix-ui/react-accordion": "^1.2.12",
18+
"@radix-ui/react-alert-dialog": "^1.1.15",
1819
"@radix-ui/react-avatar": "^1.1.11",
1920
"@radix-ui/react-checkbox": "^1.3.3",
2021
"@radix-ui/react-collapsible": "^1.1.12",
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import * as React from 'react'
2+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
3+
import { cn } from '@/lib/utils'
4+
import { buttonVariants } from '@/components/ui/button'
5+
6+
const AlertDialog = AlertDialogPrimitive.Root
7+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
8+
const AlertDialogPortal = AlertDialogPrimitive.Portal
9+
10+
const AlertDialogOverlay = React.forwardRef<
11+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
12+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
13+
>(({ className, ...props }, ref) => (
14+
<AlertDialogPrimitive.Overlay
15+
className={cn(
16+
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
17+
className
18+
)}
19+
{...props}
20+
ref={ref}
21+
/>
22+
))
23+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
24+
25+
const AlertDialogContent = React.forwardRef<
26+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
27+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
28+
>(({ className, ...props }, ref) => (
29+
<AlertDialogPortal>
30+
<AlertDialogOverlay />
31+
<AlertDialogPrimitive.Content
32+
ref={ref}
33+
className={cn(
34+
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
35+
className
36+
)}
37+
{...props}
38+
/>
39+
</AlertDialogPortal>
40+
))
41+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
42+
43+
const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
44+
<div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />
45+
)
46+
AlertDialogHeader.displayName = 'AlertDialogHeader'
47+
48+
const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
49+
<div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />
50+
)
51+
AlertDialogFooter.displayName = 'AlertDialogFooter'
52+
53+
const AlertDialogTitle = React.forwardRef<
54+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
55+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
56+
>(({ className, ...props }, ref) => (
57+
<AlertDialogPrimitive.Title ref={ref} className={cn('text-lg font-semibold', className)} {...props} />
58+
))
59+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
60+
61+
const AlertDialogDescription = React.forwardRef<
62+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
63+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
64+
>(({ className, ...props }, ref) => (
65+
<AlertDialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
66+
))
67+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName
68+
69+
const AlertDialogAction = React.forwardRef<
70+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
71+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
72+
>(({ className, ...props }, ref) => (
73+
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
74+
))
75+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
76+
77+
const AlertDialogCancel = React.forwardRef<
78+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
79+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
80+
>(({ className, ...props }, ref) => (
81+
<AlertDialogPrimitive.Cancel ref={ref} className={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)} {...props} />
82+
))
83+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
84+
85+
export {
86+
AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger,
87+
AlertDialogContent, AlertDialogHeader, AlertDialogFooter,
88+
AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel,
89+
}

0 commit comments

Comments
 (0)