From 21e44cb889cc221290ecf5d1bcdab2e0153a6a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E9=9C=96=E9=93=83?= Date: Fri, 22 May 2026 20:51:57 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=20MUI=20sx=20?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=92=8C=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=20GlobalSnackbar=20=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entrypoints/options/App.tsx | 11 +++++------ pages/JsonTools/JsonConvertSection.tsx | 4 +--- pages/JsonTools/JsonDiffInput.tsx | 1 - pages/JsonTools/JsonFormatSection.tsx | 7 ++----- pages/Jwt/index.tsx | 5 +---- pages/QrCode/index.tsx | 8 +------- pages/TextStatistics/index.tsx | 1 - pages/Timestamp/index.tsx | 1 - 8 files changed, 10 insertions(+), 28 deletions(-) diff --git a/entrypoints/options/App.tsx b/entrypoints/options/App.tsx index 76be67a..121eeb9 100644 --- a/entrypoints/options/App.tsx +++ b/entrypoints/options/App.tsx @@ -1,13 +1,13 @@ import { SyntheticEvent, useEffect, useMemo, useState } from 'react'; -import { Settings, RefreshCw, GripVertical } from 'lucide-react'; +import { GripVertical, RefreshCw, Settings } from 'lucide-react'; import { - DndContext, closestCenter, - PointerSensor, + DndContext, + type DragEndEvent, KeyboardSensor, + PointerSensor, useSensor, useSensors, - type DragEndEvent, } from '@dnd-kit/core'; import { arrayMove, @@ -19,6 +19,7 @@ import { import { CSS } from '@dnd-kit/utilities'; import type { PageType, StorageSchema } from '@/types/storage'; import { storageUtil } from '@/utils/chromeStorage'; +import type { PaletteColorKey } from '@/config/features'; import { getAllFeatureKeys, getDefaultPageOrder, @@ -29,7 +30,6 @@ import GlobalSnackbar, { useSnackbarState } from '@/components/GlobalSnackbar'; import PageErrorBoundary from '@/components/PageErrorBoundary'; import PageHeader from '@/components/PageHeader'; import { useTranslation } from 'react-i18next'; -import type { PaletteColorKey } from '@/config/features'; const PALETTE_COLORS: Record = { primary: '#1976d2', @@ -322,7 +322,6 @@ export default function App() { iconColor="#1976d2" title="应用设置" subtitle="针对不同窗口类型独立配置 Dashboard 中显示的功能及其排序" - sx={{ marginBottom: '1rem' }} /> {/* Tab 与恢复按钮同行 */}
diff --git a/pages/JsonTools/JsonConvertSection.tsx b/pages/JsonTools/JsonConvertSection.tsx index 5918d24..fc9ecfa 100644 --- a/pages/JsonTools/JsonConvertSection.tsx +++ b/pages/JsonTools/JsonConvertSection.tsx @@ -2,7 +2,6 @@ import { useEffect, useMemo, useState } from 'react'; import { Button } from '@/components/ui/button'; import { useLazyTranslation } from '@/utils/useLazyTranslation'; import { formatByteSize } from '@/utils/textStatistics'; -import { useSnackbar } from '@/components/GlobalSnackbar'; import CopyButton from '@/components/CopyButton'; import TextInputArea from '@/components/TextInputArea'; import { validateJson } from '@/utils/jsonFormatter'; @@ -44,7 +43,6 @@ export default function JsonConvertSection({ convertButtonKey = 'convertButton', }: JsonConvertSectionProps) { const { t } = useLazyTranslation('jsonFormat'); - const { showMessage } = useSnackbar(); const [input, setInput] = useState(''); const [error, setError] = useState(null); @@ -134,7 +132,7 @@ export default function JsonConvertSection({ {t('jsonFormat:formattedSize')}: {formatByteSize(result.outputBytes)}
- + {/* 转换内容 */} diff --git a/pages/JsonTools/JsonDiffInput.tsx b/pages/JsonTools/JsonDiffInput.tsx index bb9c885..590ad42 100644 --- a/pages/JsonTools/JsonDiffInput.tsx +++ b/pages/JsonTools/JsonDiffInput.tsx @@ -25,7 +25,6 @@ export default function JsonDiffInput({ onChange={onChange} placeholder={placeholder} minRows={8} - autoResize={false} externalError={error ?? undefined} showClear={true} /> diff --git a/pages/JsonTools/JsonFormatSection.tsx b/pages/JsonTools/JsonFormatSection.tsx index 437b199..ad13b62 100644 --- a/pages/JsonTools/JsonFormatSection.tsx +++ b/pages/JsonTools/JsonFormatSection.tsx @@ -3,12 +3,11 @@ import { Button } from '@/components/ui/button'; import { useLazyTranslation } from '@/utils/useLazyTranslation'; import { formatJson, - validateJson, type JsonFormatOptions, type JsonFormatResult, + validateJson, } from '@/utils/jsonFormatter'; import { formatByteSize } from '@/utils/textStatistics'; -import { useSnackbar } from '@/components/GlobalSnackbar'; import CopyButton from '@/components/CopyButton'; import SwitchButtonGroup from '@/components/SwitchButtonGroup'; @@ -23,7 +22,6 @@ const INDENT_OPTIONS = [2, 4, 6, 8] as const; */ export default function JsonFormatSection() { const { t } = useLazyTranslation('jsonFormat'); - const { showMessage } = useSnackbar(); const [input, setInput] = useState(''); const [error, setError] = useState(null); @@ -80,7 +78,6 @@ export default function JsonFormatSection() { value={indentSize} onChange={(v) => setIndentSize(v)} options={INDENT_OPTIONS.map((size) => ({ value: size, label: String(size) }))} - sx={{ width: 'auto', marginBottom: 0, flexShrink: 0 }} size="small" /> @@ -145,7 +142,7 @@ export default function JsonFormatSection() { {t('jsonFormat:formattedSize')}: {formatByteSize(result.formattedBytes)} - + {/* 格式化内容 */} diff --git a/pages/Jwt/index.tsx b/pages/Jwt/index.tsx index 02b6a14..929f37a 100644 --- a/pages/Jwt/index.tsx +++ b/pages/Jwt/index.tsx @@ -1,8 +1,7 @@ import { useCallback, useMemo, useState } from 'react'; import { Key } from 'lucide-react'; -import { useSnackbar } from '@/components/GlobalSnackbar'; import PageHeader from '@/components/PageHeader'; -import { stringifyJson, parseJwt } from '@/utils/jwt'; +import { parseJwt, stringifyJson } from '@/utils/jwt'; import CopyButton from '@/components/CopyButton'; import TextInputArea from '@/components/TextInputArea'; import { useLazyTranslation } from '@/utils/useLazyTranslation'; @@ -40,7 +39,6 @@ const Section = ({ title, content, color }: SectionProps) => { }; export default function Index() { - const { showMessage } = useSnackbar(); const { t } = useLazyTranslation('jwt'); const [jwtInput, setJwtInput] = useState(''); @@ -75,7 +73,6 @@ export default function Index() { }} allowCopy={true} showClear={true} - showMessage={showMessage} externalError={result?.error} /> diff --git a/pages/QrCode/index.tsx b/pages/QrCode/index.tsx index 7209baf..8862882 100644 --- a/pages/QrCode/index.tsx +++ b/pages/QrCode/index.tsx @@ -28,15 +28,9 @@ export default function Index() { subtitle={t('qrCode:pageSubtitle')} icon={} iconColor={qrCodePageStyles.primaryColor} - sx={{ marginBottom: '0.625rem' }} /> - + {qrCode.mode === 'generate' ? : } diff --git a/pages/TextStatistics/index.tsx b/pages/TextStatistics/index.tsx index fc46b4c..9f44c9d 100644 --- a/pages/TextStatistics/index.tsx +++ b/pages/TextStatistics/index.tsx @@ -52,7 +52,6 @@ export default function Index() { minRows={8} maxRows={15} showClear={false} - sx={{ marginBottom: '0.75rem' }} /> {/* 统计结果展示区域 */} diff --git a/pages/Timestamp/index.tsx b/pages/Timestamp/index.tsx index b465625..3ae1a16 100644 --- a/pages/Timestamp/index.tsx +++ b/pages/Timestamp/index.tsx @@ -77,7 +77,6 @@ export default function Index() { { value: 's', label: t('timestamp:unitS') }, ]} onChange={(v) => setUnit(v as 'ms' | 's')} - sx={{ width: 'auto', marginBottom: 0, flexShrink: 0 }} size="small" />