mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-07 10:17:47 +08:00
fix:resolve the Copilot-suggested changes
This commit is contained in:
+5
-11
@@ -11,19 +11,13 @@ import {
|
||||
ResizablePanelGroup,
|
||||
} from "@/components/ui/resizable"
|
||||
import { useDiagram } from "@/contexts/diagram-context"
|
||||
import {
|
||||
DEFAULT_DRAWIO_THEME,
|
||||
DRAWIO_THEMES,
|
||||
type DrawioTheme,
|
||||
} from "@/lib/drawio-themes"
|
||||
import { i18n, type Locale } from "@/lib/i18n/config"
|
||||
|
||||
// Draw.io UI themes
|
||||
export type DrawioTheme = "kennedy" | "simple" | "min" | "sketch" | "atlas"
|
||||
export const DRAWIO_THEMES: DrawioTheme[] = [
|
||||
"kennedy",
|
||||
"simple",
|
||||
"min",
|
||||
"sketch",
|
||||
"atlas",
|
||||
]
|
||||
const DEFAULT_DRAWIO_THEME: DrawioTheme = "min"
|
||||
|
||||
const drawioBaseUrl =
|
||||
process.env.NEXT_PUBLIC_DRAWIO_BASE_URL || "https://embed.diagrams.net"
|
||||
|
||||
|
||||
@@ -399,8 +399,3 @@
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix for iframe touch events in Chrome */
|
||||
.diagrams-iframe {
|
||||
touch-action: auto;
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ interface ChatMessage {
|
||||
interface ChatPanelProps {
|
||||
isVisible: boolean
|
||||
onToggleVisibility: () => void
|
||||
drawioUi: import("@/app/[lang]/page").DrawioTheme
|
||||
onDrawioUiChange: (theme: import("@/app/[lang]/page").DrawioTheme) => void
|
||||
drawioUi: import("@/lib/drawio-themes").DrawioTheme
|
||||
onDrawioUiChange: (theme: import("@/lib/drawio-themes").DrawioTheme) => void
|
||||
darkMode: boolean
|
||||
onToggleDarkMode: () => void
|
||||
isMobile?: boolean
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import { Github, Info, Moon, Sun, Tag } from "lucide-react"
|
||||
import { usePathname, useRouter, useSearchParams } from "next/navigation"
|
||||
import { Suspense, useEffect, useState } from "react"
|
||||
import { DRAWIO_THEMES, type DrawioTheme } from "@/app/[lang]/page"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
Dialog,
|
||||
@@ -24,6 +23,7 @@ import {
|
||||
import { Switch } from "@/components/ui/switch"
|
||||
import { useDictionary } from "@/hooks/use-dictionary"
|
||||
import { getApiEndpoint } from "@/lib/base-path"
|
||||
import type { DrawioTheme } from "@/lib/drawio-themes"
|
||||
import { i18n, type Locale } from "@/lib/i18n/config"
|
||||
|
||||
// Reusable setting item component for consistent layout
|
||||
@@ -57,6 +57,18 @@ const LANGUAGE_LABELS: Record<Locale, string> = {
|
||||
ja: "日本語",
|
||||
}
|
||||
|
||||
// Mapping of Draw.io theme values to their translation dictionary keys
|
||||
const DRAWIO_THEME_LABELS: Record<
|
||||
DrawioTheme,
|
||||
keyof typeof DRAWIO_THEMES | string
|
||||
> = {
|
||||
kennedy: "classic",
|
||||
simple: "simple",
|
||||
min: "minimal",
|
||||
sketch: "sketch",
|
||||
atlas: "atlas",
|
||||
}
|
||||
|
||||
interface SettingsDialogProps {
|
||||
open: boolean
|
||||
onOpenChange: (open: boolean) => void
|
||||
@@ -330,21 +342,17 @@ function SettingsContent({
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="kennedy">
|
||||
{dict.settings.themes.classic}
|
||||
</SelectItem>
|
||||
<SelectItem value="simple">
|
||||
{dict.settings.themes.simple}
|
||||
</SelectItem>
|
||||
<SelectItem value="min">
|
||||
{dict.settings.themes.minimal}
|
||||
</SelectItem>
|
||||
<SelectItem value="sketch">
|
||||
{dict.settings.themes.sketch}
|
||||
</SelectItem>
|
||||
<SelectItem value="atlas">
|
||||
{dict.settings.themes.atlas}
|
||||
</SelectItem>
|
||||
{DRAWIO_THEMES.map((theme) => (
|
||||
<SelectItem key={theme} value={theme}>
|
||||
{
|
||||
dict.settings.themes[
|
||||
DRAWIO_THEME_LABELS[
|
||||
theme
|
||||
] as keyof typeof dict.settings.themes
|
||||
]
|
||||
}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</SettingItem>
|
||||
|
||||
Reference in New Issue
Block a user