Skip to content

Commit

Permalink
Move MonthEvent to types file
Browse files Browse the repository at this point in the history
  • Loading branch information
Lambert Liu committed Mar 24, 2022
1 parent acf4a64 commit fe11518
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import FullCalendar, {
import dayGridPlugin from "@fullcalendar/daygrid";
import { Box } from "@chakra-ui/react";

import { Event } from "../../../types/CalendarTypes";
import { Event, MonthEvent } from "../../../types/CalendarTypes";
import colors from "../../../theme/colors";
import "./Calendar.css";

Expand Down Expand Up @@ -68,17 +68,13 @@ export const ADMIN_SHIFT_CALENDAR_TEST_EVENTS: MonthEvent[] = [
},
];

export type MonthEvent = Event & {
groupId: string;
};

// Events can be passed in any order (does not have to be sorted).
// AdminShiftCalendar assumes that all events are in the same month.
type AdminShiftCalendarProps = {
events: Event[];
};

const MonthlyViewReadOnlyShiftCalendar = ({
const MonthlyViewShiftCalendar = ({
events,
}: AdminShiftCalendarProps): React.ReactElement => {
const displayCustomEvent = (content: EventContentArg) => {
Expand Down Expand Up @@ -135,4 +131,4 @@ const MonthlyViewReadOnlyShiftCalendar = ({
);
};

export default MonthlyViewReadOnlyShiftCalendar;
export default MonthlyViewShiftCalendar;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from "@chakra-ui/react";
import colors from "../../../theme/colors";
import { Event } from "../../../types/CalendarTypes";
import "./ShiftCalendar.css";
import "./Calendar.css";
import { getTime, getWeekday } from "../../../utils/DateTimeUtils";

type ShiftCalendarProps = {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/pages/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import RefreshCredentials from "../auth/RefreshCredentials";

import * as Routes from "../../constants/Routes";
import SampleContext from "../../contexts/SampleContext";
import AdminShiftCalendar, {
import MonthlyViewShiftCalendar, {
ADMIN_SHIFT_CALENDAR_TEST_EVENTS,
} from "../admin/schedule/AdminShiftCalendar";
} from "../admin/ShiftCalendar/MonthlyViewReadOnlyShiftCalendar";

type ButtonProps = { text: string; path: string };

Expand Down Expand Up @@ -187,7 +187,7 @@ const Default = (): React.ReactElement => {
</div>
<div style={{ height: "2rem" }} />
<Container maxW="container.xl">
<AdminShiftCalendar events={ADMIN_SHIFT_CALENDAR_TEST_EVENTS} />
<MonthlyViewShiftCalendar events={ADMIN_SHIFT_CALENDAR_TEST_EVENTS} />
</Container>
<TeamInfoDisplay />
<DesignSystemDisplay />
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/types/CalendarTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ export type Event = {
start: Date;
end: Date;
};

export type MonthEvent = Event & {
groupId: string;
};

0 comments on commit fe11518

Please sign in to comment.