Skip to content

Commit

Permalink
Issue #PS-326 feat: resolve confilts and comments on code
Browse files Browse the repository at this point in the history
  • Loading branch information
upendraTekdi committed May 8, 2024
1 parent 879f36d commit d26989f
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 149 deletions.
15 changes: 2 additions & 13 deletions src/components/ExtraSessionsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@ import { Card, CardContent, Typography, Box } from '@mui/material';
import EditOutlined from '@mui/icons-material/EditOutlined';
import ContentCopyRoundedIcon from '@mui/icons-material/ContentCopyRounded';
import { useTranslation } from 'react-i18next';

interface ExtraSessionsCardProps {
subject: string;
instructor: string;
dateAndTime: string;
meetingURL: string;
onEditClick?: () => void;
onCopyClick?: () => void;
}
import { truncateURL } from '@/utils/Helper';
import { ExtraSessionsCardProps } from '@/utils/Interfaces';

const ExtraSessionsCard: React.FC<ExtraSessionsCardProps> = ({
subject,
Expand All @@ -22,10 +15,6 @@ const ExtraSessionsCard: React.FC<ExtraSessionsCardProps> = ({
onCopyClick,
}) => {
const { t } = useTranslation();
// Function to truncate URL if it's too long
const truncateURL = (url: string, maxLength: number) => {
return url.length > maxLength ? url.substr(0, maxLength - 3) + '...' : url;
};

return (
<Box>
Expand Down
8 changes: 8 additions & 0 deletions src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ const Dashboard: React.FC<DashboardProps> = () => {
setState({ ...state, openModal: false });
};

const handleEdit = () => {
//function for handle edit
};

const handleCopy = () => {
// function for handle copy
};

return (
<Box minHeight="100vh" textAlign={'center'}>
<Header />
Expand Down
4 changes: 3 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
"PERCENT_ATTENDANCE": "{{percent_students}}% Attendance",
"PRESENT_STUDENTS": "({{present_students}/{total_students}} present)",
"OVERVIEW": "Overview",
"MORE_DETAILS": "More Details"
"MORE_DETAILS": "More Details",
"EXTRA_CLASS": "Extra class",
"CENTER_ATTENDANCE": "Center Attendance"
},
"ATTENDANCE": {
"TOTAL_STUDENTS": "Total No of Students: {{count}}",
Expand Down
4 changes: 3 additions & 1 deletion src/translations/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
"PERCENT_ATTENDANCE": "{{percent_students}}% उपस्थिति",
"PRESENT_STUDENTS": "({{present_students}}/{{total_students}} मौजूद हैं)",
"OVERVIEW": "अवलोकन",
"MORE_DETAILS": "अधिक विवरण"
"MORE_DETAILS": "अधिक विवरण",
"EXTRA_CLASS": "अतिरिक्त क्लास",
"CENTER_ATTENDANCE": "केंद्रीय उपस्थिति"
},
"ATTENDANCE": {
"TOTAL_STUDENTS": "कुल छात्रों की संख्या: {{count}}",
Expand Down
4 changes: 3 additions & 1 deletion src/translations/mr.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
"PERCENT_ATTENDANCE": "{{percent_students}}% उपस्थिती",
"PRESENT_STUDENTS": "({{present_students}}/{{total_students}} उपस्थित)",
"OVERVIEW": "अवलोकन",
"MORE_DETAILS": "अधिक माहिती"
"MORE_DETAILS": "अधिक माहिती",
"EXTRA_CLASS": "अतिरिक्त कक्षा",
"CENTER_ATTENDANCE": "केंद्रीय उपस्थिती"
},
"ATTENDANCE": {
"TOTAL_STUDENTS": "एकूण विद्यार्थी: {{count}}",
Expand Down
79 changes: 47 additions & 32 deletions src/utils/Helper.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
export const ATTENDANCE_ENUM = {
PRESENT: 'present',
ABSENT: 'absent',
HALF_DAY: 'half-day',
NOT_MARKED: 'notmarked',
ON_LEAVE: 'on-leave'
};

export const MONTHS = [
PRESENT: 'present',
ABSENT: 'absent',
HALF_DAY: 'half-day',
NOT_MARKED: 'notmarked',
ON_LEAVE: 'on-leave',
};

export const MONTHS = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
];

export const formatDate = (dateString: string) => {
const [year, monthIndex, day] = dateString.split('-');
const month = MONTHS[parseInt(monthIndex, 10) - 1];
return `${day} ${month}, ${year}`;
};

export const getTodayDate = () => {
const currentDate = new Date();
const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // Adding 1 as month is zero-indexed
const day = String(currentDate.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
};

export const getMonthName = () => {
const currentDate = new Date();
const monthNames = [
'January',
'February',
'March',
Expand All @@ -18,29 +49,13 @@ export const ATTENDANCE_ENUM = {
'September',
'October',
'November',
'December'
'December',
];

export const formatDate = (dateString: string) => {
const [year, monthIndex, day] = dateString.split('-');
const month = MONTHS[parseInt(monthIndex, 10) - 1];
return `${day} ${month}, ${year}`;
};

export const getTodayDate = () => {
const currentDate = new Date();
const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // Adding 1 as month is zero-indexed
const day = String(currentDate.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
};
const monthIndex = currentDate.getMonth();
return monthNames[monthIndex];
};

export const getMonthName = () => {
const currentDate = new Date();
const monthNames = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
];
const monthIndex = currentDate.getMonth();
return monthNames[monthIndex];
};
// Function to truncate URL if it's too long
export const truncateURL = (url: string, maxLength: number) => {
return url.length > maxLength ? url.substr(0, maxLength - 3) + '...' : url;
};
Loading

0 comments on commit d26989f

Please sign in to comment.