42d3fedbaa
* fix(ci): fix release workflow artifact upload issue - Split artifact upload into 3 separate steps (Chrome, Firefox, Source) - Update download steps to match new artifact names - Add if-no-files-found: error for better error handling - Fix Node.js 20 compatibility issue with upload-artifact@v4 glob pattern * docs: 更新 AGENTS.md,添加测试工具和翻译文件结构说明 * docs: 更新 AGENTS.md,完善 CI 步骤和存储键名格式说明 * fix: remove unnecessary animations from StorageCleaner page - Remove entrance animations (animate-in, fade-in, zoom-in) from all components - Remove scale effect (active:scale-[0.99]) from clean button - Remove transition effects (transition-all, transition-colors) from OptionItem, StorageOptionsGrid, AutoRefreshToggle - Remove bouncing animation from error icon - Remove pulsing animation from warning banner - Keep animate-spin on button loading spinner as functional indicator * fix: remove unnecessary animations from RightClickRestorer page * fix: remove all unnecessary animations from all pages - Remove dead code animations (animate-in, fade-in, slide-in, zoom-in, shake) from tailwindcss-animate plugin (not installed) - Remove decorative transition effects (transition-all, transition-colors) from all page components - Remove scale effects (active:scale-95) from buttons - Remove bounce animations (animate-bounce) from icons - Keep functional animate-spin on loading spinners as they provide essential loading feedback Affected pages: Dashboard, Timestamp, Jwt, JsonTools, Base64Converter, HtmlToMarkdown, MarkdownToHtml, QrCode, TextStatistics --------- Co-authored-by: Ubuntu <ubuntu@localhost.localdomain>
44 lines
1.7 KiB
TypeScript
44 lines
1.7 KiB
TypeScript
import { useLazyTranslation } from '@/utils/useLazyTranslation';
|
|
import { useStorageState } from '@/utils/useStorageState';
|
|
import type { Base64ConverterPageMode } from '@/types/storage';
|
|
import TextMode from './TextMode';
|
|
import Base64ConverterSection from './Base64ConverterSection'; // ✅ 正确对接全新的一体化大组件
|
|
import SwitchButtonGroup from '@/components/SwitchButtonGroup';
|
|
|
|
const VALID_PAGE_MODES: readonly Base64ConverterPageMode[] = ['text', 'file', 'image'];
|
|
const isValidPageMode = (val: unknown): val is Base64ConverterPageMode =>
|
|
typeof val === 'string' && (VALID_PAGE_MODES as readonly string[]).includes(val);
|
|
|
|
type PageMode = Base64ConverterPageMode;
|
|
|
|
export default function Index() {
|
|
const { t } = useLazyTranslation('base64Converter');
|
|
const [pageMode, setPageMode] = useStorageState(
|
|
'base64Converter/pageMode',
|
|
'text',
|
|
isValidPageMode,
|
|
);
|
|
|
|
return (
|
|
<div className="p-4 w-full flex flex-col space-y-4 min-h-[520px] select-none">
|
|
<SwitchButtonGroup
|
|
value={pageMode}
|
|
options={[
|
|
{ value: 'text', label: t('base64Converter:textMode') },
|
|
{ value: 'file', label: t('base64Converter:fileMode') },
|
|
{ value: 'image', label: t('base64Converter:imageMode') },
|
|
]}
|
|
onChange={(value: PageMode) => setPageMode(value)}
|
|
size="small"
|
|
className="w-full sm:w-auto"
|
|
/>
|
|
|
|
<div className="w-full pt-1">
|
|
{pageMode === 'text' && <TextMode onSwitchToImageMode={() => setPageMode('image')} />}
|
|
{pageMode === 'file' && <Base64ConverterSection mode="file" />}
|
|
{pageMode === 'image' && <Base64ConverterSection mode="image" />}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|