diff --git a/models/team.ts b/models/team.ts
index ae9b5a5..ea4cdef 100644
--- a/models/team.ts
+++ b/models/team.ts
@@ -2,11 +2,12 @@ import { Timestamp } from "firebase/firestore";
export class Team {
id: string;
- name:string;
+ name: string;
status: TeamStatus;
- allowedUserCount:number;
+ allowedUserCount: number;
+ subscriptionPlan: TeamSubscriptionPlan;
companySite: string;
@@ -19,5 +20,11 @@ export class Team {
export enum TeamStatus {
created = "created",
deactivated = "deactivated",
- deleted = "deleted"
-}
\ No newline at end of file
+ deleted = "deleted",
+}
+
+export enum TeamSubscriptionPlan {
+ free = "free",
+ basic = "basic",
+ pro = "pro",
+}
diff --git a/pages/pricing.tsx b/pages/pricing.tsx
new file mode 100644
index 0000000..a42bc65
--- /dev/null
+++ b/pages/pricing.tsx
@@ -0,0 +1,3 @@
+export default function Pricing() {
+ return
this is the pricing page
;
+}
diff --git a/pages/teams/index.tsx b/pages/teams/index.tsx
index 6d14974..693a954 100644
--- a/pages/teams/index.tsx
+++ b/pages/teams/index.tsx
@@ -5,11 +5,19 @@ import UserService from "../../services/userService";
import { User } from "../../models/user";
import { GetServerSidePropsContext } from "next";
import firebaseAdmin from "firebase-admin";
-import { FaPeopleCarry, FaArrowRight, FaBullhorn } from "react-icons/fa";
+import {
+ FaPeopleCarry,
+ FaArrowRight,
+ FaBullhorn,
+ FaPlus,
+} from "react-icons/fa";
import BackgroundLayout from "../../components/Layouts/BackgroundLayout";
import TeamService from "../../services/teamService";
import Loading from "../../components/Loading";
import { TeamMemberStatus } from "../../models/teamMember";
+import { Divider, Tooltip } from "antd";
+import { Team } from "../../models/team";
+import moment from "moment";
/**
* figure out where to take the user based on everything
@@ -24,6 +32,7 @@ function RouteHandler() {
const [loading, setLoading] = useState(true);
const [user, setUser] = useState(null);
+ const [teams, setTeams] = useState([]);
useEffect(() => {
(async function () {
@@ -55,37 +64,14 @@ function RouteHandler() {
}
setUser(returnedUser);
- // check if user is in a team go to the team dashboard
- const returnedTeamMembers = await teamService.getTeamMembersByUserId(
- currUser.uid
+ // get all teams that this user id is active in
+ // get all of the teams that this user's email is invited to
+ const teams: Team[] = await teamService.getActiveOrInvitedTeamsbyUser(
+ currUser.uid,
+ returnedUser.emailAddress
);
- // if the user is deleted from a team, don't let them go there
- var teamId = "";
- returnedTeamMembers.map((tm) => {
- if (tm.status != TeamMemberStatus.deleted) {
- console.log(
- "in a team! going to the team dashboard of the first one!"
- );
-
- teamId = returnedTeamMembers[0].teamId;
- }
- });
-
- if (teamId) {
- router.push("/teams/" + teamId);
- return;
- }
-
- // last chance, if they are invited to a team, check for it
- const invitedTeamMember = await teamService.getTeamMembersByEmailInvite(
- currUser.email?.toLocaleLowerCase()
- );
-
- if (invitedTeamMember.length > 0) {
- router.push("/teams/" + invitedTeamMember[0].teamId);
- return;
- }
+ setTeams(teams);
setLoading(false);
} catch (error) {
@@ -93,7 +79,7 @@ function RouteHandler() {
router.push("/teams/login");
}
})();
- }, [currUser]);
+ }, []);
if (loading || !user) {
return ;
@@ -101,7 +87,7 @@ function RouteHandler() {
// not in a team yet, and have not created a team yet
return (
-