diff --git a/pages/teams/create.js b/pages/teams/create.js
new file mode 100644
index 0000000..188d096
--- /dev/null
+++ b/pages/teams/create.js
@@ -0,0 +1,6 @@
+export default function CreateTeam() {
+
+ return (
+
this is the place to create a team
+ )
+}
\ No newline at end of file
diff --git a/pages/teams/index.tsx b/pages/teams/index.tsx
index 0ffea2d..b84f961 100644
--- a/pages/teams/index.tsx
+++ b/pages/teams/index.tsx
@@ -7,18 +7,24 @@ import { GetServerSidePropsContext } from "next"
import nookies from 'nookies'
import firebaseAdmin from 'firebase-admin'
import unfetch from 'isomorphic-unfetch'
+import {
+ FaPeopleCarry,
+ FaArrowRight,
+ FaBullhorn
+} from "react-icons/fa";
+import BackgroundLayout from "../../components/Layouts/BackgroundLayout"
/**
* figure out where to take the user based on everything
*/
-function RouteHandler({ user }) {
+function RouteHandler() {
const { currUser } = useAuth()
const router = useRouter()
const userService: UserService = new UserService()
- const [loading, setLoading] = useState(false)
+ const [loading, setLoading] = useState(true)
+ const [user, setUser] = useState(null)
useEffect(() => {
-
(async function() {
try {
// if not authenticated, take user to the login
@@ -28,31 +34,72 @@ function RouteHandler({ user }) {
}
// get user
- const user: User | null = await userService.getUser(currUser.uid)
- console.log(user)
+ const returnedUser: User | null = await userService.getUser(currUser.uid)
+ console.log(returnedUser)
// if user has no profile, then go to create profile
- if (!user || !user.firstName || !user.lastName || !user.nickName) {
+ if (!returnedUser || !returnedUser.firstName || !returnedUser.lastName || !returnedUser.nickName) {
console.log('no profile for the user, routing him/her there')
router.push('/teams/profile')
}
-
- // check if user is in a team go to the team dashboard
-
+ setUser(returnedUser)
+ // check if user is in a team go to the team dashboard
} catch(error) {
console.log(error)
router.push('/teams/login')
}
})();
+
+ setLoading(false)
}, [currUser])
- if (loading) {
+ if (loading || !user) {
return
figuring out where you should go
}
+ // not in a team yet, and have not created a team yet
return (
-
this is the route handler page
+
+ {/* header */}
+
+
+
👋Hey, {user.firstName}
+ Let's get you started
+
+
+
+
+
+ {/* create team hover thing */}
+
+
+ {/* tell your manager to add your email */}
+
+
+
+
+ Remind Your Manager
+ Your account email is {user.emailAddress}
+
+
+
+
+ Learn more about router.push('/teams/landing')} className="underline font-satisfy text-xl text-teal-500 decoration-teal-500">nirvana
+
)
}
diff --git a/pages/teams/profile.tsx b/pages/teams/profile.tsx
index ff24492..9ee8b1f 100644
--- a/pages/teams/profile.tsx
+++ b/pages/teams/profile.tsx
@@ -44,7 +44,9 @@ export default function Profile() {
})();
}, [])
- async function handleSubmit() {
+ async function handleSubmit(e) {
+ e.preventDefault();
+
if (!firstName) {
setError('Must input first name')
return
@@ -133,7 +135,7 @@ export default function Profile() {
{
user && user.nickName ?
<>
- Cancel
+ router.push('/teams') } className="bg-gray-100 py-2 px-5 rounded text-gray-400">Cancel
Save