mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-29 11:54:22 +01:00
add log downloader
This commit is contained in:
22
src/components/Logs.tsx
Normal file
22
src/components/Logs.tsx
Normal 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>
|
||||
|
||||
)
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createForm, url } from '@modular-forms/solid';
|
||||
import { TextField } from '~/components/layout/TextField';
|
||||
import { MutinyWalletSettingStrings, getExistingSettings } from '~/logic/mutinyWalletSetup';
|
||||
import { Button, SmallHeader } from '~/components/layout';
|
||||
import { Button, Card, SmallHeader } from '~/components/layout';
|
||||
import { showToast } from './Toaster';
|
||||
import eify from '~/utils/eify';
|
||||
import { useMegaStore } from '~/state/megaStore';
|
||||
@@ -24,36 +24,38 @@ export function SettingsStringsEditor() {
|
||||
console.log(values)
|
||||
}
|
||||
|
||||
return <Form onSubmit={handleSubmit} class="flex flex-col gap-4">
|
||||
<h2 class="text-2xl font-light">Don't trust us! Use your own servers to back Mutiny.</h2>
|
||||
<div class="flex flex-col gap-2">
|
||||
<SmallHeader>Network</SmallHeader>
|
||||
<pre>
|
||||
{existingSettings.network}
|
||||
</pre>
|
||||
</div>
|
||||
return <Card>
|
||||
<Form onSubmit={handleSubmit} class="flex flex-col gap-4">
|
||||
<h2 class="text-2xl font-light">Don't trust us! Use your own servers to back Mutiny.</h2>
|
||||
<div class="flex flex-col gap-2">
|
||||
<SmallHeader>Network</SmallHeader>
|
||||
<pre>
|
||||
{existingSettings.network}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<Field name="proxy" validate={[url("Should be a url starting with wss://")]}>
|
||||
{(field, props) => (
|
||||
<TextField {...props} value={field.value} error={field.error} label="Websockets Proxy" />
|
||||
)}
|
||||
</Field>
|
||||
<Field name="esplora" validate={[url("That doesn't look like a URL")]}>
|
||||
{(field, props) => (
|
||||
<TextField {...props} value={field.value} error={field.error} label="Esplora" />
|
||||
)}
|
||||
</Field>
|
||||
<Field name="rgs" validate={[url("That doesn't look like a URL")]}>
|
||||
{(field, props) => (
|
||||
<TextField {...props} value={field.value} error={field.error} label="RGS" />
|
||||
)}
|
||||
</Field>
|
||||
<Field name="lsp" validate={[url("That doesn't look like a URL")]}>
|
||||
{(field, props) => (
|
||||
<TextField {...props} value={field.value} error={field.error} label="LSP" />
|
||||
)}
|
||||
</Field>
|
||||
<Button type="submit">Save</Button>
|
||||
</Form>
|
||||
<Field name="proxy" validate={[url("Should be a url starting with wss://")]}>
|
||||
{(field, props) => (
|
||||
<TextField {...props} value={field.value} error={field.error} label="Websockets Proxy" />
|
||||
)}
|
||||
</Field>
|
||||
<Field name="esplora" validate={[url("That doesn't look like a URL")]}>
|
||||
{(field, props) => (
|
||||
<TextField {...props} value={field.value} error={field.error} label="Esplora" />
|
||||
)}
|
||||
</Field>
|
||||
<Field name="rgs" validate={[url("That doesn't look like a URL")]}>
|
||||
{(field, props) => (
|
||||
<TextField {...props} value={field.value} error={field.error} label="RGS" />
|
||||
)}
|
||||
</Field>
|
||||
<Field name="lsp" validate={[url("That doesn't look like a URL")]}>
|
||||
{(field, props) => (
|
||||
<TextField {...props} value={field.value} error={field.error} label="LSP" />
|
||||
)}
|
||||
</Field>
|
||||
<Button type="submit">Save</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user