From dbf10c1d025cef72eacd92bd5e6cbc85fc3eeedf Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 30 Dec 2025 00:58:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=E6=98=BE=E7=A4=BA=E5=B9=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=BD=91=E7=AB=99LOGO=E5=92=8C=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 恢复图片编辑器为全屏显示(fixed inset-0) - 标题栏显示网站LOGO和网站名(从系统设置获取) - 根据主题自动选择合适的LOGO(深色主题优先使用siteLogoDark) - 点击LOGO或网站名可跳转到首页 - 移除未使用的router导入 --- components/image-annotator.tsx | 48 +++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/components/image-annotator.tsx b/components/image-annotator.tsx index 5a1f8c948..9c6eb56f3 100644 --- a/components/image-annotator.tsx +++ b/components/image-annotator.tsx @@ -2,6 +2,8 @@ import React, { useRef, useState, useEffect, useCallback } from "react"; import { createPortal } from "react-dom"; +import Link from "next/link"; +import { useTheme } from "next-themes"; import { X, Pencil, Circle, ArrowRight, Type, Check, Undo, Trash2, Scissors, Sparkles, Download, Expand, Move, Maximize2, ZoomIn, ZoomOut, Loader2 } from "lucide-react"; import { Button } from "./ui/button"; import { Input } from "./ui/input"; @@ -83,6 +85,12 @@ export function ImageAnnotator({ imageUrl, onConfirm, onCancel, initialResizeMod const [isResizing, setIsResizing] = useState(false); // 尺寸调整处理中状态 const resizeCanvasRef = useRef(null); const resizeContainerRef = useRef(null); + + // 网站设置相关状态 + const [siteName, setSiteName] = useState("AI Chatbot"); + const [siteLogo, setSiteLogo] = useState(null); + const [siteLogoDark, setSiteLogoDark] = useState(null); + const { resolvedTheme } = useTheme(); // 比例选项定义 const aspectRatios = [ @@ -145,6 +153,18 @@ export function ImageAnnotator({ imageUrl, onConfirm, onCancel, initialResizeMod // 确保在客户端渲染 useEffect(() => { setMounted(true); + + // 获取网站设置 + fetch(`/api/site-settings?t=${Date.now()}`) + .then((res) => res.json()) + .then((data) => { + if (data.siteName) setSiteName(data.siteName); + if (data.siteLogo) setSiteLogo(data.siteLogo); + if (data.siteLogoDark) setSiteLogoDark(data.siteLogoDark); + }) + .catch((err) => { + console.error("[ImageAnnotator] Failed to fetch site settings:", err); + }); }, []); // 加载图片 @@ -965,20 +985,42 @@ export function ImageAnnotator({ imageUrl, onConfirm, onCancel, initialResizeMod onConfirm(dataUrl); }; + // 决定显示哪个 LOGO(根据主题) + const displayLogo = resolvedTheme === "dark" && siteLogoDark + ? siteLogoDark + : siteLogo; + // 弹窗内容 const modalContent = (
- {/* 弹窗容器 - 全屏显示(保留顶部导航栏) */} + {/* 弹窗容器 - 全屏显示 */}
e.stopPropagation()} > {/* 顶部标题栏 */}
- 图片编辑 + e.stopPropagation()} + > + {displayLogo ? ( + <> + {siteName} + {siteName} + + ) : ( + {siteName} + )} +