mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-18 14:54:26 +01:00
35 lines
992 B
TypeScript
35 lines
992 B
TypeScript
import { createSignal } from "solid-js";
|
|
import { Button, InnerCard, NiceP, VStack } from "~/components/layout";
|
|
import { useMegaStore } from "~/state/megaStore";
|
|
|
|
export function Restart() {
|
|
const [state, _] = useMegaStore();
|
|
const [hasStopped, setHasStopped] = createSignal(false);
|
|
|
|
async function toggle() {
|
|
if (hasStopped()) {
|
|
await state.mutiny_wallet?.start();
|
|
setHasStopped(false);
|
|
} else {
|
|
await state.mutiny_wallet?.stop();
|
|
setHasStopped(true);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<InnerCard>
|
|
<VStack>
|
|
<NiceP>
|
|
Something *extra* screwy going on? Stop the nodes!
|
|
</NiceP>
|
|
<Button
|
|
intent={hasStopped() ? "green" : "red"}
|
|
onClick={toggle}
|
|
>
|
|
{hasStopped() ? "Start" : "Stop"}
|
|
</Button>
|
|
</VStack>
|
|
</InnerCard>
|
|
);
|
|
}
|