refactor: 移除 MUI sx 样式和未使用的 GlobalSnackbar 引用

This commit is contained in:
雨霖铃
2026-05-22 20:51:57 +08:00
parent b3dd7146ad
commit 21e44cb889
8 changed files with 10 additions and 28 deletions
+1 -3
View File
@@ -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<string | null>(null);
@@ -134,7 +132,7 @@ export default function JsonConvertSection({
{t('jsonFormat:formattedSize')}: {formatByteSize(result.outputBytes)}
</span>
</div>
<CopyButton text={result.output} showMessage={showMessage} />
<CopyButton text={result.output} />
</div>
{/* 转换内容 */}
-1
View File
@@ -25,7 +25,6 @@ export default function JsonDiffInput({
onChange={onChange}
placeholder={placeholder}
minRows={8}
autoResize={false}
externalError={error ?? undefined}
showClear={true}
/>
+2 -5
View File
@@ -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<string | null>(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)}
</span>
</div>
<CopyButton text={result.formatted} showMessage={showMessage} />
<CopyButton text={result.formatted} />
</div>
{/* 格式化内容 */}
+1 -4
View File
@@ -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}
/>
+1 -7
View File
@@ -28,15 +28,9 @@ export default function Index() {
subtitle={t('qrCode:pageSubtitle')}
icon={<QrCode />}
iconColor={qrCodePageStyles.primaryColor}
sx={{ marginBottom: '0.625rem' }}
/>
<SwitchButtonGroup
value={qrCode.mode}
options={modeOptions}
onChange={qrCode.setMode}
sx={{ marginBottom: '0.75rem' }}
/>
<SwitchButtonGroup value={qrCode.mode} options={modeOptions} onChange={qrCode.setMode} />
{qrCode.mode === 'generate' ? <GeneratePanel /> : <ParsePanel />}
</div>
-1
View File
@@ -52,7 +52,6 @@ export default function Index() {
minRows={8}
maxRows={15}
showClear={false}
sx={{ marginBottom: '0.75rem' }}
/>
{/* 统计结果展示区域 */}
-1
View File
@@ -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"
/>