From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001
From: rxliuli <rxliuli@gmail.com>
Date: Tue, 4 Nov 2025 05:03:50 +0800
Subject: init commit

---
 src/components/PageResolver.svelte | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 src/components/PageResolver.svelte

(limited to 'src/components/PageResolver.svelte')

diff --git a/src/components/PageResolver.svelte b/src/components/PageResolver.svelte
new file mode 100644
index 0000000..9f482aa
--- /dev/null
+++ b/src/components/PageResolver.svelte
@@ -0,0 +1,25 @@
+<script lang="ts">
+    import type { Page } from '~/jet/models';
+
+    import PageComponent from '~/components/Page.svelte';
+    import ErrorComponent from '~/components/Error.svelte';
+    import LoadingSpinner from '@amp/web-app-components/src/components/LoadingSpinner/LoadingSpinner.svelte';
+
+    export let page: Promise<Page> | Page;
+    export let isFirstPage: boolean;
+</script>
+
+{#await page}
+    <div data-testid="page-loading">
+        <!--
+            Delay showing the spinner on initial page load after app boot.
+            After that, the FlowAction handler already waits 500ms before
+            it changes DOM, so we only need to wait 1000ms.
+        -->
+        <LoadingSpinner delay={isFirstPage ? 1500 : 1000} />
+    </div>
+{:then page}
+    <PageComponent {page} />
+{:catch error}
+    <ErrorComponent {error} />
+{/await}
-- 
cgit v1.2.3

