summaryrefslogtreecommitdiff
path: root/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx
blob: 218f1d1fd907a44e067436f957a3847bb0a45029 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis";
import { AnastasisClientFrame } from "./index";

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 "{reducer.currentReducerState.secret_name ?? "??"}" was
      successful.
    </p>
    <p>The backup is stored by the following providers:</p>

    {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={() => reducer.reset()}>Back to start</button>
  </AnastasisClientFrame>);
}