From 47c55fbc2672aa76f692d8f205d1ade10dcba2ce Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Fri, 14 Jan 2022 02:57:06 -0800 Subject: [PATCH] nice page for team creation --- pages/teams/create.js | 6 --- pages/teams/create.tsx | 82 +++++++++++++++++++++++++++++++++++++++++ pages/teams/profile.tsx | 16 ++++---- 3 files changed, 90 insertions(+), 14 deletions(-) delete mode 100644 pages/teams/create.js create mode 100644 pages/teams/create.tsx diff --git a/pages/teams/create.js b/pages/teams/create.js deleted file mode 100644 index 188d096..0000000 --- a/pages/teams/create.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function CreateTeam() { - - return ( -
this is the place to create a team
- ) -} \ No newline at end of file diff --git a/pages/teams/create.tsx b/pages/teams/create.tsx new file mode 100644 index 0000000..fbf8ce0 --- /dev/null +++ b/pages/teams/create.tsx @@ -0,0 +1,82 @@ +import { Divider } from "antd"; +import { useRouter } from "next/router"; +import { useEffect, useState } from "react"; +import { useAuth } from "../../contexts/authContext"; +import { User, UserStatus } from "../../models/user"; + +const initialSite: string = 'https://' +export default function CreateTeam() { + const { currUser, logOut } = useAuth() + const [error, setError] = useState('') + const router = useRouter() + + useEffect(() => { + (async function() { + try { + // if not authenticated, take user to the login + if (!currUser) { + console.log('not authenticated...routing from dashboard to teams home') + // router.push('/teams/login') + } + + } catch(error) { + console.log(error) + router.push('/teams/login') + } + })(); + }, []) + + function handleSubmit(e) { + e.preventDefault() + + if (!teamName) { + setError('You must input a team name!') + } + + if (companySite == initialSite) { + // make sure to put null in database for the team + } + + // provision a team with state of initiated + } + + const [teamName, setTeamName] = useState('') + const [companySite, setcompanySite] = useState(initialSite) + + return ( +
+ {/* header */} +
🙌Create a Team
+ + { + error && {error} + } + + + + + Team Name + Everyone in your team will see this. You can always change this later. + setTeamName(e.target.value)} /> + + + + Company Site + optional + setcompanySite(e.target.value)} /> + + + + + + + + + + ) +} \ No newline at end of file diff --git a/pages/teams/profile.tsx b/pages/teams/profile.tsx index 9ee8b1f..336ff46 100644 --- a/pages/teams/profile.tsx +++ b/pages/teams/profile.tsx @@ -105,26 +105,26 @@ export default function Profile() { Email - This is set from your Google account and cannot be changed. - + This is set from your Google account and cannot be changed. + First Name - - setFirstName(e.target.value)} /> + + setFirstName(e.target.value)} /> Last Name - - setLastName(e.target.value)} /> + + setLastName(e.target.value)} /> Nickname - What does your team call you? - setNickname(e.target.value)} /> + What does your team call you? + setNickname(e.target.value)} />