Skip to content

Commit

Permalink
Merge branch 'release-1.0.0' of github.com:tekdi/teachers-app into re…
Browse files Browse the repository at this point in the history
…lease-1.0.0
  • Loading branch information
Rushikesh-Sonawane99 committed Nov 25, 2024
2 parents a1c678c + 3a8021b commit b009842
Show file tree
Hide file tree
Showing 7 changed files with 192 additions and 108 deletions.
52 changes: 25 additions & 27 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"START_TIME_ERROR": "Start time cannot be later than end time.",
"END_TIME_ERROR": "End time cannot be earlier than start time.",
"START_DATE_ERROR": "Start date cannot be later than end date.",
"END_DATE_ERROR": "End date cannot be earlier than start date."
"END_DATE_ERROR": "End date cannot be earlier than start date.",
"IDENTIFIER_NOT_FOUND": "Identifier not found! Cannot Open Content!"
},
"MANAGE_USERS": {
"CENTERS_REQUESTED_SUCCESSFULLY": "Center requested successfully",
Expand Down Expand Up @@ -596,35 +597,32 @@
"BOARD": "Board",
"CHOOSE_BOARD": "Choose which Board the Learner is going to be enrolled in",
"CHOOSE_SUBJECT": "Choose which subjects the learner is enrolling for",
"SUBJECTS_ENROLLED":"Subjects Enrolled",
"EXAM_REGISTRATION_FEES_PAID":"Exam Registration Fees Paid?",
"SUBJECTS_ENROLLED": "Subjects Enrolled",
"EXAM_REGISTRATION_FEES_PAID": "Exam Registration Fees Paid?",
"EDIT": "Edit",
"SURE_GO_BACK": "Are you sure you want to go back? Your progress might be lost."
},
"OBSERVATION": {
"OBSERVATION_START": "Start Observation",
"OBSERVATION_DETAILS":"Observation Details",
"ADD_ENTITY":"Add {{entityType}} in observation list",
"SEARCH_ENTITY":"Search {{entityType}} name",
"OBSERVATIONS":"{{name}} Observations",
"SEARCH_OBSERVATIONS":"Search Observations",
"CONTINUE":"Continue",
"SUBMITTED":"Submitted",
"FORM_SAVED_SUCCESSFULLY":"Form changes saved successfully",
"FORM_SUBMIT_SUCCESSFULLY":"Form submitted successfully",
"NOT_STARTED":"Not Started",
"COMPLETED":"Completed",
"INPROGRESS":"In-Progress",
"NO_DATA_FOUND":"No {{entity}} found",
"NO_RESULT_FOUND":"No Observations found for {{entity}}",
"NO_OBSERVATION_EXPIRED":"No observation expired for {{entity}}",
"DAYS_LEFT":"Days left",
"THIS_OBSERVATION_EXPIRED":"This observation is expired",
"DUE_DATE":"Due date",
"SURVEY_FORMS":"Survey Forms",
"OBSERVATION_STATUS":"Observation Status"


}

"OBSERVATION_DETAILS": "Observation Details",
"ADD_ENTITY": "Add {{entityType}} in observation list",
"SEARCH_ENTITY": "Search {{entityType}} name",
"OBSERVATIONS": "{{name}} Observations",
"SEARCH_OBSERVATIONS": "Search Observations",
"CONTINUE": "Continue",
"SUBMITTED": "Submitted",
"FORM_SAVED_SUCCESSFULLY": "Form changes saved successfully",
"FORM_SUBMIT_SUCCESSFULLY": "Form submitted successfully",
"NOT_STARTED": "Not Started",
"COMPLETED": "Completed",
"INPROGRESS": "In-Progress",
"NO_DATA_FOUND": "No {{entity}} found",
"NO_RESULT_FOUND": "No Observations found for {{entity}}",
"NO_OBSERVATION_EXPIRED": "No observation expired for {{entity}}",
"DAYS_LEFT": "Days left",
"THIS_OBSERVATION_EXPIRED": "This observation is expired",
"DUE_DATE": "Due date",
"SURVEY_FORMS": "Survey Forms",
"OBSERVATION_STATUS": "Observation Status"
}
}
139 changes: 71 additions & 68 deletions src/components/PieChartGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,81 +62,84 @@ const PieChartGraph: React.FC<PieChartGraphProps> = ({ stagesCount }) => {
};

