feat: add deubg menu to users

This commit is contained in:
Xyphyn committed 2023-08-26 10:25:44 -07:00
1 parent 6516e99fe0
commit 8aa62b046e
4 files changed
+40 -8

No files matched your search

+5 -1
View File
@@ -40,7 +40,11 @@ flex flex-col items-center justify-center bg-black/50 backdrop-blur-sm box-borde
<h1 class="font-bold text-2xl w-max max-w-full"> <h1 class="font-bold text-2xl w-max max-w-full">
<slot name="title" /> <slot name="title" />
</h1> </h1>
<Button class="!p-2 ml-auto" on:click={() => (open = false)}> <Button
size="square-md"
class="ml-auto"
on:click={() => (open = false)}
>
<Icon src={XMark} mini size="16" /> <Icon src={XMark} mini size="16" />
</Button> </Button>
</div> </div>
@@ -7,6 +7,6 @@
</script> </script>
<Modal bind:open> <Modal bind:open>
<span slot="title">Debug</span> <span slot="title"><slot name="title">Debug</slot></span>
<DebugTree {object} isParent={true} /> <DebugTree {object} isParent={true} />
</Modal> </Modal>
@@ -12,13 +12,8 @@
{#if typeof object[key] === 'object'} {#if typeof object[key] === 'object'}
<svelte:self object={object[key]} isParent={false} /> <svelte:self object={object[key]} isParent={false} />
{:else} {:else}
<pre>{object[key]}</pre> <pre class="break-words">{object[key]}</pre>
{/if} {/if}
</details> </details>
{/each} {/each}
</ul> </ul>
<style>
details {
}
</style>
+33
View File
@@ -6,6 +6,8 @@
resetProfile, resetProfile,
deleteProfile, deleteProfile,
moveProfile, moveProfile,
type Profile,
profile,
} from '$lib/auth.js' } from '$lib/auth.js'
import Button from '$lib/components/input/Button.svelte' import Button from '$lib/components/input/Button.svelte'
import TextInput from '$lib/components/input/TextInput.svelte' import TextInput from '$lib/components/input/TextInput.svelte'
@@ -13,6 +15,7 @@
import Menu from '$lib/components/ui/menu/Menu.svelte' import Menu from '$lib/components/ui/menu/Menu.svelte'
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte' import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
import { toast } from '$lib/components/ui/toasts/toasts.js' import { toast } from '$lib/components/ui/toasts/toasts.js'
import DebugObject from '$lib/components/util/debug/DebugObject.svelte'
import { import {
DEFAULT_INSTANCE_URL, DEFAULT_INSTANCE_URL,
LINKED_INSTANCE_URL, LINKED_INSTANCE_URL,
@@ -20,9 +23,11 @@
} from '$lib/instance.js' } from '$lib/instance.js'
import { validateInstance } from '$lib/lemmy.js' import { validateInstance } from '$lib/lemmy.js'
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte' import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
import { userSettings } from '$lib/settings.js'
import { import {
ArrowLeftOnRectangle, ArrowLeftOnRectangle,
ArrowUturnLeft, ArrowUturnLeft,
BugAnt,
ChevronDown, ChevronDown,
ChevronUp, ChevronUp,
EllipsisHorizontal, EllipsisHorizontal,
@@ -67,12 +72,29 @@
} }
loading = false loading = false
} }
let debugging = false
let debugProfile: Profile | undefined = undefined
</script> </script>
<svelte:head> <svelte:head>
<title>Accounts</title> <title>Accounts</title>
</svelte:head> </svelte:head>
{#if debugging}
<DebugObject
object={debugProfile?.id == $profile?.id ? $profile : debugProfile}
bind:open={debugging}
>
<span slot="title" class="flex flex-col">
<h1 class="font-bold text-2xl">Debug</h1>
<span class="text-slate-600 dark:text-zinc-400 text-base font-normal">
Do NOT share anything from this menu.
</span>
</span>
</DebugObject>
{/if}
{#if $profileData.profiles.length == 0} {#if $profileData.profiles.length == 0}
<div class="h-full flex items-center justify-center"> <div class="h-full flex items-center justify-center">
<div <div
@@ -171,6 +193,17 @@
<Icon src={ArrowUturnLeft} size="16" mini slot="icon" /> <Icon src={ArrowUturnLeft} size="16" mini slot="icon" />
Reset Color Reset Color
</MenuButton> </MenuButton>
{#if $userSettings.debugInfo}
<MenuButton
on:click={() => {
debugProfile = profile
debugging = !debugging
}}
>
<Icon src={BugAnt} size="16" mini slot="icon" />
Debug Info
</MenuButton>
{/if}
</Menu> </Menu>
<Button <Button
on:click={() => { on:click={() => {