diff --git a/src/components/GenerationListItem.svelte b/src/components/GenerationListItem.svelte index 17690d1..9200b91 100644 --- a/src/components/GenerationListItem.svelte +++ b/src/components/GenerationListItem.svelte @@ -51,7 +51,7 @@
-

+

Your Prompt @@ -59,26 +59,30 @@ "{data.prompt}"

{#if data.outputs && data.status === 'completed'} -
+
{#if shouldRenderModel} - + {/if}
{:else if data.status === 'failed'} -
+

{data.error}

{:else} -
+

Generating...

{/if}
-
+
Submitted
@@ -92,11 +96,11 @@ {/if}
{#if data.outputs && data.status === 'completed'} -
    +
    • View
    • @@ -105,7 +109,8 @@ {:else if data.error} Retry Prompt {/if}
diff --git a/src/components/ModelPreviewer.svelte b/src/components/ModelPreviewer.svelte index 18e6992..f69c1e1 100644 --- a/src/components/ModelPreviewer.svelte +++ b/src/components/ModelPreviewer.svelte @@ -2,8 +2,10 @@ import * as THREE from 'three' import { T, useThrelte } from '@threlte/core' import { GLTF, OrbitControls, interactivity, useGltf } from '@threlte/extras' + export let dataUrl: string export let pausable = true + export let enableZoom = true const { size: threlteSize } = useThrelte() @@ -49,6 +51,7 @@ diff --git a/src/components/Nav.svelte b/src/components/Nav.svelte index ec8e503..6ad8cde 100644 --- a/src/components/Nav.svelte +++ b/src/components/Nav.svelte @@ -24,6 +24,6 @@ @apply bg-chalkboard-10 dark:bg-chalkboard-100; @apply mx-5 lg:mx-auto mt-2 lg:mt-4 max-w-5xl; @apply sticky z-10 top-0 flex justify-between items-center; - @apply border px-4 py-1; + @apply border px-2 md:px-4 py-1; } diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte new file mode 100644 index 0000000..e7d01ce --- /dev/null +++ b/src/routes/+error.svelte @@ -0,0 +1,27 @@ + + +

+ Error: {$page.status} +

+

{$page.error ? $page.error.message : 'Something went wrong'}

+
+ + 🏠 Go to home +
+ + diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 5b10bf8..0e4b107 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -12,37 +12,42 @@ ] -
+
-

+

Text to CAD

-
-
+
+
{examples[0].prompt}
-
-

+

+

Create B-Rep CAD files and meshes from natural language prompts. Powered by KittyCAD.

Sign in to get started
@@ -50,22 +55,43 @@
diff --git a/src/routes/view/[modelId]/+page.server.ts b/src/routes/view/[modelId]/+page.server.ts index 055008d..be18584 100644 --- a/src/routes/view/[modelId]/+page.server.ts +++ b/src/routes/view/[modelId]/+page.server.ts @@ -1,6 +1,6 @@ import { endpoints, type PromptResponse } from '$lib/endpoints' import type { Models } from '@kittycad/lib' -import { redirect } from '@sveltejs/kit' +import { error, redirect } from '@sveltejs/kit' type LoadResponse = { status: number @@ -26,6 +26,13 @@ export const load = async ({ cookies, params }) => { const body = (await response.json()) as Models['TextToCad_type'] + if (response.status >= 400 && response.status < 500) { + throw error( + response.status, + 'Model could not be found or you do not have permission to view it' + ) + } + return { status: response.status, body diff --git a/src/routes/view/[modelId]/+page.svelte b/src/routes/view/[modelId]/+page.svelte index 3a0c9bc..1ca4a82 100644 --- a/src/routes/view/[modelId]/+page.svelte +++ b/src/routes/view/[modelId]/+page.svelte @@ -12,7 +12,7 @@ }` -

+

Text to CAD @@ -23,7 +23,7 @@ >⬅ Back to home

-
+

@@ -46,7 +46,7 @@

Submitted {data.body?.created_at}

Completed {data.body?.completed_at}