Skip to content

Commit

Permalink
Cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
liya-zhu committed Jun 25, 2024
1 parent bab406a commit a699e44
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 549 deletions.
7 changes: 1 addition & 6 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.14",
"@mui/material": "^5.15.19",
"@mui/x-date-pickers": "^7.6.1",
"@mui/material": "^5.15.14",
"@rjsf/bootstrap-4": "^2.5.1",
"@rjsf/core": "^2.5.1",
"@testing-library/jest-dom": "^5.11.4",
Expand All @@ -28,8 +27,6 @@
"apollo-upload-client": "^16.0.0",
"axios": "^1.6.0",
"bootstrap": "^4.6.0",
"date-fns": "^3.6.0",
"dayjs": "^1.11.11",
"framer-motion": "^7.6.12",
"graphql": "^15.5.0",
"humps": "^2.0.1",
Expand All @@ -39,10 +36,8 @@
"moment": "^2.30.1",
"react": "^18.2.0",
"react-bootstrap": "^1.5.2",
"react-date-picker": "^11.0.0",
"react-dom": "^18.2.0",
"react-google-login": "^5.2.2",
"react-icons": "^5.2.1",
"react-json-schema": "^1.2.2",
"react-jsonschema-form": "^1.8.1",
"react-router-dom": "^6.4.3",
Expand Down
87 changes: 8 additions & 79 deletions frontend/src/components/pages/tasks/TaskModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import {
import VisibilityIcon from "@mui/icons-material/Visibility";
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
import { TbTrash } from "react-icons/tb";
import dayjs, { Dayjs } from 'dayjs';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import 'dayjs/locale/de';

import ModalContainer from "../../common/ModalContainer";
Expand Down Expand Up @@ -121,9 +117,7 @@ const DateInput = ({
setRecurrenceFrequency,
submitPressed,
}: {
// dueDate: Dayjs | null;
dueDate: string;
// setDueDate: React.Dispatch<React.SetStateAction<Dayjs | null>>;
setDueDate: React.Dispatch<React.SetStateAction<string>>;
dueTime: string;
setDueTime: React.Dispatch<React.SetStateAction<string>>;
Expand All @@ -133,64 +127,14 @@ const DateInput = ({
setRecurrenceFrequency: React.Dispatch<React.SetStateAction<string>>;
submitPressed: boolean;
}) => {
// const [selectedDate, setSelectedDate] = useState<Date | null>(new Date());
// const [selectedDate, setSelectedDate] = React.useState<Dayjs | null>(dayjs().startOf('day'));

const [calendarIsOpen, setCalendarIsOpen] = useState(false);

return(
<Flex flexDir="column" flex="1">
<FormControl isRequired>
<FormLabel mb="5px" color="gray.main" fontWeight="700">
Due Date
</FormLabel>
<Flex flexDir="column">
<Flex flexDir="row">
{/* date starts */}
{/* <Input
variant="primary"
mb={3}
borderColor={submitPressed && !dueDate ? "red.error" : "gray.300"}
boxShadow={
submitPressed && !dueDate ? "0 0 2px red.error" : "none"
}
type="date"
value={dueDate}
width="200px"
onChange={(e) => setDueDate(e.target.value)}
/> */}
{/* <div>
<DatePicker
onChange={(date) => {
setSelectedDate(date as Date | null);
setCalendarIsOpen(false);
}}
isOpen={calendarIsOpen}
value={selectedDate}
format="MMM dd, y"
// shouldOpenCalendar={({ reason }) => reason !== 'focus'}
// format="yyyy-MM-dd"
// calendarIcon={null}
// clearIcon={null}
required
closeCalendar
// shouldOpenCalendar={() => false}
/>
</div> */}
{/* <LocalizationProvider dateAdapter={AdapterDayjs} adapterLocale="de">
<DatePicker />
<DatePicker
label="Date Picker"
format="LL"
value={dueDate}
defaultValue={dayjs('2022-04-17')}
onChange={
(date) => {
setDueDate(date);
}
}
/>
</LocalizationProvider> */}
<Flex flexDir="row">

<Input
variant="primary"
Expand Down Expand Up @@ -226,18 +170,7 @@ const DateInput = ({
</option>
))}
</Select>
{/* <Input
variant="primary"
mb={3}
borderColor={submitPressed && !dueTime ? "red.error" : "gray.300"}
boxShadow={
submitPressed && !dueTime ? "0 0 2px red.error" : "none"
}
type="time"
value={dueTime}
width="200px"
onChange={(e) => setDueTime(e.target.value)}
/> */}

</Flex>
<Flex alignItems="center">
<Checkbox
Expand Down Expand Up @@ -270,7 +203,6 @@ const DateInput = ({
const TaskModal = ({ isOpen, setIsOpen }: Props): React.ReactElement => {
const [title, setTitle] = useState("");
const [location, setLocation] = useState("");
// const [dueDate, setDueDate] = useState<Dayjs | null>(dayjs().startOf('day'));
const [dueDate, setDueDate] = useState("");
const [dueTime, setDueTime] = useState("");
const [isAllDay, setIsAllDay] = useState(false);
Expand All @@ -290,7 +222,6 @@ const TaskModal = ({ isOpen, setIsOpen }: Props): React.ReactElement => {
const resetFormState = () => {
setTitle("");
setLocation("");
// setDueDate(dayjs().startOf('day'));
setDueDate("");
setDueTime("");
setIsAllDay(false);
Expand All @@ -308,16 +239,14 @@ const TaskModal = ({ isOpen, setIsOpen }: Props): React.ReactElement => {
setMarillacBucks(`$${numberValue}`);
}
};


// delete task api stuff
const handleDelete = () => {

}

return (
<ModalContainer title="" isOpen={isOpen} setIsOpen={setIsOpen}>
<Flex justifyContent="space-between" paddingTop="0px">
<Text fontWeight="500" fontSize="20">Edit Chore</Text>
<Button variant="cancel" onClick={() => {}}>
<TbTrash style={{ color: "#E30000" }} /><span style={{ color: "#E30000" }}>&nbsp;Delete</span>
</Button>
</Flex>
<ModalContainer title="Edit Chore" isOpen={isOpen} setIsOpen={setIsOpen} onDelete={handleDelete}>
<Flex flexDir="column" gap="20px">
<FormField
label="Task Name"
Expand Down
Loading

0 comments on commit a699e44

Please sign in to comment.