return (
<Box
sx={{
background: '#FFF8F2',
p: '16px',
mt: 2,
boxShadow: 'rgba(0, 0, 0, 0.24) 0px 3px 8px',
borderRadius: '8px', // Optional: to make the corners rounded
'@media (max-width: 700px)': {
p: '16px 16px 0px',
},
}}
>
<Box
sx={{
background: '#FFF8F2',
p: '16px',
mt: 2,
'@media (max-width: 700px)': {
p: '16px 16px 0px',
},
color: theme.palette.warning['400'],
fontSize: '14px',
fontWeight: '600',
}}
>
<Box
sx={{
color: theme.palette.warning['400'],
fontSize: '14px',
fontWeight: '600',
}}
>
Stages and Number of Students
</Box>

<Box
sx={{
height: 150,
'@media (min-width: 400px)': {
height: 200,
},
'@media (min-width: 500px)': {
height: 300,
},
'@media (min-width: 700px)': {
height: 400,
},
}}
>
<ResponsiveContainer width="100%" height="100%">
<PieChart>
<Pie
data={data}
cx="50%"
cy="50%"
labelLine={false}
label={false}
outerRadius="80%"
fill="#8884d8"
dataKey="value"
>
{data.map((entry, index) => (
<Cell
key={`cell-${index}`}
fill={COLORS[index % COLORS.length]}
/>
))}
</Pie>
Stages and Number of Students
</Box>

{isMobile ? (
<Legend
layout="vertical"
align="right"
verticalAlign="middle"
formatter={renderLegendText}
iconType="circle"
/>
) : (
<Legend
layout="horizontal"
align="center"
verticalAlign="bottom"
formatter={renderLegendText}
iconType="circle"
<Box
sx={{
height: 150,
'@media (min-width: 400px)': {
height: 200,
},
'@media (min-width: 500px)': {
height: 300,
},
'@media (min-width: 700px)': {
height: 400,
},
}}
>
<ResponsiveContainer width="100%" height="100%">
<PieChart>
<Pie
data={data}
cx="50%"
cy="50%"
labelLine={false}
label={false}
outerRadius="80%"
fill="#8884d8"
dataKey="value"
>
{data.map((entry, index) => (
<Cell
key={`cell-${index}`}
fill={COLORS[index % COLORS.length]}
/>
)}
</PieChart>
</ResponsiveContainer>
</Box>
))}
</Pie>

{isMobile ? (
<Legend
layout="vertical"
align="right"
verticalAlign="middle"
formatter={renderLegendText}
iconType="circle"
/>
) : (
<Legend
layout="horizontal"
align="center"
verticalAlign="bottom"
formatter={renderLegendText}
iconType="circle"
/>
)}
</PieChart>
</ResponsiveContainer>
</Box>
</Box>

);
};

Expand Down
22 changes: 15 additions & 7 deletions src/components/SessionCardFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ const SessionCardFooter: React.FC<SessionCardFooterProps> = ({
fetchTopicSubtopic();
}, [item]);

const handleComponentOpen = () => {
setSelectedTopic('');
setSelectedSubtopics([]);
};

const handleTopicSelection = (topic: string) => {
setSelectedTopic(topic);
console.log(topic);
Expand Down Expand Up @@ -223,6 +228,15 @@ const SessionCardFooter: React.FC<SessionCardFooterProps> = ({
updateTopicSubtopic();
};

const handleClick = () => {
handleComponentOpen();
if (topicList && transformedTasks && eventStatus === EventStatus.UPCOMING) {
handleOpen();
} else {
handleError();
}
};

useEffect(() => {
const startDateTime = convertUTCToIST(item?.startDateTime);
const startDate = startDateTime.date;
Expand Down Expand Up @@ -336,13 +350,7 @@ const SessionCardFooter: React.FC<SessionCardFooterProps> = ({
cursor: 'pointer',
alignItems: 'center',
}}
onClick={
topicList &&
transformedTasks &&
eventStatus === EventStatus.UPCOMING
? handleOpen
: handleError
}
onClick={handleClick}
>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<PriorityHighIcon
Expand Down
19 changes: 18 additions & 1 deletion src/components/TopicDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { EventStatus } from '@/utils/app.constant';
import { RequisiteType } from '../../app.config';
import NoDataFound from './common/NoDataFound';
import router from 'next/router';
import { showToastMessage } from './Toastify';
interface TopicDetailsProps {
topic: string;
subTopic: [];
Expand Down Expand Up @@ -60,7 +61,11 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({

const handlePlayers = (identifier: string) => {
sessionStorage.setItem('previousPage', window.location.href);
router.push(`/play/content/${identifier}`);
if (identifier !== undefined && identifier !== '') {
router.push(`/play/content/${identifier}`);
} else {
showToastMessage(t('CENTER_SESSION.IDENTIFIER_NOT_FOUND'), 'error');
}
};

return (
Expand Down Expand Up @@ -198,6 +203,10 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
<Grid item xs={6} sx={{ mt: 2 }} key={item.name}>
<Box
className="facilitator-bg"
sx={{
backgroundImage: `url(${item?.appIcon ? item.appIcon : '/decorationBg.png'})`,
position: 'relative',
}}
onClick={() => handlePlayers(item?.identifier)}
>
<Box
Expand Down Expand Up @@ -270,6 +279,10 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
<Grid item xs={6} sx={{ mt: 2 }} key={item.name}>
<Box
className="facilitator-bg"
sx={{
backgroundImage: `url(${item?.appIcon ? item.appIcon : '/decorationBg.png'})`,
position: 'relative',
}}
onClick={() => handlePlayers(item?.identifier)}
>
<Box
Expand Down Expand Up @@ -342,6 +355,10 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
<Grid item xs={6} sx={{ mt: 2 }} key={item.name}>
<Box
className="facilitator-bg"
sx={{
backgroundImage: `url(${item?.appIcon ? item.appIcon : '/decorationBg.png'})`,
position: 'relative',
}}
onClick={() => handlePlayers(item?.identifier)}
>
<Box
Expand Down
Loading

0 comments on commit b009842

Please sign in to comment.