From 3eee2e7373ff40ef116ab3e0c06ad67dfbbed0a8 Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Fri, 14 Oct 2022 17:50:10 +0800 Subject: [PATCH] demo: small UI refinements --- samples/todo/components/ManageMembers.tsx | 24 ++++++++++++++------ samples/todo/components/NavBar.tsx | 2 +- samples/todo/components/SpaceMembers.tsx | 2 +- samples/todo/pages/_app.tsx | 19 +++++++++------- samples/todo/pages/api/auth/[...nextauth].ts | 7 ------ samples/todo/pages/create-space.tsx | 3 --- samples/todo/pages/index.tsx | 2 +- samples/todo/pages/space/[slug]/index.tsx | 4 ++-- 8 files changed, 33 insertions(+), 30 deletions(-) diff --git a/samples/todo/components/ManageMembers.tsx b/samples/todo/components/ManageMembers.tsx index 450c20fc7..ec380ddb5 100644 --- a/samples/todo/components/ManageMembers.tsx +++ b/samples/todo/components/ManageMembers.tsx @@ -1,4 +1,4 @@ -import { PlusIcon } from '@heroicons/react/24/outline'; +import { PlusIcon, TrashIcon } from '@heroicons/react/24/outline'; import { ServerErrorCode } from '@zenstackhq/internal'; import { HooksError, useSpaceUser } from '@zenstackhq/runtime/hooks'; import { Space, SpaceUserRole } from '@zenstackhq/runtime/types'; @@ -61,7 +61,7 @@ export default function ManageMembers({ space }: Props) { return (
-
+
{members?.map((member) => ( -
  • -
    - -

    +

  • +
    +
    + +
    +

    {member.user.name || member.user.email}

    {member.role}

  • diff --git a/samples/todo/components/NavBar.tsx b/samples/todo/components/NavBar.tsx index 4ac9f9824..0d1b52ee8 100644 --- a/samples/todo/components/NavBar.tsx +++ b/samples/todo/components/NavBar.tsx @@ -22,7 +22,7 @@ export default function NavBar({ user, space }: Props) { width={32} height={32} /> -
    +
    {space?.name || 'Welcome Todo App'}

    diff --git a/samples/todo/components/SpaceMembers.tsx b/samples/todo/components/SpaceMembers.tsx index 1b0606633..92dbad08f 100644 --- a/samples/todo/components/SpaceMembers.tsx +++ b/samples/todo/components/SpaceMembers.tsx @@ -20,7 +20,7 @@ function ManagementDialog(space?: Space) { />

    -

    +

    Manage Members of {space.name}

    diff --git a/samples/todo/pages/_app.tsx b/samples/todo/pages/_app.tsx index 454cf9caf..e6039b23b 100644 --- a/samples/todo/pages/_app.tsx +++ b/samples/todo/pages/_app.tsx @@ -10,20 +10,23 @@ import { useCurrentUser, UserContext, } from '@lib/context'; +import AuthGuard from 'components/AuthGuard'; function AppContent(props: { children: JSX.Element | JSX.Element[] }) { const user = useCurrentUser(); const space = useCurrentSpace(); return ( - - -
    - - {props.children} -
    -
    -
    + + + +
    + + {props.children} +
    +
    +
    +
    ); } diff --git a/samples/todo/pages/api/auth/[...nextauth].ts b/samples/todo/pages/api/auth/[...nextauth].ts index c6c632b57..42a94b549 100644 --- a/samples/todo/pages/api/auth/[...nextauth].ts +++ b/samples/todo/pages/api/auth/[...nextauth].ts @@ -1,6 +1,5 @@ import NextAuth, { NextAuthOptions, User } from 'next-auth'; import CredentialsProvider from 'next-auth/providers/credentials'; -import GoogleProvider from 'next-auth/providers/google'; import { authorize, NextAuthAdapter as Adapter, @@ -8,7 +7,6 @@ import { import service from '@zenstackhq/runtime'; import { nanoid } from 'nanoid'; import { SpaceUserRole } from '@zenstackhq/runtime/types'; -import { signIn } from 'next-auth/react'; export const authOptions: NextAuthOptions = { // Configure one or more authentication providers @@ -20,11 +18,6 @@ export const authOptions: NextAuthOptions = { }, providers: [ - GoogleProvider({ - clientId: process.env.GOOGLE_ID!, - clientSecret: process.env.GOOGLE_SECRET!, - }), - CredentialsProvider({ credentials: { email: { diff --git a/samples/todo/pages/create-space.tsx b/samples/todo/pages/create-space.tsx index b8b2023e2..c24e90b3e 100644 --- a/samples/todo/pages/create-space.tsx +++ b/samples/todo/pages/create-space.tsx @@ -1,7 +1,6 @@ import { NextPage } from 'next'; import { FormEvent, useState } from 'react'; import { useSpace, type HooksError } from '@zenstackhq/runtime/hooks'; -import AuthGuard from 'components/AuthGuard'; import { ServerErrorCode } from '@zenstackhq/runtime/server'; import { toast } from 'react-toastify'; import { useRouter } from 'next/router'; @@ -53,7 +52,6 @@ const CreateSpace: NextPage = () => { }; return ( -

    Create a space

    @@ -110,7 +108,6 @@ const CreateSpace: NextPage = () => {
    - ); }; diff --git a/samples/todo/pages/index.tsx b/samples/todo/pages/index.tsx index 5ab7a821c..3e13551af 100644 --- a/samples/todo/pages/index.tsx +++ b/samples/todo/pages/index.tsx @@ -22,7 +22,7 @@ const Home: NextPage = () => { Welcome {session.user.name || session.user.email}!
    -
    +