diff --git a/components/RoomCard.tsx b/components/RoomCard.tsx index 2ba056c..1810072 100644 --- a/components/RoomCard.tsx +++ b/components/RoomCard.tsx @@ -1,11 +1,11 @@ import { BsThreeDots } from "react-icons/bs"; import { FaBell, FaClock, FaLink } from "react-icons/fa"; import { IoTimer } from "react-icons/io5"; -import Room from "../models/room"; +import Room, { RoomStatus } from "../models/room"; import RoomTypeTag from "./RoomTypeTag"; import Image from "next/image"; import { useAuth } from "../contexts/authContext"; -import { Avatar, Divider, Tooltip } from "antd"; +import { Avatar, Divider, Dropdown, Menu, Tooltip } from "antd"; import { UserOutlined, AntDesignOutlined } from "@ant-design/icons"; import { useTeamDashboardContext } from "../contexts/teamDashboardContext"; import { User } from "../models/user"; @@ -166,10 +166,45 @@ export default function RoomCard(props: IRoomCardProps) { setLoading(false); } + async function handleArchivingRoom() { + if ( + confirm( + "Are you sure you want to archive room? It will be added to the archived tab." + ) + ) { + console.log("archiving room"); + + try { + const newRoom: Room = { ...props.room }; + + newRoom.status = RoomStatus.archived; + newRoom.membersInRoom = []; + await roomService.updateRoom(newRoom); + } catch (error) {} + } + } + if (loading) { return ; } + const RoomOptionsMenu = ( + + + + 1st menu item + + + + Archive Room + + + ); + return ( )} - {" "} + + + + ); diff --git a/pages/teams/dashboard.tsx b/pages/teams/dashboard.tsx index d909960..b6176d4 100644 --- a/pages/teams/dashboard.tsx +++ b/pages/teams/dashboard.tsx @@ -1,847 +1,1062 @@ -import Image from 'next/image'; -import React, { useState } from 'react'; -import { FaMicrophoneAlt, - FaHeadphonesAlt, - FaTh, - FaAngleDown, - FaPlusSquare, - FaBroom, - FaBell, - FaFilePdf, - FaCopy, - FaClock, - FaPlay, - FaPlus, - FaCheck, - FaCode, - FaLink, - FaExternalLinkAlt, - FaArchive, - FaAtlassian, - FaSearch - +import Image from "next/image"; +import React, { useState } from "react"; +import { + FaMicrophoneAlt, + FaHeadphonesAlt, + FaTh, + FaAngleDown, + FaPlusSquare, + FaBroom, + FaBell, + FaFilePdf, + FaCopy, + FaClock, + FaPlay, + FaPlus, + FaCheck, + FaCode, + FaLink, + FaExternalLinkAlt, + FaArchive, + FaAtlassian, + FaSearch, } from "react-icons/fa"; import { IoPulseOutline, IoRemoveOutline, IoTimer } from "react-icons/io5"; import { BsThreeDots } from "react-icons/bs"; -import { UserStatus, User } from '../../models/user' -import { KeyCode } from '../../globals/keycode' +import { UserStatus, User } from "../../models/user"; +import { KeyCode } from "../../globals/keycode"; -import { useRouter } from 'next/router' -import { useEffect } from 'react' +import { useRouter } from "next/router"; +import { useEffect } from "react"; -import { useAuth } from '../../contexts/authContext' +import { useAuth } from "../../contexts/authContext"; -let testFriends = [ +let testFriends = [ { - name: "Liam", - role: "engineer", - systemAvatar: "29", - status: UserStatus.online + name: "Liam", + role: "engineer", + systemAvatar: "29", + status: UserStatus.online, }, { - name: "Emily", - role: "engineer", - systemAvatar: "02", - status: UserStatus.online + name: "Emily", + role: "engineer", + systemAvatar: "02", + status: UserStatus.online, }, { - name: "Paul", - role: "architect", - systemAvatar: "43", - status: UserStatus.online + name: "Paul", + role: "architect", + systemAvatar: "43", + status: UserStatus.online, }, { - name: "Mark", - role: "engineer", - systemAvatar: "04", - status: UserStatus.busy + name: "Mark", + role: "engineer", + systemAvatar: "04", + status: UserStatus.busy, }, { - name: "Adriana", - role: "design", - systemAvatar: "06", - status: UserStatus.busy + name: "Adriana", + role: "design", + systemAvatar: "06", + status: UserStatus.busy, }, { - name: "Josh", - role: "design", - systemAvatar: "05", - status: UserStatus.offline - } -] + name: "Josh", + role: "design", + systemAvatar: "05", + status: UserStatus.offline, + }, +]; export default function Dashboard() { - const { currUser, logOut } = useAuth() - const router = useRouter() + const { currUser, logOut } = useAuth(); + const router = useRouter(); useEffect(() => { // if not authenticated, take user to the login if (!currUser) { - console.log('not authenticated...routing from dashboard to teams home') - router.push('/teams/login') + console.log("not authenticated...routing from dashboard to teams home"); + router.push("/teams/login"); } - }, [currUser]) + }, [currUser]); - const [selectedChannel, setSelectedChannel] = useState(null) + const [selectedChannel, setSelectedChannel] = useState(null); - console.log("in dashboard " + currUser) + console.log("in dashboard " + currUser); async function handleSignOut() { - console.log("clicked log out button") + console.log("clicked log out button"); try { - await logOut() + await logOut(); - router.push('/teams') - } catch(error) { - console.log(error) + router.push("/teams"); + } catch (error) { + console.log(error); } } function statusBubble(status: UserStatus) { - console.log(status) + console.log(status); - switch(status) { - case UserStatus.online: - return - case UserStatus.busy: - return - case UserStatus.offline: - return - default: - return + switch (status) { + case UserStatus.online: + return ( + + ); + case UserStatus.busy: + return ( + + ); + case UserStatus.offline: + return ( + + ); + default: + return ( + + ); } -} - - function renderPulse(status: UserStatus) { - switch(status) { - case UserStatus.online: - return - case UserStatus.busy: - return - case UserStatus.offline: - return - default: - return - } } - function handleKeyboardShortcut (event) { - console.log(event.keyCode) + function renderPulse(status: UserStatus) { + switch (status) { + case UserStatus.online: + return ( + + ); + case UserStatus.busy: + return ( + + ); + case UserStatus.offline: + return ( + + ); + default: + return ( + + ); + } + } - switch(event.keyCode) { - case KeyCode.Escape: - setSelectedChannel(null) - break - case KeyCode.Zero: - setSelectedChannel(0) - break - case KeyCode.One: - setSelectedChannel(1) - break - case KeyCode.Two: - setSelectedChannel(2) - break - case KeyCode.Three: - setSelectedChannel(3) - break - case KeyCode.Four: - setSelectedChannel(4) - break - case KeyCode.Five: - setSelectedChannel(5) - break - default: - return - } + function handleKeyboardShortcut(event) { + console.log(event.keyCode); + + switch (event.keyCode) { + case KeyCode.Escape: + setSelectedChannel(null); + break; + case KeyCode.Zero: + setSelectedChannel(0); + break; + case KeyCode.One: + setSelectedChannel(1); + break; + case KeyCode.Two: + setSelectedChannel(2); + break; + case KeyCode.Three: + setSelectedChannel(3); + break; + case KeyCode.Four: + setSelectedChannel(4); + break; + case KeyCode.Five: + setSelectedChannel(5); + break; + default: + return; + } } return ( <> -
- {/* header content */} -
- {/* welcome message */} - - πŸ‘‹Hey Arjun, Good Afternoon! - - {/* Date and time */} - - Tues, Jan 11th - 1:34am - - - - {/* header control section */} - - - {/* search bar */} -
- - - - - -
- - - - - - - {/* avatar */} - - - - profile - -
-
- -
- {/* personal line */} -
- - - TEAM - - - - - - {/* list of team members */} - { - testFriends.map((friend, i) => { - return ( - - - - - {statusBubble(friend.status)} - - profile - - - - - {friend.name} - { - selectedChannel == i ? - <> - - - - : - - } - - - - {friend.role} - - - {renderPulse(friend.status)} - - ) - }) - } -
- -
- {/* pinned */} -
- - - ANNOUNCEMENTS - - - updates, pep talks, blockers, reminders - - - {/* tab pane */} - - Active - - Resolved - - - - TODAY - - - - - - -
- {/* adriana's announcement */} - - - - - {statusBubble(UserStatus.busy)} - - profile - - - - Adriana - 5 minutes ago - - blockers - - - - - {/* arjun's announcement */} - - - - - {statusBubble(UserStatus.busy)} - - profile - - - - Arjun - 30 minutes ago - - engineering - - - - - -
-
- - {/* rooms */} -
- - ROOMS - - - - {/* tab pane */} - - All - - Live - - Scheduled - - Recurring - - - - Week - - - - - - - - {/* all rooms */} - - {/* spontaneous bugs room */} - - {/* header */} - - {/* meeting details */} - - bug fixing - were just fixing that jsx bug thats a paiiinnnn - - {/* badges and tags */} - - - blockers - - - - engineering - - - - - {/* room status */} - - - - live - - - {/* room attachments */} - - - - - - - - - - {/* footer */} - - - - - profile - - - - profile - - - - Arjun and Liam - - - - - - - {/* live room - design meeting */} - - {/* header */} - - {/* meeting details */} - - Shopping Cart Experience - lets finish the mockups @josh, @mark, and @arjun please step in for feedback - - {/* badges and tags */} - - - design - - - - - {/* room status */} - - - - live - - on and off all day - - {/* room attachments */} - - - - - - - - - {/* footer */} - - - - - profile - - - - Adriana - - - - - - - - {/* scheduled room - one on one */} - - {/* header */} - - {/* meeting details */} - - Arjun and Paul - One on one - performance review - - {/* badges and tags */} - - - private - - - - - {/* room status */} - - - - scheduled - - - 3ish? Ill ping you Arjun - - - - {/* footer */} - - - - - - - {/* recurring room - dsu */} - - {/* header */} - - {/* meeting details */} - - - Daily Standup - - - - {/* badges and tags */} - - - scrum - - - - engineering - - - - - {/* room status */} - - - - recurring - - - 10am daily - - - - {/* footer */} - - - - - - - - - - {/* recurring room - demo */} - - {/* header */} - - {/* meeting details */} - - - Sprint Demo - - all hands on deck...lets have fun :) - - {/* badges and tags */} - - - scrum - - - - - {/* room status */} - - - - recurring - - - biweekly fridays! - - - - {/* footer */} - - - - - - - - - - - {/* recurring room - wine wednesdays */} - - {/* header */} - - {/* meeting details */} - - - Wine Wednesdays - - @JOSH YOU BETTER COME - - {/* badges and tags */} - - - party πŸŽ‰ - - - - - {/* room status */} - - - - recurring - - - wednesdays 7-9pm - - - - {/* footer */} - - - - - - - - - - -
-
+
+ {/* header content */} +
+ {/* welcome message */} + + + πŸ‘‹Hey Arjun, Good Afternoon! + + + {/* Date and time */} + + + Tues, Jan 11th + + + 1:34am + + + + + {/* header control section */} + + + {/* search bar */} +
+ + + + +
- {/* attachments */} -
- {/* header row */} - - - Attachments - - - - code, links (jira tickets, drive folders, powerpoints), screenshots + + + + + + {/* avatar */} + + + + profile + + +
+ +
+ {/* personal line */} +
+ + + TEAM + + + + + + {/* list of team members */} + {testFriends.map((friend, i) => { + return ( + + + + + {statusBubble(friend.status)} + + profile + + + + + + {friend.name}{" "} + + {selectedChannel == i ? ( + <> + + + ) : ( + + )} - {/* tab pane */} - - Team - - Personal - - Favorites + + {friend.role} + - - TODAY - - - - - - - + {renderPulse(friend.status)} - - {/* row of attachments */} -
- {/* pdf example */} - - {/* attmnt header */} - - + ); + })} +
- - report.pdf - - - blockers - - +
+ {/* pinned */} +
+ + + + ANNOUNCEMENTS + + + + updates, pep talks, blockers, reminders + + - {/* attachment actions */} - - + {/* tab pane */} + + + Active + - - + + Resolved + + - {/* attmnt footer */} - - - - - profile - - + + TODAY + - - Adriana - 5 minutes ago - + + + - - +
+ {/* adriana's announcement */} + + + + + {statusBubble(UserStatus.busy)} + + profile + + + + + Adriana - - {/* jira example */} - - {/* attmnt header */} - - - - - RAM-22 - technical doc - stripe - - - engineering - - - - {/* attachment actions */} - - - - - - - {/* attmnt footer */} - - - - - profile - - - - - Paul - 2 hours ago - - - - + 5 minutes ago + + blockers -
+ + + + {/* arjun's announcement */} + + + + + {statusBubble(UserStatus.busy)} + + profile + + + + Arjun + + 30 minutes ago + + + engineering + + + + + +
-
- -
- {/* dynamic footer based on selection */} -
- - + + {/* rooms */} +
+ + + ROOMS + + + + {/* tab pane */} + + + All + + + + Live + + + + Scheduled + + + + Recurring + + + + + Week + + + + + + + + {/* all rooms */} + + {/* spontaneous bugs room */} + + {/* header */} + + {/* meeting details */} + + + bug fixing + + + were just fixing that jsx bug thats a paiiinnnn + + + {/* badges and tags */} + + + blockers + + + + engineering + + + + + {/* room status */} + + + + live + + + {/* room attachments */} + + + + + + + + + {/* footer */} + + + - - {statusBubble(UserStatus.online)} - - profile + profile + + + + profile + - - - {selectedChannel == null ? "" : testFriends[selectedChannel].name} - - {selectedChannel == null ? "" : testFriends[selectedChannel].role} - + + Arjun and Liam + + + {" "} + - {/* shortcuts */} - - - R + {/* live room - design meeting */} + + {/* header */} + + {/* meeting details */} + + + Shopping Cart Experience + + + lets finish the mockups @josh, @mark, and @arjun please + step in for feedback + + + {/* badges and tags */} + + + design + + - - SPACE + + {/* room status */} + + + + live + + + on and off all day + + + {/* room attachments */} + + + + + + + + {/* footer */} + + + + + profile + + + + Adriana + + + + + + + {/* scheduled room - one on one */} + + {/* header */} + + {/* meeting details */} + + + Arjun and Paul - One on one + + + performance review + + + {/* badges and tags */} + + + private + + + + + {/* room status */} + + + + scheduled + + + + 3ish? Ill ping you Arjun + + + + + {/* footer */} + + + {" "} + + + + {/* recurring room - dsu */} + + {/* header */} + + {/* meeting details */} + + + Daily Standup + + + + {/* badges and tags */} + + + scrum + + + + engineering + + + + + {/* room status */} + + + + recurring + + + 10am daily + + + + {/* footer */} + + + + {" "} + + + + {/* recurring room - demo */} + + {/* header */} + + {/* meeting details */} + + + Sprint Demo + + + all hands on deck...lets have fun :) + + + {/* badges and tags */} + + + scrum + + + + + {/* room status */} + + + + recurring + + + + biweekly fridays! + + + + + {/* footer */} + + + + + + + + + + {/* recurring room - wine wednesdays */} + + {/* header */} + + {/* meeting details */} + + + Wine Wednesdays + + + @JOSH YOU BETTER COME + + + {/* badges and tags */} + + + party πŸŽ‰ + + + + + {/* room status */} + + + + recurring + + + + wednesdays 7-9pm + + + + + {/* footer */} + + + + + + + + +
+
+ + {/* attachments */} +
+ {/* header row */} + + + + Attachments + + + + + code, links (jira tickets, drive folders, powerpoints), + screenshots + + + + {/* tab pane */} + + + Team + + + + Personal + + + + Favorites + + + + + TODAY + + + + + + + + + + {/* row of attachments */} +
+ {/* pdf example */} + + {/* attmnt header */} + + + + + + report.pdf + + + + blockers + + + + {/* attachment actions */} + + + + + + + {/* attmnt footer */} + + + + + profile + + + + + + Adriana + + + 5 minutes ago + + + + + + + + {/* jira example */} + + {/* attmnt header */} + + + + + RAM-22 + + technical doc - stripe + + + + engineering + + + + {/* attachment actions */} + + + + + + + {/* attmnt footer */} + + + + + profile + + + + + Paul + + 2 hours ago + + + + + + +
+
+
+ +
+ {/* dynamic footer based on selection */} +
+ + + + + {statusBubble(UserStatus.online)} + + profile + + + + + {selectedChannel == null + ? "" + : testFriends[selectedChannel].name}{" "} + + + + {selectedChannel == null + ? "" + : testFriends[selectedChannel].role} + + + + + {/* shortcuts */} + + + R + + + SPACE + + +
+
- ) -} \ No newline at end of file + ); +} diff --git a/services/roomService.tsx b/services/roomService.tsx index f20ddaa..7767847 100644 --- a/services/roomService.tsx +++ b/services/roomService.tsx @@ -38,4 +38,13 @@ export default class RoomService { { merge: true } ); } + + async updateRoom(room: Room) { + const docRef = doc(this.db, Collections.rooms, room.id); + await setDoc( + docRef, + { ...room, lastUpdatedDate: serverTimestamp() }, + { merge: true } + ); + } }