Files
tweakcn/components/editor/code-panel-dialog.tsx
Sahaj Jain 107b9405d0 fix: show registry command on theme view page
The code panel on /themes/[id] incorrectly showed "Save your theme to
get the registry command" because it relied on the editor store's preset
field, which isn't set when viewing a theme page. Pass themeId through
to CodePanel so it always shows the registry command for saved themes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 17:56:34 +05:30

35 lines
1.3 KiB
TypeScript

import CodePanel from "./code-panel";
import { ThemeEditorState } from "@/types/editor";
import {
ResponsiveDialog,
ResponsiveDialogContent,
ResponsiveDialogDescription,
ResponsiveDialogHeader,
ResponsiveDialogTitle,
} from "@/components/ui/revola";
interface CodePanelDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
themeEditorState: ThemeEditorState;
themeId?: string;
}
export function CodePanelDialog({ open, onOpenChange, themeEditorState, themeId }: CodePanelDialogProps) {
return (
<ResponsiveDialog open={open} onOpenChange={onOpenChange}>
<ResponsiveDialogContent className="h-[90dvh] max-h-[90dvh] overflow-hidden shadow-lg sm:h-[80dvh] sm:max-h-[min(700px,90dvh)] sm:w-[calc(100%-2rem)] sm:max-w-4xl">
<div className="h-full space-y-6 overflow-auto px-6 pb-6 sm:py-6">
<ResponsiveDialogHeader className="sr-only">
<ResponsiveDialogTitle>Theme Code</ResponsiveDialogTitle>
<ResponsiveDialogDescription>
View and copy the code for your theme.
</ResponsiveDialogDescription>
</ResponsiveDialogHeader>
<CodePanel themeEditorState={themeEditorState} themeId={themeId} />
</div>
</ResponsiveDialogContent>
</ResponsiveDialog>
);
}