Skip to content

Commit 58dbb01

Browse files
authored
Merge pull request #2533 from tekdi/release-1.13.0-prod-register
Release 1.13.0 prod register to learner qa
2 parents cc20046 + 6dd08ca commit 58dbb01

File tree

4 files changed

+61
-18
lines changed

4 files changed

+61
-18
lines changed

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ const CourseCertificateCard: React.FC<CertificateCardProps> = ({
3636
}) => {
3737
const [courseDetails, setCourseDetails] = useState<CourseDetails | null>(null);
3838
const [isLoading, setIsLoading] = useState(true);
39+
const [isCertificateRestricted, setIsCertificateRestricted] = useState(false);
40+
41+
// Check certificate restriction from uiconfig in localStorage
42+
useEffect(() => {
43+
if (typeof window !== 'undefined') {
44+
try {
45+
const uiconfig = localStorage.getItem('uiConfig');
46+
if (uiconfig) {
47+
const parsedConfig = JSON.parse(uiconfig);
48+
setIsCertificateRestricted(parsedConfig.certificateRestriction === true);
49+
}
50+
} catch (error) {
51+
console.error('Error parsing uiconfig:', error);
52+
}
53+
}
54+
}, []);
3955

4056
useEffect(() => {
4157
const fetchCourseDetails = async () => {
@@ -81,6 +97,11 @@ const CourseCertificateCard: React.FC<CertificateCardProps> = ({
8197
return <CardShimmer />;
8298
}
8399

100+
// Don't render if certificate is restricted
101+
// if (isCertificateRestricted) {
102+
// return null;
103+
// }
104+
84105
return (
85106
<Card
86107
sx={{
@@ -195,7 +216,7 @@ const CourseCertificateCard: React.FC<CertificateCardProps> = ({
195216
</Typography>
196217
</Box>
197218

198-
<Button
219+
{!isCertificateRestricted && (<Button
199220
variant="text"
200221
onClick={onPreviewCertificate}
201222
sx={{
@@ -220,7 +241,7 @@ const CourseCertificateCard: React.FC<CertificateCardProps> = ({
220241
endIcon={<ArrowForwardIcon sx={{ fontSize: '18px' }} />}
221242
>
222243
Preview Certificate
223-
</Button>
244+
</Button>)}
224245
</CardContent>
225246
</Card>
226247
);

apps/learner-web-app/src/components/pos/Home.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ContentSearch, getfilterList } from '@learner/utils/API/contentService'
1919
import { staticFilterContent } from '@shared-lib-v2/utils/AuthService';
2020
import { Swiper, SwiperSlide } from 'swiper/react';
2121
import { Navigation, Pagination, Autoplay } from 'swiper/modules';
22+
import type { Swiper as SwiperType } from 'swiper';
2223
import 'swiper/css';
2324
import 'swiper/css/navigation';
2425
import 'swiper/css/pagination';
@@ -222,6 +223,20 @@ const rangeLength = contentLanguageField?.range?.length || 0;
222223
const mediaMD = useMediaQuery('(max-width: 900px)');
223224
const prevRef = useRef<HTMLButtonElement>(null);
224225
const nextRef = useRef<HTMLButtonElement>(null);
226+
const [swiperInstance, setSwiperInstance] = useState<SwiperType | null>(null);
227+
228+
// Update navigation when refs are ready
229+
useEffect(() => {
230+
if (swiperInstance && prevRef.current && nextRef.current) {
231+
const navigation = swiperInstance.params.navigation;
232+
if (navigation && typeof navigation !== 'boolean') {
233+
navigation.prevEl = prevRef.current;
234+
navigation.nextEl = nextRef.current;
235+
swiperInstance.navigation.init();
236+
swiperInstance.navigation.update();
237+
}
238+
}
239+
}, [swiperInstance]);
225240

226241
return (
227242
<Layout onlyHideElements={['footer']} _topAppBar={{ _config: {} }}>
@@ -263,18 +278,8 @@ const rangeLength = contentLanguageField?.range?.length || 0;
263278
pagination={{
264279
clickable: true,
265280
}}
266-
navigation={{
267-
prevEl: prevRef.current,
268-
nextEl: nextRef.current,
269-
}}
270-
onBeforeInit={(swiper) => {
271-
if (typeof swiper.params.navigation !== 'boolean') {
272-
if (swiper.params.navigation) {
273-
swiper.params.navigation.prevEl = prevRef.current;
274-
swiper.params.navigation.nextEl = nextRef.current;
275-
}
276-
}
277-
}}
281+
navigation={true}
282+
onSwiper={setSwiperInstance}
278283
style={{ width: '100%', height: '100%' }}
279284
>
280285
<SwiperSlide style={{ position: 'relative', width: '100%', height: '500px' }}>

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,30 @@ export default function Details(props: DetailsProps) {
6464
const [effectiveUnitId, setEffectiveUnitId] = useState<string | undefined>(
6565
Array.isArray(unitId) ? unitId[0] : unitId
6666
);
67+
const [isCertificateRestricted, setIsCertificateRestricted] = useState(false);
68+
6769
let activeLink = null;
6870
if (typeof window !== 'undefined') {
6971
const searchParams = new URLSearchParams(window.location.search);
7072
activeLink = searchParams.get('activeLink');
7173
}
7274

75+
// Check certificate restriction from uiconfig in localStorage
76+
useEffect(() => {
77+
if (typeof window !== 'undefined') {
78+
try {
79+
const uiconfig = localStorage.getItem('uiConfig');
80+
if (uiconfig) {
81+
const parsedConfig = JSON.parse(uiconfig);
82+
console.log('parsedConfig=====>', parsedConfig);
83+
setIsCertificateRestricted(parsedConfig.certificateRestriction === true);
84+
}
85+
} catch (error) {
86+
console.error('Error parsing uiconfig:', error);
87+
}
88+
}
89+
}, []);
90+
7391
useEffect(() => {
7492
const getDetails = async (identifier: string) => {
7593
try {
@@ -253,7 +271,6 @@ export default function Details(props: DetailsProps) {
253271
setCertificateId(
254272
resultCertificate?.result?.credentialSchemaId
255273
);
256-
} else {
257274
}
258275
}
259276
}
@@ -424,12 +441,12 @@ export default function Details(props: DetailsProps) {
424441
...props?._box,
425442
}}
426443
>
427-
{certificateId && !effectiveUnitId && (
444+
{!isCertificateRestricted && certificateId && !effectiveUnitId && (
428445
<CourseCompletionBanner certificateId={certificateId} />
429446
)}
430447

431448
{/* Show completion banner for completed courses */}
432-
{!unitId && courseItem?.children?.length === 1 && courseItem?.issuedOn && (
449+
{!isCertificateRestricted && !unitId && courseItem?.children?.length === 1 && courseItem?.issuedOn && (
433450
<CourseCompletionBanner certificateId={certificateId || ''} />
434451
)}
435452
{props?.type === 'collapse' ? (

mfes/scp-teacher-repo/src/pages/board-enrollment/student-detail/[userId].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ const BoardEnrollmentDetail = () => {
553553
{t('BOARD_ENROLMENT.CHOOSE_BOARD')}
554554
</Box>
555555
<Box sx={{ maxHeight: '550px', overflowY: 'auto' }}>
556-
{boardOptions?.map((boardItem) => (
556+
{boardOptions?.filter((boardItem) => boardItem.status !== "Retired").map((boardItem) => (
557557
<Box sx={{ mt: 2 }} key={boardItem.code}>
558558
<Box
559559
sx={{

0 commit comments

Comments
 (0)