From 22429c5b17828a4dea57fa8716c721d3afba788e Mon Sep 17 00:00:00 2001 From: "yongen.loong" Date: Fri, 26 Jul 2024 21:08:15 +0800 Subject: [PATCH] feat: loading indicator --- .env | 2 +- app/layout.tsx | 6 ++++-- app/page.tsx | 18 +++++++++--------- app/workspaces/loading.tsx | 17 +++++++++++++++++ components/new-workspace-form.tsx | 12 +++++++++++- components/ui/skeleton.tsx | 15 +++++++++++++++ 6 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 app/workspaces/loading.tsx create mode 100644 components/ui/skeleton.tsx diff --git a/.env b/.env index c62eabf..a0168b3 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -BUILD_SERVER_BASE_URL= +BUILD_SERVER_BASE_URL=https://playground.test.aelf.dev GA_TAG= \ No newline at end of file diff --git a/app/layout.tsx b/app/layout.tsx index 01f0a33..d326648 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,7 +2,7 @@ import type { Metadata } from "next"; import { Poppins } from "next/font/google"; import "./globals.css"; import { ThemeProvider } from "@/components/theme-provider"; -import { PropsWithChildren } from "react"; +import { PropsWithChildren, Suspense } from "react"; import TopMenu from "@/components/top-menu"; import clsx from "clsx"; import { GoogleAnalytics } from "@next/third-parties/google"; @@ -32,7 +32,9 @@ export default function RootLayout({ children }: PropsWithChildren) { disableTransitionOnChange > -
{children}
+
+ {children} +
{gaId ? : null} diff --git a/app/page.tsx b/app/page.tsx index c19f4c2..9612d4c 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -6,6 +6,7 @@ import { } from "@radix-ui/react-icons"; import Link from "next/link"; import { ReactNode } from "react"; +import { Skeleton } from "@/components/ui/skeleton"; function HomeCard({ title, @@ -32,7 +33,6 @@ function HomeCard({ } export default function Home() { - const links = [ { title: "Hello World", @@ -84,17 +84,17 @@ export default function Home() {

... or generate from a prompt:

- Deepchat here +
+ +
+ + +
+

DeepChat AI

-

Some description.

+

Coming soon.

diff --git a/app/workspaces/loading.tsx b/app/workspaces/loading.tsx new file mode 100644 index 0000000..841f1b8 --- /dev/null +++ b/app/workspaces/loading.tsx @@ -0,0 +1,17 @@ +import { Skeleton } from "@/components/ui/skeleton"; + +export default function Loading() { + return ( +
+
+

Create a new workspace

+ + +
+
+

Open an existing workspace

+ +
+
+ ); +} diff --git a/components/new-workspace-form.tsx b/components/new-workspace-form.tsx index 7f924a5..abd6f9d 100644 --- a/components/new-workspace-form.tsx +++ b/components/new-workspace-form.tsx @@ -26,6 +26,7 @@ import { } from "@/components/ui/select"; import { useRouter } from "next/navigation"; import { db } from "@/data/db"; +import { Loader2 } from "lucide-react"; const FormSchema = z.object({ name: z.string().min(2, { @@ -128,7 +129,16 @@ export function WorkspaceForm({ )} /> - + ); diff --git a/components/ui/skeleton.tsx b/components/ui/skeleton.tsx new file mode 100644 index 0000000..01b8b6d --- /dev/null +++ b/components/ui/skeleton.tsx @@ -0,0 +1,15 @@ +import { cn } from "@/lib/utils" + +function Skeleton({ + className, + ...props +}: React.HTMLAttributes) { + return ( +
+ ) +} + +export { Skeleton }