Merge branch 'main' into redux-setup

This commit is contained in:
cth0604
2022-03-13 18:26:13 -07:00
committed by GitHub
14 changed files with 584 additions and 47 deletions
-5
View File
@@ -1,5 +0,0 @@
const Calendar: React.FC = () => {
return <span>Calendar</span>;
};
export default Calendar;
+14
View File
@@ -0,0 +1,14 @@
import { Toolbar } from "@mui/material";
import UserCalendar from "./UserCalendar";
const CalendarPage: React.FC = () => {
return (
<>
<Toolbar />
<UserCalendar />
</>
);
};
export default CalendarPage;
+185
View File
@@ -0,0 +1,185 @@
/*
Test data from
https://github.com/jquense/react-big-calendar/blob/master/examples/events.js
*/
const now = new Date();
export default [
{
id: 0,
title: "All Day Event very long title",
allDay: true,
start: new Date(2022, 2, 0),
end: new Date(2022, 2, 1),
},
{
id: 1,
title: "Long Event",
start: new Date(2022, 2, 7),
end: new Date(2022, 2, 10),
},
{
id: 2,
title: "DTS STARTS",
start: new Date(2022, 1, 13, 0, 0, 0),
end: new Date(2022, 1, 20, 0, 0, 0),
},
{
id: 3,
title: "DTS ENDS",
start: new Date(2022, 9, 6, 0, 0, 0),
end: new Date(2022, 9, 13, 0, 0, 0),
},
{
id: 4,
title: "Some Event",
start: new Date(2022, 2, 9, 0, 0, 0),
end: new Date(2022, 2, 10, 0, 0, 0),
},
{
id: 5,
title: "Conference",
start: new Date(2022, 2, 11),
end: new Date(2022, 2, 13),
desc: "Big conference for important people",
},
{
id: 6,
title: "Meeting",
start: new Date(2022, 2, 12, 10, 30, 0, 0),
end: new Date(2022, 2, 12, 12, 30, 0, 0),
desc: "Pre-meeting meeting, to prepare for the meeting",
},
{
id: 7,
title: "Lunch",
start: new Date(2022, 2, 12, 12, 0, 0, 0),
end: new Date(2022, 2, 12, 13, 0, 0, 0),
desc: "Power lunch",
},
{
id: 8,
title: "Meeting",
start: new Date(2022, 2, 12, 14, 0, 0, 0),
end: new Date(2022, 2, 12, 15, 0, 0, 0),
},
{
id: 9,
title: "Happy Hour",
start: new Date(2022, 2, 12, 17, 0, 0, 0),
end: new Date(2022, 2, 12, 17, 30, 0, 0),
desc: "Most important meal of the day",
},
{
id: 10,
title: "Dinner",
start: new Date(2022, 2, 12, 20, 0, 0, 0),
end: new Date(2022, 2, 12, 21, 0, 0, 0),
},
{
id: 11,
title: "Planning Meeting with Paige",
start: new Date(2022, 2, 13, 8, 0, 0),
end: new Date(2022, 2, 13, 10, 30, 0),
},
{
id: 11.1,
title: "Inconvenient multi-day Conference Call",
start: new Date(2022, 2, 13, 9, 30, 0),
end: new Date(2022, 2, 14, 1, 0, 0),
},
{
id: 11.2,
title: "Project Kickoff - Lou's Shoes",
start: new Date(2022, 2, 13, 11, 30, 0),
end: new Date(2022, 2, 13, 14, 0, 0),
},
{
id: 11.3,
title: "Quote Follow-up - Tea by Tina",
start: new Date(2022, 2, 13, 15, 30, 0),
end: new Date(2022, 2, 13, 16, 0, 0),
},
{
id: 12,
title: "Late Night Event",
start: new Date(2022, 2, 17, 19, 30, 0),
end: new Date(2022, 2, 18, 2, 0, 0),
},
{
id: 12.5,
title: "Late Same Night Event",
start: new Date(2022, 2, 17, 19, 30, 0),
end: new Date(2022, 2, 17, 23, 30, 0),
},
{
id: 13,
title: "Multi-day Event",
start: new Date(2022, 2, 20, 19, 30, 0),
end: new Date(2022, 2, 22, 2, 0, 0),
},
{
id: 14,
title: "Today",
start: new Date(new Date().setHours(new Date().getHours() - 3)),
end: new Date(new Date().setHours(new Date().getHours() + 3)),
},
{
id: 15,
title: "Point in Time Event",
start: now,
end: now,
},
{
id: 16,
title: "Video Record",
start: new Date(2022, 2, 14, 15, 30, 0),
end: new Date(2022, 2, 14, 19, 0, 0),
},
{
id: 17,
title: "Dutch Song Producing",
start: new Date(2022, 2, 14, 16, 30, 0),
end: new Date(2022, 2, 14, 20, 0, 0),
},
{
id: 18,
title: "Itaewon Halloween Meeting",
start: new Date(2022, 2, 14, 16, 30, 0),
end: new Date(2022, 2, 14, 17, 30, 0),
},
{
id: 19,
title: "Online Coding Test",
start: new Date(2022, 2, 14, 17, 30, 0),
end: new Date(2022, 2, 14, 20, 30, 0),
},
{
id: 20,
title: "An overlapped Event",
start: new Date(2022, 2, 14, 17, 0, 0),
end: new Date(2022, 2, 14, 18, 30, 0),
},
{
id: 21,
title: "Phone Interview",
start: new Date(2022, 2, 14, 17, 0, 0),
end: new Date(2022, 2, 14, 18, 30, 0),
},
{
id: 22,
title: "Cooking Class",
start: new Date(2022, 2, 14, 17, 30, 0),
end: new Date(2022, 2, 14, 19, 0, 0),
},
{
id: 23,
title: "Go to the gym",
start: new Date(2022, 2, 14, 18, 30, 0),
end: new Date(2022, 2, 14, 20, 0, 0),
},
];
+23
View File
@@ -0,0 +1,23 @@
import { Calendar, momentLocalizer } from "react-big-calendar";
import moment from "moment";
import testEvents from "./Events";
import "react-big-calendar/lib/css/react-big-calendar.css";
const localizer = momentLocalizer(moment);
const UserCalendar: React.FC = () => {
return (
<Calendar
events={testEvents}
views={["month", "week", "day"]}
step={60}
showMultiDayTimes
localizer={localizer}
style={{ height: "80%" }}
/>
);
};
export default UserCalendar;
@@ -0,0 +1,44 @@
import { Button, Checkbox, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, FormGroup, Typography } from "@mui/material";
import { SidebarUserObj } from "../sidebar/SidebarUser";
interface Props {
open: boolean;
selectedValue: SidebarUserObj;
onClose: (value: SidebarUserObj) => void;
users: SidebarUserObj[];
}
const CallFavouritesDialog: React.FC<Props> = ({ open, selectedValue, onClose, users }: Props) => {
const handleClose = () => {
onClose(selectedValue);
};
return (
<Dialog
onClose={handleClose}
open={open}
fullWidth
maxWidth="sm"
>
<DialogTitle>Select who to call:</DialogTitle>
<DialogContent>
<FormControlLabel control={<Checkbox color="success" />} label="Select everyone" />
</DialogContent>
<DialogContent sx={{ height: "40vh" }} dividers>
<FormGroup>
{users.map((user) => (
<FormControlLabel key={user.id} control={<Checkbox color="success" />} label={user.name} />
))}
</FormGroup>
</DialogContent>
<DialogActions>
<Button color="success" onClick={handleClose}>
<Typography variant="button" color="black">Call</Typography>
</Button>
</DialogActions>
</Dialog>
);
};
export default CallFavouritesDialog;
+15 -1
View File
@@ -2,8 +2,22 @@ import MeetingsPanel from "./MeetingsPanel";
import ShortCuts from "./ShortCuts";
import Container from "@mui/material/Container";
import Grid from "@mui/material/Grid";
import { MeetingStatus, SidebarUserObj } from "../sidebar/SidebarUser";
import { useState } from "react";
const Home: React.FC = () => {
/* Temporary data - this is the same as what's in ProtectedRoute.tsx so it should not
be duplicated like this in the future (Route components were being weird when I tried
to pass it down from App.tsx) */
const [mockUsers] = useState<SidebarUserObj[]>([
{ 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 }
]);
return (
<Container className="main-home">
<Grid container>
@@ -11,7 +25,7 @@ const Home: React.FC = () => {
<MeetingsPanel />
</Grid>
<Grid item sm={4}>
<ShortCuts />
<ShortCuts users={mockUsers}/>
</Grid>
</Grid>
</Container>
+27 -2
View File
@@ -4,8 +4,27 @@ import PhoneEnabledIcon from "@mui/icons-material/PhoneEnabled";
import CircleIcon from "@mui/icons-material/Circle";
import Button from "@mui/material/Button";
import Grid from "@mui/material/Grid";
import { SidebarUserObj } from "../sidebar/SidebarUser";
import CallFavouritesDialog from "./CallFavouritesDialog";
import { useState } from "react";
interface Props {
users: SidebarUserObj[];
}
const ShortCuts: React.FC<Props> = ({ users }: Props) => {
const [open, setOpen] = useState(false);
const [selectedValue, setSelectedValue] = useState(users[0]);
const handleClickOpen = () => {
setOpen(true);
};
const handleClose = (value: SidebarUserObj) => {
setOpen(false);
setSelectedValue(value);
};
const ShortCuts: React.FC = () => {
return (
<div className="short-cuts" >
<Grid className="row-1" container spacing={1}>
@@ -24,10 +43,16 @@ const ShortCuts: React.FC = () => {
</Grid>
<Grid className="row-2" container spacing={1}>
<Grid item sm={6}>
<Button className="tile">
<Button className="tile" onClick={handleClickOpen}>
<PhoneEnabledIcon className="icon" />
</Button>
<CallFavouritesDialog
selectedValue={selectedValue}
open={open}
onClose={handleClose}
users={users}/>
<label>Call Favourites</label>
<label>test: {selectedValue.name}</label>
</Grid>
<Grid item sm={6}>
<Button className="tile">
+12 -27
View File
@@ -9,12 +9,14 @@ import zoomLogo from "../../assets/zoom.png";
import LoginIcon from "@mui/icons-material/Login";
import useAuth from "../../hooks/useAuth";
interface LocationState {
from: { pathname: string };
}
const Login: React.FC = () => {
const { setAuth }: any = useAuth();
const navigate = useNavigate();
const location: any = useLocation();
const from = location.state?.from?.pathname || "/";
const location = useLocation();
const state = location.state as LocationState;
const from = state?.from?.pathname || "/";
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
@@ -33,8 +35,10 @@ const Login: React.FC = () => {
const handleLogin = () => {
if (username === "" && password === "") {
setAuth({ username: username, isLoggedIn: true });
navigate(from, { replace: true });
// setAuth({username: username, isLoggedIn: true});
setAuth["username"] = username;
setAuth["isLoggedIn"] = true;
navigate(from, {replace: true});
}
setUsername("");
setPassword("");
@@ -45,27 +49,8 @@ const Login: React.FC = () => {
<Stack className="grid-container" spacing={2}>
<img className="login-logo" src={hsbcLogo} alt="HSBC Logo" />
{/* <p ref={errRef} className={errMsg ? "errmsg" : "offscreen"} aria-live="assertive">{errMsg}</p> */}
<TextField
className="username-input"
id="outlined-basic"
label="Username"
variant="outlined"
placeholder="Username"
onChange={(event) => {
setUsername(event.target.value);
}}
/>
<TextField
className="password-input"
id="outlined-basic"
label="Password"
variant="outlined"
placeholder="Password"
type="password"
onChange={(event) => {
setPassword(event.target.value);
}}
/>
<TextField className="username-input" id="outlined-basic" label="Username" variant="outlined" placeholder="Username" onChange={(event) => {setUsername(event.target.value);}}/>
<TextField className="password-input" id="outlined-basic" label="Password" variant="outlined" placeholder="Password" type="password" onChange={(event) => {setPassword(event.target.value);}}/>
<Stack direction="row" justifyContent="space-between" spacing={2}>
<a className="register-btn" href="#">
<Typography sx={{ ml: 1, mb: 1 }}>Forgot your password?</Typography>