fix(browser): 导入被搁置态的操作收纳——提示条在上,按钮集中底部一行

This commit is contained in:
Rick Ye
2026-09-11 19:08:02 +08:00
parent 09cc5bf648
commit 95044c3a15
2 changed files with 18 additions and 15 deletions
@@ -443,7 +443,7 @@ export async function importBrowserProfile(sourceId: string, profileDir: string)
applyStagedLocalStorage(staging)
} catch (err2) {
// 理论不可达(clearStorageData 已释放句柄);兜底:整体转待办,重启应用后完成
const deferredNote = '受管浏览器数据正被占用,已计划在重启应用后自动完成导入。'
const deferredNote = '已暂存导入任务:点击下方「重启并完成导入」即可生效。'
mkdirSync(join(app.getPath('userData'), 'Partitions'), { recursive: true })
rmSync(pendingDir(), { recursive: true, force: true })
writeFileSync(
@@ -481,7 +481,7 @@ export async function importBrowserProfile(sourceId: string, profileDir: string)
rmSync(staging, { recursive: true, force: true })
throw new Error(`导入写入失败: ${err instanceof Error ? err.message : String(err)}`)
}
const deferredNote = 'LocalStorage 已生效;Cookie 数据将在重启应用后自动完成迁移。'
const deferredNote = 'LocalStorage 已生效;点击「重启并完成导入」补上 Cookie。'
mkdirSync(join(app.getPath('userData'), 'Partitions'), { recursive: true })
rmSync(pendingDir(), { recursive: true, force: true })
writeFileSync(
@@ -118,17 +118,6 @@ export function BrowserImportForm(): JSX.Element {
{error && (
<div className="mt-3 rounded border border-red/40 bg-red-tint px-2.5 py-2 text-[11.5px] text-red">{error}</div>
)}
{result?.deferred && (
<div className="mt-3 flex items-center justify-end">
<button
type="button"
onClick={() => void window.api.appRelaunch()}
className="rounded bg-accent px-3.5 py-1.5 text-[12px] font-medium text-page transition-opacity hover:opacity-90"
>
重启并完成导入
</button>
</div>
)}
{result && (
<div
className={`mt-3 rounded border px-2.5 py-2 text-[11.5px] leading-relaxed ${
@@ -139,12 +128,26 @@ export function BrowserImportForm(): JSX.Element {
</div>
)}
<div className="mt-3 flex items-center justify-end">
{/* 操作区:始终集中在底部一行;被搁置时以「重启并完成导入」为主操作 */}
<div className="mt-3 flex items-center justify-end gap-2">
{result?.deferred && (
<button
type="button"
onClick={() => void window.api.appRelaunch()}
className="rounded bg-accent px-3.5 py-1.5 text-[12px] font-medium text-page transition-opacity hover:opacity-90"
>
重启并完成导入
</button>
)}
<button
type="button"
disabled={!selected || busy}
onClick={runImport}
className="rounded bg-accent px-3.5 py-1.5 text-[12px] font-medium text-page transition-opacity hover:opacity-90 disabled:opacity-40"
className={`rounded px-3.5 py-1.5 text-[12px] transition-colors disabled:opacity-40 ${
result?.deferred
? 'border border-line-strong text-ink-2 hover:bg-hover hover:text-ink'
: 'bg-accent font-medium text-page hover:opacity-90'
}`}
>
{busy ? '导入中…' : '导入浏览器数据'}
</button>