2021-10-19 15:56:52 +02:00
|
|
|
import { h, VNode } from "preact";
|
2021-11-24 21:38:39 +01:00
|
|
|
import { FileInput } from "../../components/fields/FileInput";
|
|
|
|
import { FileButton } from "../../components/FlieButton";
|
2021-10-22 06:31:46 +02:00
|
|
|
import { useAnastasisContext } from "../../context/anastasis";
|
2021-10-19 15:56:52 +02:00
|
|
|
import { AnastasisClientFrame } from "./index";
|
|
|
|
|
2021-10-22 06:31:46 +02:00
|
|
|
export function StartScreen(): VNode {
|
2021-11-10 14:20:52 +01:00
|
|
|
const reducer = useAnastasisContext();
|
2021-10-22 06:31:46 +02:00
|
|
|
if (!reducer) {
|
2021-11-10 14:20:52 +01:00
|
|
|
return <div>no reducer in context</div>;
|
2021-10-22 06:31:46 +02:00
|
|
|
}
|
2021-10-19 15:56:52 +02:00
|
|
|
return (
|
|
|
|
<AnastasisClientFrame hideNav title="Home">
|
2021-11-03 21:30:11 +01:00
|
|
|
<div class="columns">
|
|
|
|
<div class="column" />
|
|
|
|
<div class="column is-four-fifths">
|
|
|
|
<div class="buttons">
|
2021-11-10 14:20:52 +01:00
|
|
|
<button
|
|
|
|
class="button is-success"
|
|
|
|
autoFocus
|
|
|
|
onClick={() => reducer.startBackup()}
|
|
|
|
>
|
|
|
|
<div class="icon">
|
|
|
|
<i class="mdi mdi-arrow-up" />
|
|
|
|
</div>
|
2021-11-03 21:30:11 +01:00
|
|
|
<span>Backup a secret</span>
|
|
|
|
</button>
|
2021-10-22 06:31:46 +02:00
|
|
|
|
2021-11-10 14:20:52 +01:00
|
|
|
<button
|
|
|
|
class="button is-info"
|
|
|
|
onClick={() => reducer.startRecover()}
|
|
|
|
>
|
|
|
|
<div class="icon">
|
|
|
|
<i class="mdi mdi-arrow-down" />
|
|
|
|
</div>
|
2021-11-03 21:30:11 +01:00
|
|
|
<span>Recover a secret</span>
|
|
|
|
</button>
|
2021-10-26 17:08:03 +02:00
|
|
|
|
2021-11-24 21:38:39 +01:00
|
|
|
<FileButton
|
|
|
|
label="Restore a session"
|
|
|
|
onChange={(content) => {
|
|
|
|
if (content?.type === "application/json") {
|
|
|
|
reducer.importState(content.content);
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
2021-11-04 19:18:30 +01:00
|
|
|
{/* <button class="button">
|
2021-11-03 21:30:11 +01:00
|
|
|
<div class="icon"><i class="mdi mdi-file" /></div>
|
|
|
|
<span>Restore a session</span>
|
2021-11-04 19:18:30 +01:00
|
|
|
</button> */}
|
2021-10-22 06:31:46 +02:00
|
|
|
</div>
|
2021-11-03 21:30:11 +01:00
|
|
|
</div>
|
|
|
|
<div class="column" />
|
2021-10-22 06:31:46 +02:00
|
|
|
</div>
|
2021-10-19 15:56:52 +02:00
|
|
|
</AnastasisClientFrame>
|
|
|
|
);
|
|
|
|
}
|