modified: src/components/ui/dropdown-menu.tsx

This commit is contained in:
Anderson 2026-01-18 02:39:17 +00:00 committed by GitHub
parent 751f6ae7cd
commit 02265d3a29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 97 additions and 11 deletions

View file

@ -37,7 +37,9 @@ const buttonVariants = cva(
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
asChild?: boolean;
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
size?: "default" | "sm" | "lg" | "icon";
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(

View file

@ -53,4 +53,64 @@ const DialogContent = React.forwardRef<
))
DialogContent.displayName = DialogPrimitive.Content.displayName
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent }
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-header"
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
{...props}
/>
)
}
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-footer"
className={cn(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
className
)}
{...props}
/>
)
}
function DialogTitle({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
return (
<DialogPrimitive.Title
data-slot="dialog-title"
className={cn("text-lg leading-none font-semibold", className)}
{...props}
/>
)
}
function DialogDescription({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
return (
<DialogPrimitive.Description
data-slot="dialog-description"
className={cn("text-muted-foreground text-sm", className)}
{...props}
/>
)
}
export {
Dialog,
DialogPortal,
DialogOverlay,
DialogClose,
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
};

View file

@ -60,6 +60,18 @@ const DropdownMenuSeparator = React.forwardRef<
))
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
const DropdownMenuLabel = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label>
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.Label
ref={ref}
className={cn("px-2 py-1.5 text-sm font-semibold", className)}
{...props}
/>
));
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
export {
DropdownMenu,
DropdownMenuTrigger,
@ -70,4 +82,5 @@ export {
DropdownMenuPortal,
DropdownMenuSub,
DropdownMenuRadioGroup,
DropdownMenuLabel,
}

View file

@ -241,6 +241,7 @@ function DropdownMenuSubContent({
}
export {
DropdownMenu,
DropdownMenu,
DropdownMenuPortal,
DropdownMenuTrigger,
@ -254,6 +255,14 @@ export {
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuSub,
DropdownMenuSubTrigger,
DropdownMenuSubContent,
}
DropdownMenuSubTrigger,
DropdownMenuItem,
DropdownMenuCheckboxItem,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,

View file

@ -15,6 +15,8 @@ export function getTemplatesForPlatform(platform: PlatformId): ScriptTemplate[]
return templates.filter(t => t.platform === platform);
}
export { getTemplatesForPlatform };
const robloxTemplates: ScriptTemplate[] = [
{
id: 'hello-world',

View file

@ -5,7 +5,7 @@
import { PlatformId, getPlatform } from './platforms';
import { toast } from 'sonner';
import { captureEvent, captureError } from './analytics';
import { trackEvent, trackError } from './analytics';
export interface TranslationRequest {
sourceCode: string;
@ -199,7 +199,7 @@ async function translateWithClaudeAPI(
const result = parseClaudeResponse(content, request.targetPlatform);
return result;
} catch (error) {
captureError(error as Error, {
trackError(error as Error, {
context: 'translation_api',
sourcePlatform: request.sourcePlatform,
targetPlatform: request.targetPlatform,
@ -292,7 +292,7 @@ export async function translateCode(
}
// Log translation attempt
captureEvent('translation_started', {
trackEvent('translation_started', {
sourcePlatform: request.sourcePlatform,
targetPlatform: request.targetPlatform,
codeLength: request.sourceCode.length,
@ -303,7 +303,7 @@ export async function translateCode(
// Log result
if (result.success) {
captureEvent('translation_success', {
trackEvent('translation_success', {
sourcePlatform: request.sourcePlatform,
targetPlatform: request.targetPlatform,
});
@ -311,7 +311,7 @@ export async function translateCode(
`Translated ${request.sourcePlatform}${request.targetPlatform}`
);
} else {
captureEvent('translation_failed', {
trackEvent('translation_failed', {
sourcePlatform: request.sourcePlatform,
targetPlatform: request.targetPlatform,
error: result.error,
@ -321,7 +321,7 @@ export async function translateCode(
return result;
} catch (error) {
captureError(error as Error, { context: 'translate_code' });
trackError(error as Error, { context: 'translate_code' });
return {
success: false,
error: `Unexpected error: ${(error as Error).message}`,