Skip to content

Commit af87b18

Browse files
authored
Merge pull request #2633 from tekdi/release-1.15.0
Release 1.15.0 to teacher dev
2 parents 874e327 + 5ab891d commit af87b18

File tree

6 files changed

+303
-24
lines changed

6 files changed

+303
-24
lines changed

apps/admin-app-repo/src/pages/importCsv.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const ImportCsv = () => {
164164
const userProjectDetailsResponse = await getUserProjectDetails({
165165
id: courseId,
166166
});
167-
setUserProjectDetails(userProjectDetailsResponse?.result?.tasks);
167+
setUserProjectDetails(userProjectDetailsResponse?.result?.tasks?.filter((task: any) => task !== null && task !== undefined) || []);
168168
if (userProjectDetails?.length) {
169169
}
170170
setLoading(false);

apps/admin-app-repo/src/pages/subjectDetails.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,30 @@ const SubjectDetails = () => {
8989
);
9090
const setBoards = coursePlannerStore((state) => state.setBoards);
9191

92+
// Clear filters and subjects when board changes to prevent showing data from previous board
93+
useEffect(() => {
94+
if (boardDetails || boardName) {
95+
// Clear all selections
96+
setSelectedmedium("");
97+
setSelectedgrade("");
98+
setSelectedtype("");
99+
setSubject([]);
100+
setGrade([]);
101+
setType([]);
102+
103+
// Clear localStorage
104+
localStorage.removeItem("selectedMedium");
105+
localStorage.removeItem("selectedGrade");
106+
localStorage.removeItem("selectedType");
107+
localStorage.removeItem("overallCommonSubjects");
108+
109+
// Clear taxonomy store
110+
setTaxonomyMedium("");
111+
setTaxonomyGrade("");
112+
setTaxonomyType("");
113+
}
114+
}, [boardDetails, boardName]);
115+
92116
useEffect(() => {
93117
const savedMedium = localStorage.getItem("selectedMedium") || "";
94118
const savedGrade = localStorage.getItem("selectedGrade") || "";
@@ -338,6 +362,14 @@ console.log('matchingSubjects', matchingSubjects);
338362
}
339363
}, [tenantConfig, selectedtype]);
340364

