Skip to content

Commit

Permalink
fixed compiling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwaqaljanahi2021 committed Nov 6, 2024
1 parent 0869164 commit 06dfd1a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,12 @@
padding: 10px;
}

@media (max-width: 768px) {
@media (max-width: 370px) {
.header {
flex-direction: column;
align-items: center;
width:400px;

}

.buttons {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import ErrorPage from '../errorPage/errorPage'
import LoadingOverlay from 'components/shared/loaders/loadingOverlay'
import {useActionless, useAppSelector} from 'redux/hooks'
import {SET_ALERT} from 'redux/types/active.types'
import Card from '@mui/material/Card'
import CardContent from '@mui/material/CardContent'
import {Accordion, AccordionDetails, CardActionArea, TextField, Typography} from '@mui/material'
//import Card from '@mui/material/Card'
//import CardContent from '@mui/material/CardContent'
import {Accordion, AccordionDetails, TextField, Typography} from '@mui/material'


import Grid from '@mui/material/Unstable_Grid2'
Expand Down
20 changes: 14 additions & 6 deletions devU-client/src/components/pages/forms/courses/coursesFormPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { useHistory } from 'react-router-dom'
import { ExpressValidationError } from 'devu-shared-modules'
//import { ExpressValidationError } from 'devu-shared-modules'

import PageWrapper from 'components/shared/layouts/pageWrapper'

Expand All @@ -11,7 +11,7 @@ import TextField from 'components/shared/inputs/textField'
import { SET_ALERT } from 'redux/types/active.types'
import formStyles from './coursesFormPage.scss'
import AutomateDates from './automateDates'
import { applyMessageToErrorFields, removeClassFromField } from "../../../../utils/textField.utils";
import { removeClassFromField } from "../../../../utils/textField.utils";

const EditCourseFormPage = () => {
const [setAlert] = useActionless(SET_ALERT);
Expand All @@ -27,11 +27,16 @@ const EditCourseFormPage = () => {
const [startDate, setStartDate] = useState(new Date().toISOString().split("T")[0]);
const [endDate, setEndDate] = useState(new Date().toISOString().split("T")[0]);
const [privateDate, setPrivateDate] = useState(new Date().toISOString().split("T")[0]);
const [invalidFields,setInvalidFields] = useState(new Map<string, string>());

const handleChange = (value: string, e: React.ChangeEvent<HTMLInputElement>) => {
const key = e.target.id;
setFormData(prevState => ({ ...prevState, [key]: value }));
};
const handleChange = (value: String, e : React.ChangeEvent<HTMLInputElement>) => {
const key = e.target.id
setFormData(prevState => ({...prevState,[key] : value}))

const newInvalidFields = removeClassFromField(invalidFields, key)
setInvalidFields(newInvalidFields)
}


const handleCheckboxChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setFormData(prevState => ({ ...prevState, isPublic: e.target.checked }));
Expand All @@ -42,6 +47,7 @@ const EditCourseFormPage = () => {
endDate: string;
}


const handleDatesChange = ({ startDate, endDate }: Dates) => {
setStartDate(startDate);
setEndDate(endDate);
Expand All @@ -57,10 +63,12 @@ const EditCourseFormPage = () => {
const formatDateForSubmission = (date: string) => {
return new Date(date).toISOString();
};


const isFormValid = () => {
return formData.name && formData.number && formData.semester && startDate && endDate;
};


const handleSubmit = () => {
const finalFormData = {
Expand Down

0 comments on commit 06dfd1a

Please sign in to comment.