Skip to content

Commit

Permalink
calendar instructor view only, error handling for date/time, remove b…
Browse files Browse the repository at this point in the history
…eta from analytics
  • Loading branch information
charisgao committed Sep 17, 2023
1 parent b362ba9 commit 1a49e96
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { Calendar, momentLocalizer, Views } from "react-big-calendar";
import moment from "moment";
import { mutateResourceListFunction } from "@pennlabs/rest-hooks/dist/types";
import { Modal, Form, Button } from "semantic-ui-react";
import { TextField } from "@mui/material";
import { Alert, TextField } from "@mui/material";
import { TimePicker, DatePicker, LocalizationProvider } from "@mui/lab";
import AdapterDateFns from "@mui/lab/AdapterDateFns";
import { createEvent } from "../../hooks/data-fetching/calendar";
import { PartialEvent, Event, CalendarEvent } from "../../types";
import { createEvent } from "../../../hooks/data-fetching/calendar";
import { PartialEvent, Event, CalendarEvent } from "../../../types";
import "react-big-calendar/lib/css/react-big-calendar.css";

const localizer = momentLocalizer(moment);
Expand Down Expand Up @@ -70,11 +70,11 @@ const EditEventModal = ({ setModalState, mutate, event }: EditEventProps) => {
/>

<Form.Field>
<label>Start</label>
<label>Start Time</label>
<Form.Input value={event.start} />
</Form.Field>
<Form.Field>
<label>End</label>
<label>End Time</label>
<Form.Input value={event.end} />
</Form.Field>
</Modal.Content>
Expand Down Expand Up @@ -126,7 +126,6 @@ const NewEventModal = ({
setTime(start);
}, [start]);
useEffect(() => {
console.log("REWRITE");
eSetDate(end);
eSetTime(end);
}, [end]);
Expand All @@ -149,10 +148,6 @@ const NewEventModal = ({
eTime.getMinutes(),
eTime.getSeconds()
);
if (endDate < startDate) {
console.log("PROBLEMS");
}
console.log(startDate, endDate);
const newEvent: PartialEvent = {
title,
start: startDate.toISOString(),
Expand Down Expand Up @@ -217,13 +212,16 @@ const NewEventModal = ({
onChange={(newValue) => {
if (newValue != null) eSetDate(newValue);
}}
minDate={date}
renderInput={(params) => <TextField {...params} />}
/>
<TimePicker
value={eTime}
onChange={(newValue) => {
if (newValue != null) eSetTime(newValue);
console.log(eTime);
}}
minTime={time}
renderInput={(params) => <TextField {...params} />}
minutesStep={15}
/>
Expand Down
14 changes: 3 additions & 11 deletions frontend/components/Course/CourseSidebarNav.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext } from "react";
import { Segment, Menu, Image, Icon, Label } from "semantic-ui-react";
import { Segment, Menu, Image, Icon } from "semantic-ui-react";
import { useRouter } from "next/router";
import Link from "next/link";

Expand Down Expand Up @@ -56,10 +56,11 @@ const CourseSidebarNav = (props: CourseSidebarProps) => {
/>
</Link>
)}
{!course.archived && (
{staff && (
<Link
href="/courses/[course]/calendar"
as={`/courses/${courseId}/calendar`}
legacyBehavior
>
<Menu.Item
style={noWrapStyle}
Expand Down Expand Up @@ -104,15 +105,6 @@ const CourseSidebarNav = (props: CourseSidebarProps) => {
}}
/>
Analytics
<Label
color="violet"
content="Beta"
size="tiny"
style={{
float: "none",
verticalAlign: "bottom",
}}
/>
</Menu.Item>
</Link>
)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/courses/[course]/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Head from "next/head";
import { Grid } from "semantic-ui-react";
import { NextPageContext } from "next";
import CourseWrapper from "../../../components/Course/CourseWrapper";
import Calender from "../../../components/Calender";
import Calender from "../../../components/Course/Calender";
import { doMultipleSuccessRequests } from "../../../utils/fetch";
import { isLeadershipRole } from "../../../utils/enums";
import { withAuth } from "../../../context/auth";
Expand Down

0 comments on commit 1a49e96

Please sign in to comment.