Skip to content

Commit 5c8173a

Browse files
authored
Merge pull request #2522 from tekdi/release-1.13.0-prod-register
Release 1.13.0 prod register to admin qa
2 parents 4f4c483 + e8d4f7b commit 5c8173a

File tree

18 files changed

+480
-250
lines changed

18 files changed

+480
-250
lines changed

apps/admin-app-repo/src/components/DynamicForm/RJSFWidget/CustomTextFieldWidget.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const CustomTextFieldWidget = ({
1515
onFocus,
1616
rawErrors = [],
1717
placeholder,
18+
options = {},
19+
uiSchema = {},
1820
}: WidgetProps) => {
1921
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
2022
const val = event.target.value;
@@ -32,6 +34,19 @@ const CustomTextFieldWidget = ({
3234
(error) => !error.toLowerCase().includes('required')
3335
);
3436

37+
// Get helper text from options (RJSF merges ui:options into options prop)
38+
// Also check uiSchema directly as fallback
39+
const helperTextFromOptions =
40+
options?.helperText ||
41+
options?.note ||
42+
uiSchema?.['ui:options']?.helperText ||
43+
uiSchema?.['ui:options']?.note ||
44+
'';
45+
46+
// Combine error and helper text - show error if exists, otherwise show helper text
47+
const helperText =
48+
displayErrors.length > 0 ? displayErrors[0] : helperTextFromOptions;
49+
3550
return (
3651
<TextField
3752
fullWidth
@@ -45,9 +60,9 @@ const CustomTextFieldWidget = ({
4560
onFocus={handleFocus}
4661
placeholder={placeholder}
4762
error={displayErrors.length > 0}
48-
helperText={displayErrors.length > 0 ? displayErrors[0] : ''}
63+
helperText={helperText}
4964
variant="outlined"
50-
// margin="normal"
65+
// margin="normal"
5166
/>
5267
);
5368
};
96.6 KB
Binary file not shown.

apps/learner-web-app/src/app/enroll-profile-completion/page.tsx

Lines changed: 94 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ const EnrollProfileCompletionInner = () => {
5050
});
5151
}
5252
else{
53-
// Enroll user to tenant
54-
await enrollUserTenant({
55-
userId: storedUserId,
56-
tenantId: program.tenantId,
57-
roleId: storedRoleId,
58-
});
59-
}
53+
// Enroll user to tenant
54+
await enrollUserTenant({
55+
userId: storedUserId,
56+
tenantId: program.tenantId,
57+
roleId: storedRoleId,
58+
});
59+
}
6060
// Get user details to find tenant data
6161
const userResponse = await getUserDetails(storedUserId, true);
6262
const tenantData = userResponse?.result?.userData?.tenantData?.find(
@@ -72,68 +72,78 @@ const EnrollProfileCompletionInner = () => {
7272
// Check if user has Learner role
7373
const roles = tenantData?.roles || [];
7474
const hasLearnerRole = roles.some((role: any) => role?.roleName === 'Learner');
75-
75+
7676
if (!hasLearnerRole && roles.length > 0) {
7777
console.error('User does not have Learner role for this program');
7878
router.push('/programs');
7979
return;
80-
}
81-
82-
else{
83-
// Set localStorage values similar to callBackSwitchDialog
84-
localStorage.setItem('userId', storedUserId);
85-
localStorage.setItem('templtateId', tenantData?.templateId);
80+
} else {
81+
// Set localStorage values similar to callBackSwitchDialog
82+
localStorage.setItem('userId', storedUserId);
83+
localStorage.setItem('templtateId', tenantData?.templateId);
8684
localStorage.setItem('userIdName', userResponse?.result?.userData?.username);
8785
localStorage.setItem('firstName', userResponse?.result?.userData?.firstName || '');
8886

89-
const tenantId = tenantData?.tenantId;
90-
const tenantName = tenantData?.tenantName;
91-
const uiConfig = tenantData?.params?.uiConfig;
92-
const landingPage = tenantData?.params?.uiConfig?.landingPage;
93-
94-
localStorage.setItem('landingPage', landingPage);
95-
localStorage.setItem('uiConfig', JSON.stringify(uiConfig || {}));
96-
localStorage.setItem('tenantId', tenantId);
97-
localStorage.setItem('userProgram', tenantName);
98-
99-
// Check profile completion
100-
await profileComplitionCheck();
101-
102-
// Handle academic year for YOUTHNET
103-
if (tenantName === TenantName.YOUTHNET) {
104-
const academicYearResponse = await getAcademicYear();
105-
if (academicYearResponse?.[0]?.id) {
106-
localStorage.setItem('academicYearId', academicYearResponse[0].id);
87+
const tenantId = tenantData?.tenantId;
88+
const tenantName = tenantData?.tenantName;
89+
const uiConfig = tenantData?.params?.uiConfig;
90+
const landingPage = tenantData?.params?.uiConfig?.landingPage;
91+
92+
localStorage.setItem('landingPage', landingPage);
93+
localStorage.setItem('uiConfig', JSON.stringify(uiConfig || {}));
94+
localStorage.setItem('tenantId', tenantId);
95+
localStorage.setItem('userProgram', tenantName);
96+
97+
// Check profile completion
98+
await profileComplitionCheck();
99+
100+
// Handle academic year for YOUTHNET
101+
if (tenantName === TenantName.YOUTHNET) {
102+
const academicYearResponse = await getAcademicYear();
103+
if (academicYearResponse?.[0]?.id) {
104+
localStorage.setItem('academicYearId', academicYearResponse[0].id);
105+
}
107106
}
108-
}
109-
110-
// Set channel and collection framework
111-
const channelId = tenantData?.channelId;
112-
localStorage.setItem('channelId', channelId);
113107

114-
const collectionFramework = tenantData?.collectionFramework;
115-
localStorage.setItem('collectionFramework', collectionFramework);
108+
// Set channel and collection framework
109+
const channelId = tenantData?.channelId;
110+
localStorage.setItem('channelId', channelId);
116111

117-
// Set cookie
118-
document.cookie = `token=${token}; path=/; secure; SameSite=Strict`;
112+
const collectionFramework = tenantData?.collectionFramework;
113+
localStorage.setItem('collectionFramework', collectionFramework);
119114

120-
// Log analytics event
121-
logEvent({
122-
action: 'access-program-after-enrollment',
123-
category: 'Enrollment Profile Completion',
124-
label: 'Profile Completed and Program Accessed',
125-
});
115+
// Set cookie
116+
document.cookie = `token=${token}; path=/; secure; SameSite=Strict`;
126117

127-
// Clean up enrolled program data
128-
localStorage.removeItem('enrolledProgramData');
129-
localStorage.removeItem('previousTenantId');
130-
131-
// Store landing page for later navigation
132-
setLandingPage(landingPage || '/home');
118+
// Log analytics event
119+
logEvent({
120+
action: 'access-program-after-enrollment',
121+
category: 'Enrollment Profile Completion',
122+
label: 'Profile Completed and Program Accessed',
123+
});
133124

134-
// Show success modal instead of redirecting immediately
135-
setSignupSuccessModal(true);
136-
}
125+
// Clean up enrolled program data
126+
localStorage.removeItem('enrolledProgramData');
127+
localStorage.removeItem('previousTenantId');
128+
129+
// Store landing page for later navigation
130+
const finalLandingPage = landingPage || '/home';
131+
setLandingPage(finalLandingPage);
132+
133+
// Check if isForNavaPatham is true, skip popup and directly trigger start learning action
134+
const isForNavaPatham =
135+
typeof window !== 'undefined'
136+
? localStorage.getItem('isForNavaPatham') === 'true'
137+
: false;
138+
139+
if (isForNavaPatham) {
140+
// Skip popup and directly trigger start learning action
141+
onSigin(finalLandingPage);
142+
} else {
143+
// Show success modal instead of redirecting immediately
144+
setSignupSuccessModal(true);
145+
}
146+
}
137147
} catch (error) {
138148
console.error('Failed to access program:', error);
139149
router.push('/programs');
@@ -144,36 +154,36 @@ const EnrollProfileCompletionInner = () => {
144154
setSignupSuccessModal(false);
145155
};
146156

147-
const onSigin = () => {
157+
const onSigin = (customLandingPage?: string) => {
148158
setSignupSuccessModal(false);
149159
console.log('enroll user to tenant', localStorage.getItem('tenantId'));
150-
if(localStorage.getItem('isAndroidApp') == 'yes')
151-
{
152-
// Send message to React Native WebView
153-
154-
// const enrolledProgramData = localStorage.getItem('enrolledProgramData');
155-
156-
// const program = JSON.parse(enrolledProgramData || '{}');
157-
158-
159-
if (window.ReactNativeWebView) {
160-
window.ReactNativeWebView.postMessage(JSON.stringify({
161-
type: 'ENROLL_PROGRAM_EVENT', // Event type identifier
162-
data: {
163-
userId: localStorage.getItem('userId'),
164-
tenantId: localStorage.getItem('tenantId'),
165-
token: localStorage.getItem('token'),
166-
refreshToken: localStorage.getItem('refreshTokenForAndroid'),
167-
168-
// Add any data you want to send
169-
}
170-
}));
171-
}
172-
}
173-
else{
174-
localStorage.removeItem('enrollTenantId')
175-
router.push(landingPage || '/home');
160+
const targetLandingPage = customLandingPage || landingPage || '/home';
161+
162+
if (localStorage.getItem('isAndroidApp') == 'yes') {
163+
// Send message to React Native WebView
176164

165+
// const enrolledProgramData = localStorage.getItem('enrolledProgramData');
166+
167+
// const program = JSON.parse(enrolledProgramData || '{}');
168+
169+
if (window.ReactNativeWebView) {
170+
window.ReactNativeWebView.postMessage(
171+
JSON.stringify({
172+
type: 'ENROLL_PROGRAM_EVENT', // Event type identifier
173+
data: {
174+
userId: localStorage.getItem('userId'),
175+
tenantId: localStorage.getItem('tenantId'),
176+
token: localStorage.getItem('token'),
177+
refreshToken: localStorage.getItem('refreshTokenForAndroid'),
178+
179+
// Add any data you want to send
180+
},
181+
})
182+
);
183+
}
184+
} else {
185+
localStorage.removeItem('enrollTenantId');
186+
router.push(targetLandingPage);
177187
}
178188
// Navigate to landing page
179189
};
@@ -185,7 +195,7 @@ const EnrollProfileCompletionInner = () => {
185195
enrolledProgram={true}
186196
uponEnrollCompletion={handleAccessProgram}
187197
/>
188-
198+
189199
<SimpleModal
190200
open={signupSuccessModal}
191201
onClose={onCloseSignupSuccessModal}
@@ -210,4 +220,3 @@ const EnrollProfileCompletionPage = () => {
210220
};
211221

212222
export default EnrollProfileCompletionPage;
213-

apps/learner-web-app/src/app/login/page.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ const LoginPage = () => {
168168
const [tenantName, setTenantName] = useState<string>('');
169169
const [roleId, setRoleId] = useState<string>('');
170170
const [roleName, setRoleName] = useState<string>('');
171+
const [isAndroidApp, setIsAndroidApp] = useState(true);
171172

172173
const handleSuccessfulLogin = useCallback(
173174
async (
@@ -366,6 +367,8 @@ const LoginPage = () => {
366367
useEffect(() => {
367368
const init = async () => {
368369
try {
370+
const isAndroid = localStorage.getItem('isAndroidApp') === 'yes';
371+
setIsAndroidApp(isAndroid);
369372
// localStorage.clear();()
370373
preserveLocalStorage();
371374

@@ -513,15 +516,16 @@ const LoginPage = () => {
513516
/>
514517

515518
{/* App Download Section - Only visible on mobile */}
516-
<Box
519+
{ !isAndroidApp && (<Box
517520
display={{ xs: 'flex', sm: 'none' }}
518521
justifyContent="center"
519522
alignItems="center"
520523
width="100%"
521524
mt={4}
522525
>
523526
<AppDownloadSection />
524-
</Box>
527+
</Box>)
528+
}
525529
</Box>
526530
</Box>
527531
</Box>

apps/learner-web-app/src/app/nava-patham/page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ export default function LandingPage() {
141141
}
142142
};
143143

144-
const aboutPrathamText = t('LANDING.ABOUT_PRATHAM_TEXT');
144+
const aboutNavaPathamText = t('NAVAPATHAM.ABOUT_NAVAPATHAM_TEXT');
145+
const aboutPrathamText = t('NAVAPATHAM.ABOUT_PRATHAM_INFO');
145146

146147
return (
147148
<>
@@ -352,7 +353,7 @@ export default function LandingPage() {
352353
whiteSpace: 'pre-line',
353354
}}
354355
>
355-
{aboutPrathamText}
356+
{aboutNavaPathamText}
356357
</Typography>
357358
</Grid>
358359
</Grid>
@@ -380,7 +381,7 @@ export default function LandingPage() {
380381
color: '#FFC107',
381382
}}
382383
>
383-
{t('LANDING.ABOUT_PRATHAM_LEARNING_PLATFORM')}
384+
{t('NAVAPATHAM.ABOUT_PRATHAM')}
384385
</Typography>
385386
<Typography
386387
variant="body1"

0 commit comments

Comments
 (0)