adjustments to add team role and other better stuff
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
FaPeopleCarry,
|
FaPeopleCarry,
|
||||||
FaAngleDown,
|
FaAngleDown,
|
||||||
FaCheck,
|
FaCheck,
|
||||||
|
FaDatabase,
|
||||||
} from "react-icons/fa";
|
} from "react-icons/fa";
|
||||||
import { useTeamDashboardContext } from "../../contexts/teamDashboardContext";
|
import { useTeamDashboardContext } from "../../contexts/teamDashboardContext";
|
||||||
import router from "next/router";
|
import router from "next/router";
|
||||||
@@ -77,6 +78,12 @@ export default function Header() {
|
|||||||
|
|
||||||
const TeamsMenu = (
|
const TeamsMenu = (
|
||||||
<Menu key={2} title="teams">
|
<Menu key={2} title="teams">
|
||||||
|
<Menu.Item key={1} icon={<FaDatabase />}>
|
||||||
|
<button onClick={handleAdminRoute}>Admin</button>
|
||||||
|
</Menu.Item>
|
||||||
|
|
||||||
|
<Menu.Divider />
|
||||||
|
|
||||||
{/* all current teams that this person is a part of */}
|
{/* all current teams that this person is a part of */}
|
||||||
{usersTeams &&
|
{usersTeams &&
|
||||||
usersTeams.map((uteam, i) => {
|
usersTeams.map((uteam, i) => {
|
||||||
@@ -100,6 +107,7 @@ export default function Header() {
|
|||||||
|
|
||||||
<Menu.Divider />
|
<Menu.Divider />
|
||||||
|
|
||||||
|
{/* create TEAM */}
|
||||||
<Menu.Item key={"createteam"} icon={<FaPeopleCarry />}>
|
<Menu.Item key={"createteam"} icon={<FaPeopleCarry />}>
|
||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@@ -107,19 +115,13 @@ export default function Header() {
|
|||||||
router.push("/teams/create");
|
router.push("/teams/create");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
create team
|
Create Team
|
||||||
</button>
|
</button>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
const UserMenu = (
|
const UserMenu = (
|
||||||
<Menu title="user menu">
|
<Menu title="user menu">
|
||||||
<Menu.Item key={1}>
|
|
||||||
<button onClick={handleAdminRoute}>Admin</button>
|
|
||||||
</Menu.Item>
|
|
||||||
|
|
||||||
<Menu.Divider />
|
|
||||||
|
|
||||||
<Menu.Item key={2}>
|
<Menu.Item key={2}>
|
||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@@ -192,7 +194,6 @@ export default function Header() {
|
|||||||
<FaBell className="text-lg text-gray-400 hover:text-white ease-in-out duration-300 hover:scale-110 hover:cursor-pointer" />
|
<FaBell className="text-lg text-gray-400 hover:text-white ease-in-out duration-300 hover:scale-110 hover:cursor-pointer" />
|
||||||
<FaHeadphonesAlt className="text-lg text-gray-400 hover:text-white ease-in-out duration-300 hover:scale-110 hover:cursor-pointer" />
|
<FaHeadphonesAlt className="text-lg text-gray-400 hover:text-white ease-in-out duration-300 hover:scale-110 hover:cursor-pointer" />
|
||||||
<FaMicrophoneAlt className="text-lg text-gray-400 hover:text-white ease-in-out duration-300 hover:scale-110 hover:cursor-pointer" />
|
<FaMicrophoneAlt className="text-lg text-gray-400 hover:text-white ease-in-out duration-300 hover:scale-110 hover:cursor-pointer" />
|
||||||
<FaTh className="text-lg text-gray-400 hover:text-white ease-in-out duration-300 hover:scale-110 hover:cursor-pointer" />
|
|
||||||
|
|
||||||
{/* teams menu */}
|
{/* teams menu */}
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ export default function TeamVoiceLine() {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span className={"text-xs span-sans text-gray-300"}>
|
<span className={"text-xs span-sans text-gray-300"}>
|
||||||
{tmember.firstName + " " + tmember.lastName}
|
{tmember.teamRole}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|||||||
+31
-23
@@ -1,33 +1,41 @@
|
|||||||
import { documentId, Firestore, serverTimestamp, Timestamp } from "firebase/firestore";
|
import {
|
||||||
|
documentId,
|
||||||
|
Firestore,
|
||||||
|
serverTimestamp,
|
||||||
|
Timestamp,
|
||||||
|
} from "firebase/firestore";
|
||||||
import IFirestoreSerializable from "./firestoreSerializable";
|
import IFirestoreSerializable from "./firestoreSerializable";
|
||||||
|
|
||||||
export class User {
|
export class User {
|
||||||
id: string;
|
id: string;
|
||||||
emailAddress: string;
|
emailAddress: string;
|
||||||
nickName: string;
|
nickName: string;
|
||||||
firstName: string;
|
firstName: string;
|
||||||
lastName: string;
|
lastName: string;
|
||||||
avatarUrl: string;
|
avatarUrl: string;
|
||||||
userStatus: UserStatus
|
userStatus: UserStatus;
|
||||||
|
|
||||||
createdDate: Timestamp;
|
/**designer? dev? */
|
||||||
lastUpdatedDate: Timestamp;
|
teamRole: string;
|
||||||
|
|
||||||
// serialize() {
|
createdDate: Timestamp;
|
||||||
// return {
|
lastUpdatedDate: Timestamp;
|
||||||
// createdDate: Timestamp.fromDate(this.createdDate),
|
|
||||||
// lastUpdatedDate: Timestamp.fromDate(this.lastUpdatedDate)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// deserialize(firestoreData: {}) {
|
// serialize() {
|
||||||
// this.lastUpdatedDate = firestoreData.lastUpdatedDate.toDate()
|
// return {
|
||||||
// }
|
// createdDate: Timestamp.fromDate(this.createdDate),
|
||||||
|
// lastUpdatedDate: Timestamp.fromDate(this.lastUpdatedDate)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// deserialize(firestoreData: {}) {
|
||||||
|
// this.lastUpdatedDate = firestoreData.lastUpdatedDate.toDate()
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum UserStatus {
|
export enum UserStatus {
|
||||||
online = "online",
|
online = "online",
|
||||||
offline = "offline",
|
offline = "offline",
|
||||||
inCall = "in call",
|
inCall = "in call",
|
||||||
busy = "busy"
|
busy = "busy",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,11 +109,8 @@ function TeamAdmin() {
|
|||||||
team.companySite = companySite;
|
team.companySite = companySite;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check again that the team has allowed count of people
|
|
||||||
|
|
||||||
// create invites for new people
|
|
||||||
|
|
||||||
// update team name and company site if it changed
|
// update team name and company site if it changed
|
||||||
|
await teamService.updateTeam(team);
|
||||||
|
|
||||||
// take user back to team dashboard
|
// take user back to team dashboard
|
||||||
router.push("/teams/" + team.id);
|
router.push("/teams/" + team.id);
|
||||||
|
|||||||
+44
-22
@@ -68,6 +68,9 @@ export default function Profile() {
|
|||||||
} else if (nickname.length > 22) {
|
} else if (nickname.length > 22) {
|
||||||
setError("nickname must be less than 22 characters");
|
setError("nickname must be less than 22 characters");
|
||||||
return;
|
return;
|
||||||
|
} else if (!teamRole) {
|
||||||
|
setError("Must input team role!");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the user in the backend or just merge results
|
// create the user in the backend or just merge results
|
||||||
@@ -77,6 +80,7 @@ export default function Profile() {
|
|||||||
newUser.lastName = lastName;
|
newUser.lastName = lastName;
|
||||||
newUser.nickName = nickname;
|
newUser.nickName = nickname;
|
||||||
newUser.avatarUrl = currUser.photoURL;
|
newUser.avatarUrl = currUser.photoURL;
|
||||||
|
newUser.teamRole = teamRole;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await userService.updateUser(newUser);
|
await userService.updateUser(newUser);
|
||||||
@@ -93,11 +97,12 @@ export default function Profile() {
|
|||||||
);
|
);
|
||||||
const [lastName, setLastName] = useState<string>("");
|
const [lastName, setLastName] = useState<string>("");
|
||||||
const [nickname, setNickname] = useState<string>("");
|
const [nickname, setNickname] = useState<string>("");
|
||||||
|
const [teamRole, setTeamRole] = useState<string>("");
|
||||||
const [error, setError] = useState<string>("");
|
const [error, setError] = useState<string>("");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form
|
<form
|
||||||
className="container mx-auto flex flex-col max-w-md m-10 bg-white p-10 rounded-lg shadow-md space-y-5"
|
className="container mx-auto max-w-screen-sm flex flex-col m-10 bg-white p-10 rounded-lg shadow-md space-y-5"
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
>
|
>
|
||||||
{/* header */}
|
{/* header */}
|
||||||
@@ -132,32 +137,36 @@ export default function Profile() {
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span className="flex flex-col items-start">
|
<div className="flex flex-row justify-between space-x-3">
|
||||||
<span className="text-md">First Name</span>
|
<span className="flex flex-col items-start flex-1">
|
||||||
<span className="text-gray-300 text-xs mb-2"></span>
|
<span className="text-md">First Name</span>
|
||||||
<input
|
<span className="text-gray-300 text-xs mb-2"></span>
|
||||||
placeholder="ex. John"
|
<input
|
||||||
className="w-full rounded-lg bg-gray-50 p-3"
|
placeholder="ex. John"
|
||||||
value={firstName}
|
className="w-full rounded-lg bg-gray-50 p-3"
|
||||||
onChange={(e) => setFirstName(e.target.value)}
|
value={firstName}
|
||||||
/>
|
onChange={(e) => setFirstName(e.target.value)}
|
||||||
</span>
|
/>
|
||||||
|
</span>
|
||||||
|
|
||||||
<span className="flex flex-col items-start">
|
<span className="flex flex-col items-start flex-1">
|
||||||
<span className="text-md">Last Name</span>
|
<span className="text-md">Last Name</span>
|
||||||
<span className="text-gray-300 text-xs mb-2"></span>
|
<span className="text-gray-300 text-xs mb-2"></span>
|
||||||
<input
|
<input
|
||||||
placeholder="ex. Brown"
|
placeholder="ex. Brown"
|
||||||
className="w-full rounded-lg bg-gray-50 p-3"
|
className="w-full rounded-lg bg-gray-50 p-3"
|
||||||
value={lastName}
|
value={lastName}
|
||||||
onChange={(e) => setLastName(e.target.value)}
|
onChange={(e) => setLastName(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Divider />
|
||||||
|
|
||||||
<span className="flex flex-col items-start">
|
<span className="flex flex-col items-start">
|
||||||
<span className="text-md">Nickname</span>
|
<span className="text-md">Nickname</span>
|
||||||
<span className="text-gray-300 text-xs mb-2">
|
<span className="text-gray-300 text-xs mb-2">
|
||||||
What does your team call you?
|
What does your team call you? This is what is displayed.
|
||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
placeholder="ex. nicky"
|
placeholder="ex. nicky"
|
||||||
@@ -167,6 +176,19 @@ export default function Profile() {
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span className="flex flex-col items-start">
|
||||||
|
<span className="text-md">Role</span>
|
||||||
|
<span className="text-gray-300 text-xs mb-2">
|
||||||
|
Are you a developer? designer? manager?
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
placeholder="ex. designer"
|
||||||
|
className="w-full rounded-lg bg-gray-50 p-3"
|
||||||
|
value={teamRole}
|
||||||
|
onChange={(e) => setTeamRole(e.target.value)}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<span className="flex flex-row justify-end space-x-2">
|
<span className="flex flex-row justify-end space-x-2">
|
||||||
|
|||||||
@@ -52,6 +52,15 @@ export default class TeamService implements IService {
|
|||||||
return teamDocRef.id;
|
return teamDocRef.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateTeam(team: Team) {
|
||||||
|
const docRef = doc(this.db, Collections.teams, team.id);
|
||||||
|
await setDoc(
|
||||||
|
docRef,
|
||||||
|
{ ...team, lastUpdatedDate: serverTimestamp() },
|
||||||
|
{ merge: true }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async getTeam(teamId: string): Promise<Team | null> {
|
async getTeam(teamId: string): Promise<Team | null> {
|
||||||
const docRef = doc(this.db, Collections.teams, teamId);
|
const docRef = doc(this.db, Collections.teams, teamId);
|
||||||
const docSnap = await getDoc(docRef);
|
const docSnap = await getDoc(docRef);
|
||||||
|
|||||||
Reference in New Issue
Block a user