diff options
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx')
-rw-r--r-- | packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx index 6c2770947..218f1d1fd 100644 --- a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx @@ -1,23 +1,33 @@ import { h, VNode } from "preact"; -import { BackupReducerProps, AnastasisClientFrame } from "./index"; +import { useAnastasisContext } from "../../context/anastasis"; +import { AnastasisClientFrame } from "./index"; -export function BackupFinishedScreen(props: BackupReducerProps): VNode { +export function BackupFinishedScreen(): VNode { + const reducer = useAnastasisContext() + if (!reducer) { + return <div>no reducer in context</div> + } + if (!reducer.currentReducerState || reducer.currentReducerState.backup_state === undefined) { + return <div>invalid state</div> + } + const details = reducer.currentReducerState.success_details return (<AnastasisClientFrame hideNext title="Backup finished"> <p> - Your backup of secret "{props.backupState.secret_name ?? "??"}" was + Your backup of secret "{reducer.currentReducerState.secret_name ?? "??"}" was successful. </p> <p>The backup is stored by the following providers:</p> - <ul> - {Object.keys(props.backupState.success_details!).map((x, i) => { - const sd = props.backupState.success_details![x]; + + {details && <ul> + {Object.keys(details).map((x, i) => { + const sd = details[x]; return ( <li key={i}> {x} (Policy version {sd.policy_version}) </li> ); })} - </ul> - <button onClick={() => props.reducer.reset()}>Back to start</button> + </ul>} + <button onClick={() => reducer.reset()}>Back to start</button> </AnastasisClientFrame>); } |