2021-11-01 20:10:49 +01:00
|
|
|
import { format } from "date-fns";
|
2021-10-19 15:56:52 +02:00
|
|
|
import { h, VNode } from "preact";
|
2021-10-22 06:31:46 +02:00
|
|
|
import { useAnastasisContext } from "../../context/anastasis";
|
|
|
|
import { AnastasisClientFrame } from "./index";
|
2021-10-19 15:56:52 +02:00
|
|
|
|
2021-10-22 06:31:46 +02:00
|
|
|
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
|
2021-11-01 20:10:49 +01:00
|
|
|
|
|
|
|
return (<AnastasisClientFrame hideNav title="Backup finished">
|
|
|
|
{reducer.currentReducerState.secret_name ? <p>
|
|
|
|
Your backup of secret <b>"{reducer.currentReducerState.secret_name}"</b> was
|
2021-10-19 15:56:52 +02:00
|
|
|
successful.
|
2021-11-01 20:10:49 +01:00
|
|
|
</p> :
|
|
|
|
<p>
|
|
|
|
Your secret was successfully backed up.
|
|
|
|
</p>}
|
2021-10-22 06:31:46 +02:00
|
|
|
|
2021-11-01 20:10:49 +01:00
|
|
|
{details && <div class="block">
|
|
|
|
<p>The backup is stored by the following providers:</p>
|
2021-10-22 06:31:46 +02:00
|
|
|
{Object.keys(details).map((x, i) => {
|
|
|
|
const sd = details[x];
|
2021-10-19 15:56:52 +02:00
|
|
|
return (
|
2021-11-01 20:10:49 +01:00
|
|
|
<div key={i} class="box">
|
|
|
|
{x}
|
|
|
|
<p>
|
|
|
|
version {sd.policy_version}
|
|
|
|
{sd.policy_expiration.t_ms !== 'never' ? ` expires at: ${format(sd.policy_expiration.t_ms, 'dd/MM/yyyy')}` : ' without expiration date'}
|
|
|
|
</p>
|
|
|
|
</div>
|
2021-10-19 15:56:52 +02:00
|
|
|
);
|
|
|
|
})}
|
2021-11-01 20:10:49 +01:00
|
|
|
</div>}
|
2021-10-19 15:56:52 +02:00
|
|
|
</AnastasisClientFrame>);
|
|
|
|
}
|