mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-03 03:18:52 +00:00
Upstream sync from shadcn-ui/ui (1686 commits since last merge base). Key changes: - packages/shadcn upgraded to 4.1.0 (CLI font transformers, scaffold from github, chart colors) - apps/v4 replaces apps/www as the primary docs/registry app - Font system: 25+ heading font registries, font markers utility, @supports override - Chart improvements: recharts v3 compat, radial chart fixes - templates/ updated with monorepo variants (astro, vite, react-router, start) - skills/shadcn AI skill definitions added - deprecated/ removed (auth, auth-firebase, cli, www) Preserved Hanzo-only paths: app/, pkg/, demo/, docs/, template/next/
122 lines
4.0 KiB
TypeScript
122 lines
4.0 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { MoreHorizontal } from "lucide-react"
|
|
import { toast } from "sonner"
|
|
|
|
import {
|
|
AlertDialog,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogTitle,
|
|
} from "@/registry/new-york-v4/ui/alert-dialog"
|
|
import { Button } from "@/registry/new-york-v4/ui/button"
|
|
import {
|
|
Dialog,
|
|
DialogClose,
|
|
DialogContent,
|
|
DialogDescription,
|
|
DialogFooter,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
} from "@/registry/new-york-v4/ui/dialog"
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuTrigger,
|
|
} from "@/registry/new-york-v4/ui/dropdown-menu"
|
|
import { Label } from "@/registry/new-york-v4/ui/label"
|
|
import { Switch } from "@/registry/new-york-v4/ui/switch"
|
|
|
|
export function PresetActions() {
|
|
const [open, setIsOpen] = React.useState(false)
|
|
const [showDeleteDialog, setShowDeleteDialog] = React.useState(false)
|
|
|
|
return (
|
|
<>
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button variant="secondary" size="icon">
|
|
<span className="sr-only">Actions</span>
|
|
<MoreHorizontal />
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="end">
|
|
<DropdownMenuItem onSelect={() => setIsOpen(true)}>
|
|
Content filter preferences
|
|
</DropdownMenuItem>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuItem
|
|
onSelect={() => setShowDeleteDialog(true)}
|
|
className="text-red-600"
|
|
>
|
|
Delete preset
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
<Dialog open={open} onOpenChange={setIsOpen}>
|
|
<DialogContent>
|
|
<DialogHeader>
|
|
<DialogTitle>Content filter preferences</DialogTitle>
|
|
<DialogDescription>
|
|
The content filter flags text that may violate our content policy.
|
|
It's powered by our moderation endpoint which is free to use
|
|
to moderate your OpenAI API traffic. Learn more.
|
|
</DialogDescription>
|
|
</DialogHeader>
|
|
<div className="py-6">
|
|
<h4 className="text-sm text-muted-foreground">
|
|
Playground Warnings
|
|
</h4>
|
|
<div className="flex items-start justify-between gap-4 pt-3">
|
|
<Switch name="show" id="show" defaultChecked={true} />
|
|
<Label className="grid gap-1 font-normal" htmlFor="show">
|
|
<span className="font-semibold">
|
|
Show a warning when content is flagged
|
|
</span>
|
|
<span className="text-sm text-muted-foreground">
|
|
A warning will be shown when sexual, hateful, violent or
|
|
self-harm content is detected.
|
|
</span>
|
|
</Label>
|
|
</div>
|
|
</div>
|
|
<DialogFooter>
|
|
<DialogClose asChild>
|
|
<Button variant="secondary">Close</Button>
|
|
</DialogClose>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
<AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>
|
|
<AlertDialogContent>
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
This action cannot be undone. This preset will no longer be
|
|
accessible by you or others you've shared it with.
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
<Button
|
|
variant="destructive"
|
|
onClick={() => {
|
|
setShowDeleteDialog(false)
|
|
toast.success("This preset has been deleted.")
|
|
}}
|
|
>
|
|
Delete
|
|
</Button>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
</>
|
|
)
|
|
}
|