365+
// Clear subjects if any required filter is missing
366+
// This ensures subjects are ONLY shown when all 3 filters are selected
367+
useEffect(() => {
368+
if (!selectedmedium || !selectedgrade || !selectedtype) {
369+
setSubject([]);
370+
}
371+
}, [selectedmedium, selectedgrade, selectedtype]);
372+
341373
// Auto-select medium if only one option is available
342374
useEffect(() => {
343375
if (medium.length === 1 && (!selectedmedium || selectedmedium === "")) {

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

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const App = ({
5757
const [breadCrumbs, setBreadCrumbs] = useState<any>();
5858
const [isShowMoreContent, setIsShowMoreContent] = useState(false);
5959
const [mimeType, setMemetype] = useState('');
60+
const [isVideo, setIsVideo] = useState(false);
6061
const [isDownloading, setIsDownloading] = useState(false);
6162
const [showSuccessMessage, setShowSuccessMessage] = useState(false);
6263
const [showJotFormModal, setShowJotFormModal] = useState(false);
@@ -66,6 +67,31 @@ const App = ({
6667
mimeType: string;
6768
} | null>(null);
6869

70+
const [isPortrait, setIsPortrait] = useState(false);
71+
72+
useEffect(() => {
73+
setIsVideo(mimeType=='video/mp4' || mimeType=='video/webm');
74+
}, [mimeType]);
75+
76+
// Check if device is in portrait mode (width < height)
77+
useEffect(() => {
78+
const checkOrientation = () => {
79+
setIsPortrait(window.innerWidth < window.innerHeight);
80+
};
81+
82+
// Check on mount
83+
checkOrientation();
84+
85+
// Listen for resize and orientation changes
86+
window.addEventListener('resize', checkOrientation);
87+
window.addEventListener('orientationchange', checkOrientation);
88+
89+
return () => {
90+
window.removeEventListener('resize', checkOrientation);
91+
window.removeEventListener('orientationchange', checkOrientation);
92+
};
93+
}, []);
94+
6995
let activeLink = null;
7096
if (typeof window !== 'undefined') {
7197
const searchParams = new URLSearchParams(window.location.search);
@@ -403,9 +429,13 @@ const App = ({
403429
unitId={unitId}
404430
mimeType={mimeType}
405431
{..._config?.player}
432+
isPortrait={isPortrait}
433+
isVideo={isVideo}
406434
/>
407435
{item?.content?.artifactUrl &&
436+
408437
isDownloadableMimeType(item?.content?.mimeType || mimeType) &&
438+
(!isPortrait || (isVideo && !isPortrait)) &&
409439
isDownloadContentEnabled() && (
410440
<Box
411441
sx={{
@@ -457,7 +487,8 @@ const App = ({
457487

458488
<Grid
459489
sx={{
460-
display: isShowMoreContent ? 'flex' : 'none',
490+
display: isShowMoreContent && (!isPortrait || (isVideo && !isPortrait)) ? 'flex' : 'none',
491+
461492
flexDirection: 'column',
462493
flex: { xs: 1, sm: 1, md: 9 },
463494
}}
@@ -615,6 +646,8 @@ const PlayerBox = ({
615646
trackable,
616647
isShowMoreContent,
617648
mimeType,
649+
isPortrait,
650+
isVideo
618651
}: any) => {
619652
const router = useRouter();
620653
const { t } = useTranslation();
@@ -696,6 +729,7 @@ const PlayerBox = ({
696729
width: isShowMoreContent
697730
? '100%'
698731
: { xs: '100%', sm: '100%', md: '90%', lg: '80%', xl: '70%' },
732+
...(isPortrait && isVideo ? { p:0, ml:-10, mr:-5 } : {}),
699733
}}
700734
>
701735
<iframe
@@ -718,8 +752,8 @@ const PlayerBox = ({
718752
aspectRatio: getAspectRatio(),
719753
}}
720754
allowFullScreen
721-
width="100%"
722-
height="100%"
755+
width={isPortrait && isVideo ? "110%" : "100%"}
756+
height={isPortrait && isVideo ? '300%' : '100%'}
723757
title="Embedded Localhost"
724758
allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture"
725759
frameBorder="0"

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

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,34 @@ const EditProfile = ({ completeProfile, enrolledProgram, uponEnrollCompletion }:
302302

303303
// Add family member fields to ui:order if it exists
304304
// They will be hidden initially and DynamicForm will show the appropriate one
305+
// Insert them right after family_member_details for proper ordering
305306
if (alterUISchema['ui:order']) {
306307
const fieldsToAdd = ['father_name', 'mother_name', 'spouse_name'];
307-
fieldsToAdd.forEach((field) => {
308-
if (!alterUISchema['ui:order'].includes(field)) {
309-
alterUISchema['ui:order'].push(field);
310-
}
311-
});
308+
const familyMemberDetailsIndex = alterUISchema['ui:order'].indexOf('family_member_details');
309+
310+
if (familyMemberDetailsIndex !== -1) {
311+
// First, remove the fields if they already exist in the order
312+
fieldsToAdd.forEach((field) => {
313+
const existingIndex = alterUISchema['ui:order'].indexOf(field);
314+
if (existingIndex !== -1) {
315+
alterUISchema['ui:order'].splice(existingIndex, 1);
316+
}
317+
});
318+
319+
// Then insert fields right after family_member_details in the correct order
320+
let insertPosition = alterUISchema['ui:order'].indexOf('family_member_details') + 1;
321+
fieldsToAdd.forEach((field) => {
322+
alterUISchema['ui:order'].splice(insertPosition, 0, field);
323+
insertPosition++; // Increment position for next field
324+
});
325+
} else {
326+
// Fallback: add at the end if family_member_details not found in order
327+
fieldsToAdd.forEach((field) => {
328+
if (!alterUISchema['ui:order'].includes(field)) {
329+
alterUISchema['ui:order'].push(field);
330+
}
331+
});
332+
}
312333
}
313334
}
314335
setAddSchema(alterSchema);

apps/learner-web-app/src/utils/helper.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const mapUserData = (userData: any) => {
3333
const getSingleSelectedValue = (label: any) =>
3434
userData.customFields
3535
.find((f: any) => f.label === label)
36-
?.selectedValues[0]?.id?.toString() || '';
36+
?.selectedValues[0]?.id?.toString() || userData.customFields.find((f: any) => f.label === label)?.selectedValues[0]?.value?.toString() || '';
3737

3838
const getSingleTextValue = (label: any) =>
3939
userData.customFields.find((f: any) => f.label === label)
@@ -54,11 +54,13 @@ export const mapUserData = (userData: any) => {
5454
spouse_name: getSingleTextValue('SPOUSE_NAME'),
5555

5656

57+
5758
marital_status: getSelectedValue('MARITAL_STATUS'),
5859
phone_type_accessible
5960
: getSingleSelectedValue('TYPE_OF_PHONE_ACCESSIBLE'),
6061
family_member_details
6162
: getSingleSelectedValue('FAMILY_MEMBER_DETAILS'),
63+
training_check: getSingleSelectedValue('HAVE_YOU_RECEIVE_ANY_PRIOR_TRAINING'),
6264
own_phone_check: getSingleSelectedValue('DOES_THIS_PHONE_BELONG_TO_YOU'),
6365
state: getSelectedValue('STATE'),
6466
district: getSelectedValue('DISTRICT'),
@@ -74,8 +76,7 @@ export const mapUserData = (userData: any) => {
7476
getSelectedValue(
7577
'WHAT_IS_YOUR_PRIMARY_WORK'
7678
) || [],
77-
training_check:
78-
getSelectedValue('HAVE_YOU_RECEIVE_ANY_PRIOR_TRAINING') || [],
79+
7980
what_do_you_want_to_become: getSingleTextValue(
8081
'WHAT_DO_YOU_WANT_TO_BECOME'
8182
),

0 commit comments

Comments
 (0)