mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-30 10:35:54 +08:00
3a21891f84
- handleBrowse 改用 @tauri-apps/plugin-dialog 原生目录选择 - handleImport 清理临时 DOM 元素(add input.remove()) - config/default.json 实际导入生效(maxHistory、path 长度限制) - app-store.ts 长度检查改用配置值 - 删除 AppShell 中与 store 重复的长度检查 - 新增 ErrorBoundary 组件避免单异常白屏 - StatusBar 加载失败时显示重试按钮 - 取消按钮检查 isModified 未保存提示 - lib.rs 注册 tauri-plugin-dialog - tsconfig 添加 resolveJsonModule - CLAUDE.md 添加 cargo test 运行时说明 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
import { useAppStore } from '@/store/app-store';
|
|
import { useThemeStore } from '@/store/theme-store';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
export function StatusBar() {
|
|
const { t } = useTranslation();
|
|
const statusMessage = useAppStore((s) => s.statusMessage);
|
|
const isLoading = useAppStore((s) => s.isLoading);
|
|
const isAdmin = useAppStore((s) => s.isAdmin);
|
|
const isModified = useAppStore((s) => s.isModified);
|
|
const isDark = useThemeStore((s) => s.isDark);
|
|
const hasError = statusMessage.includes(t('status.error'));
|
|
|
|
return (
|
|
<footer
|
|
className="flex items-center justify-between px-4 py-1 text-xs border-t select-none"
|
|
style={{
|
|
borderColor: 'var(--app-border)',
|
|
backgroundColor: 'var(--app-list-bg)',
|
|
color: 'var(--app-fg)',
|
|
}}
|
|
>
|
|
<div className="flex items-center gap-2">
|
|
<span>{isLoading ? t('status.loading') : statusMessage}</span>
|
|
{hasError && !isLoading && (
|
|
<button
|
|
className="px-2 py-0.5 rounded border text-xs"
|
|
style={{ borderColor: 'var(--app-border)' }}
|
|
onClick={() => useAppStore.getState().loadPaths()}
|
|
>
|
|
{t('button.retry')}
|
|
</button>
|
|
)}
|
|
</div>
|
|
<div className="flex gap-3">
|
|
{isModified && <span className="text-yellow-500">● {t('status.modified')}</span>}
|
|
{!isAdmin && <span className="text-yellow-500">{t('status.readonly_label')}</span>}
|
|
<span style={{ opacity: 0.5 }}>{isDark ? t('status.dark') : t('status.light')}</span>
|
|
</div>
|
|
</footer>
|
|
);
|
|
}
|