[116] Exporte atomar (Tauri save_export), Electron speichert Projekte atomar im Hauptprozess, Wiederherstellung aus .obp~ (Öffnen-Angebot + Datei-Menü)
This commit is contained in:
22 files changed
+755
-29
No files matched your search
@@ -35,6 +35,7 @@ import { ImageExportDialogHost } from "./ImageExportDialog";
|
||||
import { ShortcutOverviewDialogHost } from "./ShortcutOverviewDialog";
|
||||
import { PromptDialog } from "./PromptDialog";
|
||||
import { RecoverAutosaveDialog } from "./RecoverAutosaveDialog";
|
||||
import { BackupOfferDialog } from "./BackupOfferDialog";
|
||||
import { ResourceManager, type ResourceManagerHandlers } from "./ResourceManager";
|
||||
import { SettingsDialog } from "./SettingsDialog";
|
||||
import { UnsavedChangesDialog } from "./UnsavedChangesDialog";
|
||||
@@ -113,6 +114,9 @@ export function AppDialogs(props: {
|
||||
onRecoverLater,
|
||||
lockConflict,
|
||||
setLockConflict,
|
||||
backupOffer,
|
||||
onBackupOfferAccept,
|
||||
onBackupOfferCancel,
|
||||
pendingDiscard,
|
||||
setPendingDiscard,
|
||||
loadImportLayout,
|
||||
@@ -263,6 +267,14 @@ export function AppDialogs(props: {
|
||||
onLater={onRecoverLater}
|
||||
/>
|
||||
)}
|
||||
{backupOffer && (
|
||||
<BackupOfferDialog
|
||||
path={backupOffer.path}
|
||||
error={backupOffer.error}
|
||||
onAccept={onBackupOfferAccept}
|
||||
onCancel={onBackupOfferCancel}
|
||||
/>
|
||||
)}
|
||||
{lockConflict && (
|
||||
<LockConflictDialog
|
||||
info={lockConflict.info}
|
||||
|
||||
@@ -25,6 +25,8 @@ export interface AppMenuBarProps {
|
||||
onOpenProject: () => void;
|
||||
onSaveProject: () => void;
|
||||
onSaveProjectAs: () => void;
|
||||
/** Datei: vorige Fassung (.obp~) der aktuellen Datei wiederherstellen ([116]). */
|
||||
onRestoreBackup: () => void;
|
||||
onImport: () => void;
|
||||
/** Datei: Punktwolke importieren ([27]). */
|
||||
onImportPointCloud?: () => void;
|
||||
@@ -72,6 +74,7 @@ export const AppMenuBar = memo(function AppMenuBar({
|
||||
onOpenProject,
|
||||
onSaveProject,
|
||||
onSaveProjectAs,
|
||||
onRestoreBackup,
|
||||
onImport,
|
||||
onImportPointCloud,
|
||||
onImportMesh,
|
||||
@@ -107,6 +110,7 @@ export const AppMenuBar = memo(function AppMenuBar({
|
||||
{ label: t("file.open"), onSelect: onOpenProject },
|
||||
{ label: t("file.save"), onSelect: onSaveProject },
|
||||
{ label: t("menu.native.saveAs"), onSelect: onSaveProjectAs },
|
||||
{ label: t("menu.native.restoreBackup"), onSelect: onRestoreBackup },
|
||||
{ divider: true },
|
||||
{ label: t("file.import"), onSelect: onImport },
|
||||
...(onImportPointCloud ? [{ label: t("menu.native.importPointCloud"), onSelect: onImportPointCloud }] : []),
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// Angebot „Vorige Fassung (.obp~) öffnen" ([116]): die gewählte Projektdatei liess sich nicht laden, ihre Sicherung
|
||||
// aus dem vorletzten Speichern schon. Overlay-Dialog wie `RecoverAutosaveDialog` (kein `window.confirm`).
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
|
||||
export interface BackupOfferDialogProps {
|
||||
/** Pfad der Projektdatei, die sich nicht laden liess. */
|
||||
path: string;
|
||||
/** Fehlermeldung beim Laden. */
|
||||
error: string;
|
||||
onAccept: () => void;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
export function BackupOfferDialog({ path, error, onAccept, onCancel }: BackupOfferDialogProps) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onCancel();
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [onCancel]);
|
||||
|
||||
const name = path.split(/[\\/]/).pop() ?? path;
|
||||
|
||||
return (
|
||||
<div className="imp-overlay recover-overlay" onClick={onCancel}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
ref={dialogRef}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("backup.offer.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<header className="imp-head">
|
||||
<span className="imp-head-title">{t("backup.offer.title")}</span>
|
||||
<button className="imp-close" onClick={onCancel} aria-label={t("export.close")}>
|
||||
×
|
||||
</button>
|
||||
</header>
|
||||
<div className="imp-body">
|
||||
<section className="imp-section">
|
||||
<div className="imp-section-title">{t("backup.offer.message", { name, error })}</div>
|
||||
</section>
|
||||
</div>
|
||||
<footer className="imp-foot">
|
||||
<button className="imp-btn" onClick={onCancel}>
|
||||
{t("backup.offer.cancel")}
|
||||
</button>
|
||||
<button className="imp-btn primary" onClick={onAccept}>
|
||||
{t("backup.offer.accept")}
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -33,6 +33,7 @@ export type TopBarEvents = Required<
|
||||
| "onOpenProject"
|
||||
| "onSaveProject"
|
||||
| "onSaveProjectAs"
|
||||
| "onRestoreBackup"
|
||||
| "onImport"
|
||||
| "onImportPointCloud"
|
||||
| "onImportMesh"
|
||||
@@ -134,6 +135,7 @@ export function useTopBarElements(opts: {
|
||||
onOpenProject={ev.onOpenProject}
|
||||
onSaveProject={ev.onSaveProject}
|
||||
onSaveProjectAs={ev.onSaveProjectAs}
|
||||
onRestoreBackup={ev.onRestoreBackup}
|
||||
onImport={ev.onImport}
|
||||
onImportPointCloud={ev.onImportPointCloud}
|
||||
onImportMesh={ev.onImportMesh}
|
||||
|
||||
Reference in new issue
Block a user