Skip to content

Commit

Permalink
Merge pull request #109 from Rushikesh-Sonawane99/shiksha-2.0
Browse files Browse the repository at this point in the history
Issue #000 chore: Modified routes and page names as per next-js standard
  • Loading branch information
itsvick authored May 14, 2024
2 parents bf7ccd7 + 7459459 commit 9c28567
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ const Header: React.FC = () => {
}));

const handleProfileClick = () => {
if (pathname !== '/MyProfile') {
router.push('/MyProfile');
if (pathname !== '/my-profile') {
router.push('/my-profile');
}
};
const handleLogoutClick = () => {
router.replace('/Logout');
router.replace('/logout');
};
const [openDrawer, setOpenDrawer] = useState<boolean>(false);

Expand Down
16 changes: 8 additions & 8 deletions src/pages/Dashboard.tsx → src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ const Dashboard: React.FC<DashboardProps> = () => {
name: entry.name,
}));
console.log('name..........', nameUserIdArray);
if (nameUserIdArray && currentDate) {
if (nameUserIdArray && (selectedDate || currentDate)) {
const userAttendanceStatusList = async () => {
const attendanceStatusData: AttendanceStatusListProps = {
limit: 200,
page: 1,
filters: {
fromDate: currentDate,
toDate: currentDate,
fromDate: selectedDate || currentDate,
toDate: selectedDate || currentDate,
},
};
const res = await attendanceStatusList(attendanceStatusData);
Expand Down Expand Up @@ -299,7 +299,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
}

//Add logic to merge response2 and nameUserIdArray
setCohortMemberList(nameUserIdArray);
setCohortMemberList(nameUserIdArray); //check where to set cohort member list
setNumberOfCohortMembers(nameUserIdArray?.length);
setLoading(false);
};
Expand Down Expand Up @@ -515,7 +515,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
});
if (userAttendance) {
const data = {
attendanceDate: selectedDate,
attendanceDate: selectedDate || currentDate,
contextId,
userAttendance,
};
Expand Down Expand Up @@ -869,7 +869,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
}}
component="h2"
>
{formatDate(selectedDate)}
{formatDate(selectedDate || currentDate)}
</Typography>
</Box>
<Box onClick={() => handleModalToggle()}>
Expand Down Expand Up @@ -921,7 +921,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
userData={{
userId: user.userId,
attendance: user.attendance,
attendanceDate: currentDate,
attendanceDate: selectedDate || currentDate,
name: user.name,
}}
isEdit={true}
Expand Down Expand Up @@ -982,7 +982,7 @@ const Dashboard: React.FC<DashboardProps> = () => {
<MarkAttendance
isOpen={openMarkAttendance}
isSelfAttendance={true}
date={currentDate}
date={selectedDate || currentDate}
currentStatus={attendanceStatus}
handleClose={handleMarkAttendanceModal}
handleSubmit={submitAttendance}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useRouter } from 'next/router';
// Define the type for props

// Import dynamic components
const Login = dynamic(() => import('./Login'), { ssr: false });
const Dashboard = dynamic(() => import('./Dashboard'), { ssr: false });
const Login = dynamic(() => import('./login'), { ssr: false });
const Dashboard = dynamic(() => import('./dashboard'), { ssr: false });

// Define the Home component
const Home: React.FC = () => {
Expand All @@ -21,7 +21,7 @@ const Home: React.FC = () => {
const { locale, locales, push } = useRouter();

useEffect(() => {
push('/Login', undefined, { locale: 'mr'});
push('/login', undefined, { locale: 'mr'});
})

return (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Login.tsx → src/pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const LoginPage = () => {
localStorage.getItem('preferredLanguage') || 'en';
const refreshToken = localStorage.getItem('refreshToken');
if (refreshToken) {
router.push('/Dashboard');
router.push('/dashboard');
}
}
}, []);
Expand Down Expand Up @@ -123,7 +123,7 @@ const LoginPage = () => {
}
}
setLoading(false);
router.push('/Dashboard');
router.push('/dashboard');
} catch (error: any) {
setLoading(false);
if (error.response && error.response.status === 404) {
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 9c28567

Please sign in to comment.