Skip to content

Commit 69225d3

Browse files
authored
Merge pull request #2454 from tekdi/release-1.13.0-prod-register
Release 1.13.0 prod register to teacher prod
2 parents f88e0af + ece2b32 commit 69225d3

File tree

10 files changed

+263
-131
lines changed

10 files changed

+263
-131
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ function ProgramsContent() {
3939
const enrolledTenantIds = tenantData
4040
.filter(
4141
(item: any) =>
42-
item.tenantStatus === 'active' && item.tenantName !== 'Pratham'
42+
(item.tenantStatus === 'active' ||
43+
item.tenantStatus === 'pending') &&
44+
item.tenantName !== 'Pratham'
4345
)
4446
.map((item: any) => item.tenantId);
4547
if (enrolledTenantIds.length > 0) {

apps/learner-web-app/src/components/Content/Player.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ const App = ({
7878
console.log('rt=======>', rt);
7979
const currentPath =
8080
typeof window !== 'undefined' ? window.location.pathname : '';
81-
const isThematicPath = currentPath.includes('/themantic');
81+
const hostname = typeof window !== 'undefined' ? window.location.hostname : '';
82+
const isThematicPath = currentPath.includes('/themantic')||hostname.includes('experimentoindia');
8283
const isPosPath = currentPath.includes('/pos');
8384

8485
if (!isThematicPath && !isPosPath && rt?.program) {
@@ -92,12 +93,13 @@ const App = ({
9293
return;
9394
}
9495
}
95-
}
9696
if(localStorage.getItem('channelId')!==rt.channel)
97-
{
98-
router.push('/unauthorized');
99-
return;
97+
{
98+
router.push('/unauthorized');
99+
return;
100+
}
100101
}
102+
101103

102104
const response2 = await ContentSearch({
103105
filters: {

apps/learner-web-app/src/components/EditProfile/EditProfile.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ const [responseFormData, setResponseFormData] = useState<any>({});
119119
},
120120
},
121121
]);
122+
delete responseFormForEnroll?.schema?.properties?.password;
123+
delete responseFormForEnroll?.schema?.properties.confirm_password;
124+
delete responseFormForEnroll?.schema?.properties?.username;
125+
delete responseFormForEnroll?.schema?.properties?.program;
126+
delete responseFormForEnroll?.schema?.properties?.batch;
127+
delete responseFormForEnroll?.schema?.properties?.center;
128+
delete responseFormForEnroll?.schema?.properties?.state;
129+
delete responseFormForEnroll?.schema?.properties?.district;
130+
delete responseFormForEnroll?.schema?.properties?.block;
131+
delete responseFormForEnroll?.schema?.properties?.village;
132+
responseFormForEnroll?.schema?.required?.pop('batch');
133+
122134
const responseFormCopy = JSON.parse(JSON.stringify(responseForm));
123135
setResponseFormData(responseFormCopy);
124136
console.log('responseForm===>', responseFormCopy?.schema);
@@ -159,10 +171,10 @@ const [responseFormData, setResponseFormData] = useState<any>({});
159171

160172
setUserFormData(mappedData);
161173
//unit name is missing from required so handled from frotnend
162-
let alterSchema = uponEnrollCompletion?updatedSchemaForEnroll:completeProfile
174+
let alterSchema = enrolledProgram?responseFormForEnroll?.schema:completeProfile
163175
? updatedSchema
164176
: responseForm?.schema;
165-
let alterUISchema = responseForm?.uiSchema;
177+
let alterUISchema =enrolledProgram? responseFormForEnroll?.uiSchema: responseForm?.uiSchema;
166178

167179
// Set mobile field states
168180
setMobileAddUiSchema(responseForm?.uiSchema?.mobile);

apps/learner-web-app/src/components/ProgramSwitchModal/ProgramSwitchModal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const ProgramSwitchModal: React.FC<ProgramSwitchModalProps> = ({
5353
const [currentProgram, setCurrentProgram] = useState<TenantData | null>(null);
5454
const [loading, setLoading] = useState(true);
5555
const [isAllProgramRegistred, setIsAllProgramRegistred] = useState<string | null>(null);
56+
const [userProgram, setUserProgram] = useState<string | null>(null);
5657

5758
useEffect(() => {
5859
const fetchEnrolledPrograms = async () => {
@@ -61,6 +62,7 @@ const ProgramSwitchModal: React.FC<ProgramSwitchModalProps> = ({
6162
const userId = localStorage.getItem('userId');
6263
const currentTenantId = localStorage.getItem('tenantId');
6364
const currentProgramName = localStorage.getItem('userProgram');
65+
setUserProgram(currentProgramName);
6466

6567
if (!userId) {
6668
setLoading(false);
@@ -403,7 +405,8 @@ const ProgramSwitchModal: React.FC<ProgramSwitchModalProps> = ({
403405
>
404406
Home
405407
</Button>
406-
{isAllProgramRegistred !== 'yes' && (
408+
{(isAllProgramRegistred === 'no' ||
409+
(userProgram !== null && userProgram !== 'Pragyanpath')) && (
407410
<Button
408411
variant="outlined"
409412
fullWidth

libs/shared-lib-v2/src/DynamicForm/components/DynamicForm.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ const DynamicForm = ({
315315
});
316316

317317
// remove from required mobile
318-
requiredArray = requiredArray.filter(
318+
requiredArray = requiredArray?.filter(
319319
(key) => !requiredKeys2.includes(key)
320320
);
321321

@@ -388,7 +388,7 @@ const DynamicForm = ({
388388
delete formData?.guardian_name;
389389

390390
// remove from required
391-
requiredArray = requiredArray.filter(
391+
requiredArray = requiredArray?.filter(
392392
(key) => !requiredKeys.includes(key)
393393
);
394394

@@ -466,10 +466,10 @@ const DynamicForm = ({
466466
let requiredArray = oldFormSchema?.required;
467467

468468
// remove from required
469-
requiredArray = requiredArray.filter(
469+
requiredArray = requiredArray?.filter(
470470
(key) => !requiredKeys.includes(key)
471471
);
472-
requiredArray = requiredArray.filter(
472+
requiredArray = requiredArray?.filter(
473473
(key) => !requiredKeys2.includes(key)
474474
);
475475

mfes/content/src/components/Card/ContentCardGrid.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const ContentCardGrid = memo((props: ContentCardGridProps) => {
3131
const isMd = useMediaQuery(theme.breakpoints.only('md'));
3232
const isLg = useMediaQuery(theme.breakpoints.only('lg'));
3333
const isXl = useMediaQuery(theme.breakpoints.up('xl'));
34+
const currentPath = typeof window !== 'undefined' ? window.location.pathname : '';
35+
const isThematicPath = currentPath.includes('/themantic');
3436

3537
// Calculate items per row based on breakpoints and _grid overrides
3638
const getItemsPerRow = () => {
@@ -175,8 +177,11 @@ console.log("props.contentData",props.contentData)
175177
lg={3}
176178
xl={2.4}
177179
{..._grid}
178-
sx={{ display: 'flex', ...(_grid?.sx ?? {}) }}
179-
>
180+
sx={{
181+
...(isThematicPath ? { display: 'flex' } : {}),
182+
...(_grid?.sx ?? {}),
183+
}}
184+
>
180185
<ContentCard
181186
item={item}
182187
type={props.type}

mfes/content/src/components/Content/ContentEnroll.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ const ContentDetails = (props: ContentDetailsProps) => {
5858

5959
console.log('result=======>', result?.program);
6060
const currentPath = typeof window !== 'undefined' ? window.location.pathname : '';
61+
const hostname = typeof window !== 'undefined' ? window.location.hostname : '';
6162
console.log('currentPath=======>', currentPath);
62-
const isThematicPath = currentPath.includes('/themantic');
63+
const isThematicPath = currentPath.includes('/themantic') || hostname.includes('experimentoindia');
6364
const isPosPath = currentPath.includes('/pos');
6465
console.log('isThematicPath=======>', isThematicPath);
6566

@@ -71,12 +72,14 @@ if(!isThematicPath && !isPosPath && result?.program) {
7172
router.push('/unauthorized');
7273
return;
7374
}
74-
}}
75-
if(localStorage.getItem('channelId')!==result.channel)
76-
{
77-
router.push('/unauthorized');
78-
return;
79-
}
75+
} if(localStorage.getItem('channelId')!==result.channel)
76+
{
77+
router.push('/unauthorized');
78+
return;
79+
}
80+
81+
}
82+
8083
const userId = getUserId(props?._config?.userIdLocalstorageName);
8184
setCheckLocalAuth(checkAuth(Boolean(userId)));
8285
if (props?._config?.isEnrollmentRequired !== false) {

mfes/content/src/components/Content/CourseUnitDetails.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ export default function Details(props: DetailsProps) {
7777
mode: 'edit',
7878
}) as any;
7979
const currentPath = typeof window !== 'undefined' ? window.location.pathname : '';
80-
const isThematicPath = currentPath.includes('/themantic');
80+
const hostname = typeof window !== 'undefined' ? window.location.hostname : '';
8181
const isPosPath = currentPath.includes('/pos');
82+
const isThematicPath = currentPath.includes('/themantic')||hostname.includes('experimentoindia');
83+
8284
if(!isThematicPath && !isPosPath && resultHierarchyCourse?.program) {
8385
console.log('rt=======>', resultHierarchyCourse);
8486
if(localStorage.getItem('channelId')==="pos-channel"){

0 commit comments

Comments
 (0)