problem: can't see devmode

This commit is contained in:
gsovereignty
2024-08-17 10:08:10 +08:00
parent 7d1d5e35c5
commit 37a0dc9b5e
4 changed files with 22 additions and 17 deletions

View File

@@ -19,7 +19,7 @@
let iconClass = 'h-5 w-5 md:h-4 md:w-4'; let iconClass = 'h-5 w-5 md:h-4 md:w-4';
$: getClass = (menuItem: string) => { $: getClass = (menuItem: string) => {
if ($page.url.pathname.startsWith(`/${menuItem}`)) { if ($page.url.pathname.startsWith(`/${menuItem}`) || (menuItem == 'dev' && $devmode)) {
return 'flex items-center gap-3 rounded-lg bg-muted px-3 py-2 text-primary transition-all hover:text-primary'; return 'flex items-center gap-3 rounded-lg bg-muted px-3 py-2 text-primary transition-all hover:text-primary';
} else { } else {
return 'flex items-center gap-3 rounded-lg px-3 py-2 text-muted-foreground transition-all hover:text-primary'; return 'flex items-center gap-3 rounded-lg px-3 py-2 text-muted-foreground transition-all hover:text-primary';
@@ -77,5 +77,5 @@
}} }}
> >
<Code class={iconClass} /> <Code class={iconClass} />
Toggle Dev Mode Dev Mode
</a> </a>

View File

@@ -17,7 +17,7 @@
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { base } from '$app/paths'; import { base } from '$app/paths';
import { Alert } from '@/components/ui/alert'; import { Alert } from '@/components/ui/alert';
import { currentUser } from '@/stores/session'; import { currentUser, devmode } from '@/stores/session';
import MeritComment from './MeritComment.svelte'; import MeritComment from './MeritComment.svelte';
import { Description } from 'formsnap'; import { Description } from 'formsnap';
@@ -222,9 +222,10 @@
</Table.Body> </Table.Body>
</Table.Root> </Table.Root>
</div> </div>
<a href="#" class="text-xs" on:click={() => console.log(merit.Event.rawEvent())} {#if $devmode}
>print to console</a <a href="#" class="text-xs" on:click={() => console.log(merit.Event.rawEvent())}
></Card.Content >print to console</a
>{/if}</Card.Content
> >
<Card.Footer class="flex flex-row justify-center border-t px-6 py-3 text-center {background}"> <Card.Footer class="flex flex-row justify-center border-t px-6 py-3 text-center {background}">

View File

@@ -5,6 +5,7 @@
import * as Card from '$lib/components/ui/card/index.js'; import * as Card from '$lib/components/ui/card/index.js';
import type { Rocket } from '@/event_helpers/rockets'; import type { Rocket } from '@/event_helpers/rockets';
import { ndk } from '@/ndk'; import { ndk } from '@/ndk';
import { devmode } from '@/stores/session';
import { Avatar, Name } from '@nostr-dev-kit/ndk-svelte-components'; import { Avatar, Name } from '@nostr-dev-kit/ndk-svelte-components';
import { ChevronRight } from 'lucide-svelte'; import { ChevronRight } from 'lucide-svelte';
@@ -30,12 +31,13 @@
</Card.Content> </Card.Content>
<Card.Footer> <Card.Footer>
<div class="flex flex-wrap justify-between gap-2 lg:gap-1"> <div class="flex flex-wrap justify-between gap-2 lg:gap-1">
<Button {#if $devmode}
on:click={() => { <Button
console.log(rocket.Event.rawEvent()); on:click={() => {
}} console.log(rocket.Event.rawEvent());
variant="outline">Print to Console</Button }}
> variant="outline">Print to Console</Button
>{/if}
<Button <Button
on:click={() => { on:click={() => {
goto(`${base}/rockets/${rocket.URL()}`); goto(`${base}/rockets/${rocket.URL()}`);

View File

@@ -11,6 +11,7 @@
import ProposedProducts from './ProposedProducts.svelte'; import ProposedProducts from './ProposedProducts.svelte';
import Todo from './Todo.svelte'; import Todo from './Todo.svelte';
import UpdateMission from './UpdateMission.svelte'; import UpdateMission from './UpdateMission.svelte';
import { devmode } from '@/stores/session';
export let rocket: NDKEvent; export let rocket: NDKEvent;
@@ -45,11 +46,12 @@
<Card.Title class="pb-4">Actions</Card.Title> <Card.Title class="pb-4">Actions</Card.Title>
<Card.Description class="flex flex-wrap gap-2"> <Card.Description class="flex flex-wrap gap-2">
<UpdateMission rocketEvent={rocket} /> <UpdateMission rocketEvent={rocket} />
<Button {#if $devmode}
on:click={() => { <Button
console.log(rocket.rawEvent()); on:click={() => {
}}>Print to Console</Button console.log(rocket.rawEvent());
> }}>Print to Console</Button
>{/if}
</Card.Description> </Card.Description>
</Card.Header> </Card.Header>
<Card.Footer></Card.Footer> <Card.Footer></Card.Footer>