Skip to content

Commit

Permalink
Merge pull request #111 from suvarnakale/release-1.0.0
Browse files Browse the repository at this point in the history
Issue #PS-1626 feat: pathname changes
  • Loading branch information
itsvick authored Aug 8, 2024
2 parents 97c1989 + b1d9f53 commit f1b250f
Show file tree
Hide file tree
Showing 3 changed files with 716 additions and 19 deletions.
26 changes: 13 additions & 13 deletions src/pages/centers/[cohortId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useRouter } from 'next/router';
import ReactGA from 'react-ga4';
import { Session } from '../../utils/Interfaces';
import Schedule from './../../components/Schedule';
import Schedule from '../../components/Schedule';
import reassignLearnerStore from '@/store/reassignLearnerStore';
import { Role } from '@/utils/app.constant';
import { showToastMessage } from '@/components/Toastify';
Expand Down Expand Up @@ -278,7 +278,7 @@ const TeachingCenterDetails = () => {

const viewAttendanceHistory = () => {
if (classId !== 'all') {
router.push('/eventMonthView');
router.push(`${router.asPath}/events/${selectedDate}`);
ReactGA.event('month-name-clicked', { selectedCohortID: classId });
}
};
Expand Down Expand Up @@ -318,7 +318,7 @@ const TeachingCenterDetails = () => {
</Typography>
{cohortDetails?.centerType && (
<Typography textAlign={'left'} fontSize={'22px'}>
{cohortDetails?.centerType}
{cohortDetails?.centerType}
</Typography>
)}
<Box>
Expand All @@ -327,21 +327,21 @@ const TeachingCenterDetails = () => {
fontSize={'11px'}
fontWeight={500}
>
{cohortDetails?.address}
{cohortDetails?.address}
</Typography>
</Box>
</Box>
</Box>
{role === Role.TEAM_LEADER && (
<IconButton
aria-label="more"
aria-controls="long-menu"
aria-haspopup="true"
onClick={handleMenuOpen}
sx={{ color: theme.palette.warning['A200'] }}
>
<MoreVertIcon />
</IconButton>
<IconButton
aria-label="more"
aria-controls="long-menu"
aria-haspopup="true"
onClick={handleMenuOpen}
sx={{ color: theme.palette.warning['A200'] }}
>
<MoreVertIcon />
</IconButton>
)}
<Menu
id="long-menu"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import Header from '@/components/Header';
import KeyboardBackspaceOutlinedIcon from '@mui/icons-material/KeyboardBackspaceOutlined';
import { Session } from '../utils/Interfaces';
import { Session } from '../../../../../utils/Interfaces';
import SessionCardFooter from '@/components/SessionCardFooter';
import SessionsCard from '@/components/SessionCard';
import { getSessions } from '@/services/Sessionservice';
Expand All @@ -14,10 +14,14 @@ import { shortDateFormat } from '@/utils/Helper';
import { getEventList } from '@/services/EventService';
import { showToastMessage } from '@/components/Toastify';
import MonthCalender from '@/components/MonthCalender';
import { useRouter } from 'next/router';
import { GetStaticPaths } from 'next';

const eventMonthView = () => {
const theme = useTheme<any>();
const { t } = useTranslation();
const router = useRouter();
const { date }: any = router.query;

const [sessions, setSessions] = useState<Session[]>([]);
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
Expand All @@ -28,7 +32,7 @@ const eventMonthView = () => {
useEffect(() => {
const getSessionsData = async () => {
try {
const today = shortDateFormat(selectedDate);
const date = shortDateFormat(selectedDate);
let cohortId;
if (typeof window !== 'undefined' && window.localStorage) {
cohortId = localStorage.getItem('classId') || '';
Expand All @@ -37,15 +41,15 @@ const eventMonthView = () => {
const limit = 0;
const offset = 0;
const filters = {
date: today,
date: date,
cohortId: cohortId,
status: ['live'],
};
const response = await getEventList({ limit, offset, filters });
let sessionArray: any[] = [];
let extraSessionArray: any[] = [];
if (response?.events.length > 0) {
response?.events.forEach((event: any) => {
response?.events?.forEach((event: any) => {
if (event.isRecurring) {
sessionArray.push(event);
}
Expand Down Expand Up @@ -112,8 +116,8 @@ const eventMonthView = () => {
onClick={() => {
window.history.back();
logEvent({
action: 'back-button-clicked-attendance-history-page',
category: 'Attendance History Page',
action: 'back-button-clicked-events-month-page',
category: 'events month Page',
label: 'Back Button Clicked',
});
}}
Expand Down Expand Up @@ -222,3 +226,10 @@ export async function getStaticProps({ locale }: { locale: string }) {
},
};
}

export const getStaticPaths: GetStaticPaths<{ slug: string }> = async () => {
return {
paths: [], //indicates that no page needs be created at build time
fallback: 'blocking', //indicates the type of fallback
};
};
Loading

0 comments on commit f1b250f

Please sign in to comment.