Skip to content

Commit d1356fb

Browse files
authored
Merge pull request #2474 from AkshataKatwal16/release-1.13.0-prod-register
Issue feat: Resolve atm issue regarding approve button and lead management pi-chart issue
2 parents 15764da + 3051dbc commit d1356fb

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

mfes/scp-teacher-repo/src/components/UserRegistration/RegistrationPieChart.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ const RegistrationPieChart: React.FC<RegistrationPieChartProps> = ({ locationFil
3333
{ name: t('USER_REGISTRATION.MAY_JOIN_UPCOMING_YEAR'), value: counts.mayJoin, color: '#FFD700' },
3434
];
3535

36-
const hasLocationFilters =
37-
Boolean(locationFilters.states?.length) &&
38-
Boolean(locationFilters.districts?.length) &&
39-
Boolean(locationFilters.blocks?.length) &&
40-
Boolean(locationFilters.villages?.length);
36+
// Only require states to be selected, other levels are optional
37+
const hasLocationFilters = Boolean(locationFilters.states?.length);
4138

4239
const buildFilters = (overrides: Record<string, any> = {}) => {
4340
const filters: Record<string, any> = {

mfes/scp-teacher-repo/src/components/assessment/AnswerSheet.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface AnswerSheetProps {
4040
onApprove: () => void;
4141
onScoreEdit: (question: ScoreDetail) => void;
4242
isApproved?: boolean;
43+
isLoading?: boolean;
4344
questionNumberingMap?: Record<string, string>;
4445
sectionMapping?: Record<string, string>;
4546
}
@@ -214,7 +215,7 @@ const AISuggestion: React.FC<AISuggestionProps> = React.memo(
214215
}
215216

216217
// Function to truncate text to 25 words with better handling for Hindi text
217-
const truncateText = (text: string, maxWords: number = 25) => {
218+
const truncateText = (text: string, maxWords = 25) => {
218219
if (!text || text.trim() === '') {
219220
return text;
220221
}
@@ -497,10 +498,11 @@ ScoreSummary.displayName = 'ScoreSummary';
497498
interface ApproveButtonProps {
498499
onApprove: () => void;
499500
isApproved: boolean;
501+
isLoading?: boolean;
500502
}
501503

502504
const ApproveButton: React.FC<ApproveButtonProps> = React.memo(
503-
({ onApprove, isApproved }) => {
505+
({ onApprove, isApproved, isLoading = false }) => {
504506
if (isApproved) return null;
505507

506508
return (
@@ -509,6 +511,7 @@ const ApproveButton: React.FC<ApproveButtonProps> = React.memo(
509511
variant="contained"
510512
fullWidth
511513
onClick={onApprove}
514+
disabled={isLoading}
512515
sx={{
513516
bgcolor: '#FDBE16',
514517
color: '#4D4639',
@@ -525,6 +528,10 @@ const ApproveButton: React.FC<ApproveButtonProps> = React.memo(
525528
transform: 'translateY(-2px)',
526529
boxShadow: '0 4px 8px rgba(253, 190, 22, 0.3)',
527530
},
531+
'&:disabled': {
532+
bgcolor: '#E0E0E0',
533+
color: '#9E9E9E',
534+
},
528535
}}
529536
>
530537
Approve Marks & Notify Learner
@@ -717,6 +724,7 @@ const AnswerSheet: React.FC<AnswerSheetProps> = ({
717724
onApprove,
718725
onScoreEdit,
719726
isApproved = false,
727+
isLoading = false,
720728
questionNumberingMap = {},
721729
sectionMapping = {},
722730
}) => {
@@ -737,7 +745,7 @@ const AnswerSheet: React.FC<AnswerSheetProps> = ({
737745
/>
738746

739747
{/* Approve Button */}
740-
<ApproveButton onApprove={onApprove} isApproved={isApproved} />
748+
<ApproveButton onApprove={onApprove} isApproved={isApproved} isLoading={isLoading} />
741749

742750
{/* Questions List */}
743751
<QuestionsList

mfes/scp-teacher-repo/src/pages/ai-assessments/[assessmentId]/[userId]/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,7 @@ const AssessmentDetails = () => {
13721372
onApprove={handleApproveClick}
13731373
onScoreEdit={handleScoreClick}
13741374
isApproved={assessmentData?.status === 'Approved'}
1375+
isLoading={editLoading}
13751376
questionNumberingMap={questionNumberingMap}
13761377
sectionMapping={sectionMapping}
13771378
/>

0 commit comments

Comments
 (0)