feat: dev and PUBLIC_DEBUG_FORMS variables to environment imports

This commit is contained in:
Bart van der Braak 2024-02-20 20:45:17 +01:00
parent 28721b4ba5
commit bdaeb428db
5 changed files with 15 additions and 10 deletions

View file

@ -47,7 +47,8 @@
import { Input } from "$lib/components/ui/input";
import { buttonVariants } from "$lib/components/ui/button";
import { cn } from "$lib/utils";
import { browser } from "$app/environment";
import { browser, dev } from "$app/environment";
import { PUBLIC_DEBUG_FORMS } from "$env/static/public";
import {
DateFormatter,
getLocalTimeZone,
@ -174,6 +175,6 @@
<Form.Button>Update account</Form.Button>
</form>
{#if browser}
{#if dev && PUBLIC_DEBUG_FORMS == 'true' && browser}
<SuperDebug data={$formData} />
{/if}

View file

@ -16,7 +16,8 @@
<script lang="ts">
import { ChevronDown } from "radix-icons-svelte";
import { browser } from "$app/environment";
import { browser, dev } from "$app/environment";
import { PUBLIC_DEBUG_FORMS } from "$env/static/public";
import SuperDebug, { type SuperValidated, type Infer, superForm } from "sveltekit-superforms";
import * as Form from "$lib/components/ui/form";
import * as RadioGroup from "$lib/components/ui/radio-group";
@ -127,6 +128,6 @@
<Form.Button>Update preferences</Form.Button>
</form>
{#if browser}
{#if dev && PUBLIC_DEBUG_FORMS == 'true' && browser}
<SuperDebug data={$formData} />
{/if}

View file

@ -40,7 +40,8 @@
import { type SuperValidated, type Infer, superForm } from "sveltekit-superforms";
import SuperDebug from "sveltekit-superforms";
import { zodClient } from "sveltekit-superforms/adapters";
import { browser } from "$app/environment";
import { browser, dev } from "$app/environment";
import { PUBLIC_DEBUG_FORMS } from "$env/static/public";
export let data: SuperValidated<Infer<DisplayFormSchema>>;
@ -89,6 +90,6 @@
<Form.Button>Update display</Form.Button>
</form>
{#if browser}
{#if dev && PUBLIC_DEBUG_FORMS == 'true' && browser}
<SuperDebug data={$formData} />
{/if}

View file

@ -20,7 +20,8 @@
import { Switch } from "$lib/components/ui/switch";
import { zodClient } from "sveltekit-superforms/adapters";
import Checkbox from "$lib/components/ui/checkbox/checkbox.svelte";
import { browser } from "$app/environment";
import { browser, dev } from "$app/environment";
import { PUBLIC_DEBUG_FORMS } from "$env/static/public";
export let data: SuperValidated<Infer<NotificationFormSchema>>;
@ -140,6 +141,6 @@
<Form.Button>Update notifications</Form.Button>
</form>
{#if browser}
{#if dev && PUBLIC_DEBUG_FORMS == 'true' && browser}
<SuperDebug data={$formData} />
{/if}

View file

@ -24,7 +24,8 @@
import SuperDebug from "sveltekit-superforms";
import { zodClient } from "sveltekit-superforms/adapters";
import { cn } from "$lib/utils";
import { browser } from "$app/environment";
import { browser, dev } from "$app/environment";
import { PUBLIC_DEBUG_FORMS } from "$env/static/public";
export let data: SuperValidated<Infer<ProfileFormSchema>>;
@ -117,6 +118,6 @@
<Form.Button>Update profile</Form.Button>
</form>
{#if browser}
{#if dev && PUBLIC_DEBUG_FORMS == 'true' && browser}
<SuperDebug data={$formData} />
{/if}