add log downloader

This commit is contained in:
Paul Miller
2023-05-09 10:56:13 -05:00
parent 7c802fde54
commit 8c0accbfbd
4 changed files with 59 additions and 33 deletions

22
src/components/Logs.tsx Normal file
View File

@@ -0,0 +1,22 @@
import { Button, Card, NiceP, VStack } from "~/components/layout";
import { useMegaStore } from "~/state/megaStore";
import { downloadTextFile } from "~/utils/download";
export function Logs() {
const [state, _] = useMegaStore()
async function handleSave() {
const logs = await state.mutiny_wallet?.get_logs()
downloadTextFile(logs.join("") || "", "mutiny-logs.txt", "text/plain")
}
return (
<Card>
<VStack>
<NiceP>Something screwy going on? Check out the logs!</NiceP>
<Button onClick={handleSave}>Download Logs</Button>
</VStack>
</Card>
)
}