diff --git a/src/components/Logs.tsx b/src/components/Logs.tsx new file mode 100644 index 0000000..b8b3b75 --- /dev/null +++ b/src/components/Logs.tsx @@ -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 ( + + + Something screwy going on? Check out the logs! + + + + + ) +} \ No newline at end of file diff --git a/src/components/SettingsStringsEditor.tsx b/src/components/SettingsStringsEditor.tsx index ed31dcb..aa98f2d 100644 --- a/src/components/SettingsStringsEditor.tsx +++ b/src/components/SettingsStringsEditor.tsx @@ -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
-

Don't trust us! Use your own servers to back Mutiny.

-
- Network -
-                {existingSettings.network}
-            
-
+ return + +

Don't trust us! Use your own servers to back Mutiny.

+
+ Network +
+                    {existingSettings.network}
+                
+
- - {(field, props) => ( - - )} - - - {(field, props) => ( - - )} - - - {(field, props) => ( - - )} - - - {(field, props) => ( - - )} - - - + + {(field, props) => ( + + )} + + + {(field, props) => ( + + )} + + + {(field, props) => ( + + )} + + + {(field, props) => ( + + )} + + + +
} \ No newline at end of file diff --git a/src/routes/Settings.tsx b/src/routes/Settings.tsx index 1ab8639..57db0fd 100644 --- a/src/routes/Settings.tsx +++ b/src/routes/Settings.tsx @@ -1,5 +1,6 @@ import { ButtonLink, DefaultMain, LargeHeader, MutinyWalletGuard, SafeArea, VStack } from "~/components/layout"; import { BackLink } from "~/components/layout/BackLink"; +import { Logs } from "~/components/Logs"; import NavBar from "~/components/NavBar"; import { SeedWords } from "~/components/SeedWords"; import { SettingsStringsEditor } from "~/components/SettingsStringsEditor"; @@ -20,6 +21,7 @@ export default function Settings() { + "I know what I'm doing" diff --git a/src/utils/download.ts b/src/utils/download.ts index 4fa9f5b..90c3a0a 100644 --- a/src/utils/download.ts +++ b/src/utils/download.ts @@ -1,7 +1,7 @@ // https://stackoverflow.com/questions/34156282/how-do-i-save-json-to-local-text-file -export function downloadTextFile(content: string, fileName: string) { - const contentType = "application/json"; +export function downloadTextFile(content: string, fileName: string, type: string) { + const contentType = type ? type : "application/json"; const a = document.createElement("a"); const file = new Blob([content], { type: contentType }); a.href = URL.createObjectURL(file);