@buoy-gg/time-machine 7.0.29 → 7.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,70 +0,0 @@
1
- /**
2
- * The preview screen, wired to the store — the restore leg (baseline
3
- * confirmation, the route prompt, landing back on the list) lives here so
4
- * RestorePreviewScreen stays presentation.
5
- *
6
- * Kept apart from the restore-point list so each screen mounts and unmounts
7
- * as a whole tree — the router in ../TimeMachineBody picks one, never swaps
8
- * branches inside a live tree. (Item diffs are NOT a screen: they expand
9
- * inline inside the preview's list.)
10
- */
11
- import { timeMachineStore } from "../../store/timeMachineStore";
12
- import type {
13
- PreviewSideRef,
14
- PreviewState,
15
- } from "../../store/timeMachineStore";
16
- import type { SnapshotMeta } from "../../store/snapshotVault";
17
- import { confirmDestructive } from "../confirm";
18
- import { RestorePreviewScreen } from "./RestorePreviewScreen";
19
-
20
- function snapshotFor(
21
- ref: PreviewSideRef,
22
- snapshots: SnapshotMeta[]
23
- ): SnapshotMeta | undefined {
24
- return ref === "current"
25
- ? undefined
26
- : snapshots.find((s) => s.id === ref.snapshotId);
27
- }
28
-
29
- export function PreviewScreen({
30
- preview,
31
- snapshots,
32
- busy,
33
- onClose,
34
- }: {
35
- preview: PreviewState;
36
- snapshots: SnapshotMeta[];
37
- busy: boolean;
38
- onClose: () => void;
39
- }) {
40
- const rightMeta = snapshotFor(preview.right, snapshots);
41
-
42
- const restore = (mode: "live" | "reload", excludeKeys?: string[]) => {
43
- if (!rightMeta || busy) return;
44
- if (rightMeta.baseline) {
45
- confirmDestructive(
46
- "Restore fresh install?",
47
- "This wipes all app storage and reloads the app.",
48
- "Wipe & reload",
49
- () => void timeMachineStore.restore(rightMeta.id, "reload")
50
- );
51
- return;
52
- }
53
- // Land back on the list, where the outcome card reports the results —
54
- // the preview's diff is stale the moment restore runs. Whether the route
55
- // comes back is the restore point's own setting, toggled on its row.
56
- void timeMachineStore
57
- .restore(rightMeta.id, mode, excludeKeys)
58
- .then(onClose);
59
- };
60
-
61
- return (
62
- <RestorePreviewScreen
63
- preview={preview}
64
- snapshots={snapshots}
65
- busy={busy}
66
- onBack={onClose}
67
- onRestore={restore}
68
- />
69
- );
70
- }
@@ -1,80 +0,0 @@
1
- /**
2
- * The restore point's name, editable in place.
3
- *
4
- * Renaming lives on the preview rather than behind a swipe on the list: the
5
- * list is for picking one, and you rarely know a name is wrong until you're
6
- * looking at what the point actually contains.
7
- *
8
- * Commits on blur as well as on return — tapping away from a field you have
9
- * just typed into should keep the typing. Finder and iOS both treat leaving
10
- * as accepting, and silently discarding an edit is the one outcome nobody
11
- * wants.
12
- */
13
- import { useEffect, useState } from "react";
14
- import { StyleSheet, Text, TextInput, View } from "react-native";
15
- import { tm } from "../../ui/tmTheme";
16
-
17
- export function RestorePointNameRow({
18
- name,
19
- onRename,
20
- }: {
21
- name: string;
22
- onRename: (name: string) => void;
23
- }) {
24
- const [draft, setDraft] = useState(name);
25
-
26
- // A rename from anywhere else (MCP, the desktop) should show up here.
27
- useEffect(() => setDraft(name), [name]);
28
-
29
- const commit = () => {
30
- const trimmed = draft.trim();
31
- if (!trimmed) {
32
- setDraft(name); // an empty name would make the row unidentifiable
33
- return;
34
- }
35
- if (trimmed !== name) onRename(trimmed);
36
- };
37
-
38
- return (
39
- <View style={styles.row}>
40
- <Text style={styles.label}>Name</Text>
41
- <TextInput
42
- style={styles.input}
43
- value={draft}
44
- onChangeText={setDraft}
45
- onSubmitEditing={commit}
46
- onBlur={commit}
47
- returnKeyType="done"
48
- selectTextOnFocus
49
- accessibilityLabel="Restore point name"
50
- testID="tm-preview-name"
51
- />
52
- </View>
53
- );
54
- }
55
-
56
- const styles = StyleSheet.create({
57
- row: {
58
- flexDirection: "row",
59
- alignItems: "center",
60
- gap: 14,
61
- minHeight: tm.rowMinHeight,
62
- paddingHorizontal: tm.textInset,
63
- },
64
- label: {
65
- color: tm.color.labelSecondary,
66
- fontSize: tm.font.row,
67
- letterSpacing: tm.tracking.row,
68
- },
69
- input: {
70
- flex: 1,
71
- minWidth: 0,
72
- color: tm.color.label,
73
- fontSize: tm.font.row,
74
- fontWeight: "600",
75
- letterSpacing: tm.tracking.row,
76
- textAlign: "right",
77
- padding: 0,
78
- backgroundColor: "transparent",
79
- },
80
- });