refactor: 移除 MUI sx 样式和未使用的 GlobalSnackbar 引用
This commit is contained in:
@@ -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>
|
||||
|
||||
{/* 转换内容 */}
|
||||
|
||||
@@ -25,7 +25,6 @@ export default function JsonDiffInput({
|
||||
onChange={onChange}
|
||||
placeholder={placeholder}
|
||||
minRows={8}
|
||||
autoResize={false}
|
||||
externalError={error ?? undefined}
|
||||
showClear={true}
|
||||
/>
|
||||
|
||||
@@ -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
@@ -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}
|
||||
/>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -52,7 +52,6 @@ export default function Index() {
|
||||
minRows={8}
|
||||
maxRows={15}
|
||||
showClear={false}
|
||||
sx={{ marginBottom: '0.75rem' }}
|
||||
/>
|
||||
|
||||
{/* 统计结果展示区域 */}
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user