Skip to content

Commit

Permalink
Issue #PS-0000 fix: Fixed type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
itsvick committed May 10, 2024
1 parent 025665f commit 988cb4f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const Header: React.FC = () => {
const toggleDrawer = (newOpen: boolean) => () => {
setOpenDrawer(newOpen);
};
const MenuDrawer = dynamic(() => import('./../pages/LeftDrawer'), {
const MenuDrawer = dynamic(() => import('../pages/MenuDrawer'), {
ssr: false,
});

Expand Down
14 changes: 7 additions & 7 deletions src/components/WeekCalender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import {
import { Box } from '@mui/material';
import { CircularProgressbar, buildStyles } from 'react-circular-progressbar';

const Calendar = ({ showDetailsHandle, data }) => {
const Calendar: React.FC<any> = ({ showDetailsHandle, data }) => {
const [currentMonth, setCurrentMonth] = useState(new Date());
const [currentWeek, setCurrentWeek] = useState(getWeek(currentMonth));
const [selectedDate, setSelectedDate] = useState(new Date());

const changeMonthHandle = (btnType) => {
const changeMonthHandle = (btnType: string) => {
if (btnType === 'prev') {
setCurrentMonth(subMonths(currentMonth, 1));
}
Expand All @@ -28,7 +28,7 @@ const Calendar = ({ showDetailsHandle, data }) => {
}
};

const changeWeekHandle = (btnType) => {
const changeWeekHandle = (btnType: string) => {
//console.log("current week", currentWeek);
if (btnType === 'prev') {
//console.log(subWeeks(currentMonth, 1));
Expand All @@ -42,7 +42,7 @@ const Calendar = ({ showDetailsHandle, data }) => {
}
};

const onDateClickHandle = (day, dayStr) => {
const onDateClickHandle = (day: any, dayStr: string) => {
setSelectedDate(day);
showDetailsHandle(dayStr);
};
Expand Down Expand Up @@ -125,8 +125,8 @@ const Calendar = ({ showDetailsHandle, data }) => {
onDateClickHandle(cloneDay, dayStr);
}}
>
<div className="cicularProgress">
<div key={day}>
<div className="circularProgress">
<div key={day + ''}>
<span className="number">{formattedDate}</span>
</div>
<Box
Expand Down Expand Up @@ -159,7 +159,7 @@ const Calendar = ({ showDetailsHandle, data }) => {
}

rows.push(
<div className="row" key={day}>
<div className="row" key={day + ''}>
{days}
</div>
);
Expand Down
12 changes: 6 additions & 6 deletions src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ const Dashboard: React.FC<DashboardProps> = () => {
);
const [showDetails, setShowDetails] = React.useState(false);
const [handleSaveHasRun, setHandleSaveHasRun] = React.useState(false);
const [data, setData] = React.useState(null);
const [data, setData] = React.useState<string>('');
const [percentageAttendanceData, setPercentageAttendanceData] =
React.useState(null);
const [numberOfCohortMembers, setNumberOfCohortMembers] = React.useState(0);
const [percentageAttendance, setPercentageAttendance] = React.useState(null);
const [percentageAttendance, setPercentageAttendance] = React.useState<any>(null);
const [currentDate, setCurrentDate] = React.useState(getTodayDate);
const [bulkAttendanceStatus, setBulkAttendanceStatus] = React.useState('');
const [loading, setLoading] = React.useState(false);
Expand All @@ -123,7 +123,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
const attendanceDate = currentDate;
let contextId = classId;
// const [TeachercontextId, setTeacherContextId] = React.useState("");
const userTypeData = {
const userTypeData: any = {
Learners: 'student',
// Self: 'self',
};
Expand Down Expand Up @@ -333,7 +333,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
}
}, [classId]);

const showDetailsHandle = (dayStr) => {
const showDetailsHandle = (dayStr: string) => {
console.log(dayStr);
setData(dayStr);
setShowDetails(true);
Expand Down Expand Up @@ -384,7 +384,7 @@ const Dashboard: React.FC<DashboardProps> = () => {

const attendanceDates = response?.data?.result?.attendanceDate;

const formattedAttendanceData = {};
const formattedAttendanceData: any = {};

// Loop through each attendance date
Object.keys(attendanceDates).forEach((date) => {
Expand Down Expand Up @@ -590,7 +590,7 @@ const Dashboard: React.FC<DashboardProps> = () => {

const todayDate = new Date().toISOString().split('T')[0];
console.log(percentageAttendance);
const currentAttendance = percentageAttendance?.[todayDate];
const currentAttendance: any = percentageAttendance?.[todayDate];
// let currentPercentAttendance = 'N/A';
const presentPercentage = parseFloat(currentAttendance?.present_percentage);

Expand Down
4 changes: 2 additions & 2 deletions src/pages/LeftDrawer.tsx → src/pages/MenuDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface DrawerProps {
language: string;
setLanguage: (lang: string) => void;
}
const menuDrawer: React.FC<DrawerProps> = ({
const MenuDrawer: React.FC<DrawerProps> = ({
toggleDrawer,
open,
language,
Expand Down Expand Up @@ -156,4 +156,4 @@ const menuDrawer: React.FC<DrawerProps> = ({
);
};

export default menuDrawer;
export default MenuDrawer;
10 changes: 5 additions & 5 deletions src/pages/MyProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ import prathamProfile from '../assets/images/prathamProfile.png';
import imageOne from '../assets/images/imageOne.jpg';
import Header from '@/components/Header';
import ApartmentIcon from '@mui/icons-material/Apartment';
import { StaticImageData } from 'next/image';
import Image, { StaticImageData } from 'next/image';
import { getUser, getUserDetails } from '@/services/ProfileService';
import { Label } from '@mui/icons-material';
const MyProfile = () => {
// Assuming imageOne is of type StaticImageData
const imageUrl: string = imageOne.src;
const prathamProfileUrl: String = prathamProfile.src;
const prathamProfileUrl: string = prathamProfile.src;
interface CustomField {
fieldId: string;
label: string;
Expand Down Expand Up @@ -532,11 +532,11 @@ const MyProfile = () => {
display="flex"
flexDirection="column"
>
<img
<Image
src={prathamProfileUrl}
alt="user"
height={'100px'}
width={'100px'}
height={100}
width={100}
style={{ marginLeft: '35%' }}
/>
{/* <img
Expand Down
2 changes: 1 addition & 1 deletion src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ main {
width: 100%;
}

.cicularProgress {
.circularProgress {
width: 100%;
align-items: center;
justify-content: center;
Expand Down

0 comments on commit 988cb4f

Please sign in to comment.