fix: backend none templates (#241)

This commit is contained in:
Aman Varshney
2025-05-10 08:10:23 +05:30
committed by GitHub
parent 4e4ad2b9ee
commit 8209713bd6
29 changed files with 519 additions and 353 deletions

View File

@@ -16,16 +16,12 @@
</main>
</div>
{{else}}
{{#if (eq api "orpc")}}
<script lang="ts">
import { QueryClientProvider } from '@tanstack/svelte-query';
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
import '../app.css';
{{#if (eq api "orpc")}}
import { queryClient } from '$lib/orpc';
{{/if}}
{{#if (eq api "trpc")}}
import { queryClient } from '$lib/trpc';
{{/if}}
import Header from '../components/Header.svelte';
let { children } = $props();
@@ -40,4 +36,19 @@
</div>
<SvelteQueryDevtools />
</QueryClientProvider>
{{else}}
<script lang="ts">
import '../app.css';
import Header from '../components/Header.svelte';
let { children } = $props();
</script>
<div class="grid h-svh grid-rows-[auto_1fr]">
<Header />
<main class="overflow-y-auto">
{@render children()}
</main>
</div>
{{/if}}
{{/if}}

View File

@@ -3,10 +3,8 @@
import { useQuery } from 'convex-svelte';
import { api } from "@{{projectName}}/backend/convex/_generated/api.js";
const healthCheck = useQuery(api.healthCheck.get, {});
const TITLE_TEXT = `
██████╗ ███████╗████████╗████████╗███████╗██████╗
██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔════╝██╔══██╗
@@ -28,7 +26,7 @@ const TITLE_TEXT = `
<pre class="overflow-x-auto font-mono text-sm">{TITLE_TEXT}</pre>
<div class="grid gap-6">
<section class="rounded-lg border p-4">
<h2 class="mb-2 font-medium">API Status (Convex)</h2>
<h2 class="mb-2 font-medium">API Status</h2>
<div class="flex items-center gap-2">
<div
class={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
@@ -48,19 +46,9 @@ const TITLE_TEXT = `
<script lang="ts">
{{#if (eq api "orpc")}}
import { orpc } from "$lib/orpc";
{{/if}}
{{#if (eq api "trpc")}}
import { trpc } from "$lib/trpc";
{{/if}}
import { createQuery } from "@tanstack/svelte-query";
{{#if (eq api "orpc")}}
const healthCheck = createQuery(orpc.healthCheck.queryOptions());
{{/if}}
{{#if (eq api "trpc")}}
const healthCheck = createQuery(trpc.healthCheck.queryOptions());
{{/if}}
const TITLE_TEXT = `
██████╗ ███████╗████████╗████████╗███████╗██████╗
@@ -82,8 +70,9 @@ const TITLE_TEXT = `
<div class="container mx-auto max-w-3xl px-4 py-2">
<pre class="overflow-x-auto font-mono text-sm">{TITLE_TEXT}</pre>
<div class="grid gap-6">
{{#if (eq api "orpc")}}
<section class="rounded-lg border p-4">
<h2 class="mb-2 font-medium">API Status{{#if (eq api "trpc")}} (tRPC){{/if}}{{#if (eq api "orpc")}} (oRPC){{/if}}</h2>
<h2 class="mb-2 font-medium">API Status</h2>
<div class="flex items-center gap-2">
<div
class={`h-2 w-2 rounded-full ${$healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
@@ -97,6 +86,7 @@ const TITLE_TEXT = `
</span>
</div>
</section>
{{/if}}
</div>
</div>
{{/if}}