From a46bb4c6ddee5da8eba63d7f45855cd913aaa568 Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Fri, 14 Oct 2022 22:39:16 +0800 Subject: [PATCH] demo: signin logic fixes and various UI fixes --- samples/todo/components/AuthGuard.tsx | 7 +- samples/todo/components/Spaces.tsx | 2 +- samples/todo/components/TimeInfo.tsx | 17 +++++ samples/todo/components/Todo.tsx | 10 +-- samples/todo/components/TodoList.tsx | 74 +++++++++++++------ samples/todo/pages/index.tsx | 46 +++++------- .../pages/space/[slug]/[listId]/index.tsx | 2 +- samples/todo/pages/space/[slug]/index.tsx | 10 ++- 8 files changed, 104 insertions(+), 64 deletions(-) create mode 100644 samples/todo/components/TimeInfo.tsx diff --git a/samples/todo/components/AuthGuard.tsx b/samples/todo/components/AuthGuard.tsx index d056e0cff..36ef8e254 100644 --- a/samples/todo/components/AuthGuard.tsx +++ b/samples/todo/components/AuthGuard.tsx @@ -8,9 +8,10 @@ export default function AuthGuard({ children }: Props) { const { status } = useSession(); if (status === 'loading') { return

Loading...

; - } - if (status === 'unauthenticated') { + } else if (status === 'unauthenticated') { signIn(); + return <>; + } else { + return <>{children}; } - return <>{children}; } diff --git a/samples/todo/components/Spaces.tsx b/samples/todo/components/Spaces.tsx index 437058979..936d029f8 100644 --- a/samples/todo/components/Spaces.tsx +++ b/samples/todo/components/Spaces.tsx @@ -6,7 +6,7 @@ export default function Spaces() { const spaces = find(); return ( -