From c14ee4c3ad0d9207be903c8236110ccc45dd9234 Mon Sep 17 00:00:00 2001 From: CodeServer Date: Fri, 11 Mar 2022 20:44:38 +0000 Subject: [PATCH] hided navbar and sidebar from login page --- src/App.tsx | 64 ++++++++---------------------------------- src/ProtectedRoute.tsx | 63 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 67 insertions(+), 60 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 701edbf..54ecbcb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,72 +6,30 @@ import Login from "./components/login/Login"; import Home from "./components/home/Home"; import Contacts from "./components/contacts/Contacts"; import Calendar from "./components/calendar/Calendar"; -import Navbar from "./components/navbar/Navbar"; import { ThemeProvider } from "@emotion/react"; import ProtectedRoute from "./ProtectedRoute"; import Theme from "./Theme"; import "./style/App.css"; -import Sidebar from "./components/sidebar/Sidebar"; -import { - MeetingStatus, - SidebarUserObj, -} from "./components/sidebar/SidebarUser"; -import MeetingDetails from "./components/meeting-details/MeetingDetails"; -import { Box } from "@mui/material"; const App: React.FC = () => { const [meetingInfoOpen, setMeetingInfoOpen] = useState(false); - /* Temporary data */ - const [sidebarUsers] = useState([ - { id: 0, name: "Jincheng L.", meetingStatus: MeetingStatus.ONLINE }, - { id: 1, name: "Matt B.", meetingStatus: MeetingStatus.IN_MEETING }, - { id: 2, name: "Taehee C.", meetingStatus: MeetingStatus.OFFLINE }, - { id: 3, name: "Bob A.", meetingStatus: MeetingStatus.AWAY }, - { id: 4, name: "Bob B.", meetingStatus: MeetingStatus.IN_MEETING }, - { id: 5, name: "Bob C.", meetingStatus: MeetingStatus.OFFLINE }, - { id: 6, name: "Bob D.", meetingStatus: MeetingStatus.ONLINE }, - { id: 7, name: "Bob E.", meetingStatus: MeetingStatus.AWAY }, - { id: 8, name: "Bob F.", meetingStatus: MeetingStatus.OFFLINE }, - { id: 9, name: "Bob G.", meetingStatus: MeetingStatus.ONLINE }, - { id: 10, name: "Bob H.", meetingStatus: MeetingStatus.AWAY }, - { id: 11, name: "Bob I.", meetingStatus: MeetingStatus.OFFLINE }, - { id: 12, name: "Bob J.", meetingStatus: MeetingStatus.AWAY }, - { id: 13, name: "Bob K.", meetingStatus: MeetingStatus.IN_MEETING }, - { id: 14, name: "Bob L.", meetingStatus: MeetingStatus.IN_MEETING }, - { id: 15, name: "Bob M.", meetingStatus: MeetingStatus.OFFLINE }, - { id: 16, name: "Bob N.", meetingStatus: MeetingStatus.OFFLINE }, - { id: 17, name: "Bob O.", meetingStatus: MeetingStatus.AWAY }, - { id: 18, name: "Bob P.", meetingStatus: MeetingStatus.AWAY }, - { id: 19, name: "Bob Q.", meetingStatus: MeetingStatus.ONLINE }, - { id: 20, name: "Bob R.", meetingStatus: MeetingStatus.ONLINE }, - ]); - return ( - - - - - } /> - }> - } /> - } - /> - } /> - - - - - - - - + + } /> + }> + } /> + } + /> + } /> + + ); diff --git a/src/ProtectedRoute.tsx b/src/ProtectedRoute.tsx index 927eb13..9ba80c8 100644 --- a/src/ProtectedRoute.tsx +++ b/src/ProtectedRoute.tsx @@ -1,12 +1,61 @@ -import { useLocation, Outlet, Navigate } from "react-router-dom"; +import {useLocation, Outlet, Navigate, Routes, Route} from "react-router-dom"; import useAuth from "./hooks/useAuth"; +import Navbar from "./components/navbar/Navbar"; +import Sidebar from "./components/sidebar/Sidebar"; +import React, {useState} from "react"; +import { + MeetingStatus, + SidebarUserObj, +} from "./components/sidebar/SidebarUser"; +import MeetingDetails from "./components/meeting-details/MeetingDetails"; +import {Box} from "@mui/material"; const ProtectedRoute = () => { - const { auth }: any = useAuth(); - const location = useLocation(); - return ( - auth?.isLoggedIn ? : - ); -} + const { auth }: any = useAuth(); + const location = useLocation(); + + const [meetingInfoOpen, setMeetingInfoOpen] = useState(false); + /* Temporary data */ + const [sidebarUsers] = useState([ + { id: 0, name: "Jincheng L.", meetingStatus: MeetingStatus.ONLINE }, + { id: 1, name: "Matt B.", meetingStatus: MeetingStatus.IN_MEETING }, + { id: 2, name: "Taehee C.", meetingStatus: MeetingStatus.OFFLINE }, + { id: 3, name: "Bob A.", meetingStatus: MeetingStatus.AWAY }, + { id: 4, name: "Bob B.", meetingStatus: MeetingStatus.IN_MEETING }, + { id: 5, name: "Bob C.", meetingStatus: MeetingStatus.OFFLINE }, + { id: 6, name: "Bob D.", meetingStatus: MeetingStatus.ONLINE }, + { id: 7, name: "Bob E.", meetingStatus: MeetingStatus.AWAY }, + { id: 8, name: "Bob F.", meetingStatus: MeetingStatus.OFFLINE }, + { id: 9, name: "Bob G.", meetingStatus: MeetingStatus.ONLINE }, + { id: 10, name: "Bob H.", meetingStatus: MeetingStatus.AWAY }, + { id: 11, name: "Bob I.", meetingStatus: MeetingStatus.OFFLINE }, + { id: 12, name: "Bob J.", meetingStatus: MeetingStatus.AWAY }, + { id: 13, name: "Bob K.", meetingStatus: MeetingStatus.IN_MEETING }, + { id: 14, name: "Bob L.", meetingStatus: MeetingStatus.IN_MEETING }, + { id: 15, name: "Bob M.", meetingStatus: MeetingStatus.OFFLINE }, + { id: 16, name: "Bob N.", meetingStatus: MeetingStatus.OFFLINE }, + { id: 17, name: "Bob O.", meetingStatus: MeetingStatus.AWAY }, + { id: 18, name: "Bob P.", meetingStatus: MeetingStatus.AWAY }, + { id: 19, name: "Bob Q.", meetingStatus: MeetingStatus.ONLINE }, + { id: 20, name: "Bob R.", meetingStatus: MeetingStatus.ONLINE }, + ]); + return ( + auth?.isLoggedIn + ? + <> + + + + + + + + + + + + : + ); +}; export default ProtectedRoute; \ No newline at end of file