Skip to content

Commit 5392e80

Browse files
authored
Merge pull request #615 from tekdi/main-learner
Main learner qa
2 parents dc77a1c + 423f18b commit 5392e80

File tree

22 files changed

+1109
-21
lines changed

22 files changed

+1109
-21
lines changed
823 Bytes
Loading

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@ import { getTenantInfo } from '@learner/utils/API/ProgramService';
1010
import ContentComponent from '@learner/components/Content/Content';
1111
import { useTranslation } from '@shared-lib';
1212
import { checkAuth } from '@shared-lib-v2/utils/AuthService';
13+
import { CompleteProfileBanner } from '@learner/components/CompleteProfileBanner/CompleteProfileBanner';
14+
import { profileComplitionCheck } from '@learner/utils/API/userService';
1315

1416
const MyComponent: React.FC = () => {
1517
const { t } = useTranslation();
1618
const [filter, setFilter] = useState({});
1719
const [isLogin, setIsLogin] = useState<boolean | null>(null);
20+
const [isProfileCard, setIsProfileCard] = useState(false);
1821

22+
useEffect(() => {
23+
const fetchProfileInfo = async () => {
24+
const result = await profileComplitionCheck();
25+
setIsProfileCard(!result);
26+
};
27+
fetchProfileInfo();
28+
}, []);
1929
useEffect(() => {
2030
const fetchTenantInfo = async () => {
2131
if (checkAuth()) {
@@ -39,6 +49,8 @@ const MyComponent: React.FC = () => {
3949

4050
return (
4151
<Layout isLoadingChildren={isLogin === null}>
52+
{isProfileCard && <CompleteProfileBanner />}
53+
4254
{isLogin && (
4355
<>
4456
<Grid container style={gredientStyle}>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const LoginPage = () => {
5353

5454
const handleForgotPassword = () => {
5555
localStorage.setItem('loginRoute', '/login');
56-
router.push('/forget-password');
56+
router.push('/password-forget');
5757
};
5858
const handleLogin = async (data: {
5959
username: string;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use client';
2+
3+
import React, { useEffect, useState } from 'react';
4+
//build issue fix for ⨯ useSearchParams() should be wrapped in a suspense boundary at page
5+
import { Suspense } from 'react';
6+
import EditProfile from '@learner/components/EditProfile/EditProfile';
7+
import { useSearchParams } from 'next/navigation';
8+
9+
type UserAccount = {
10+
name: string;
11+
username: string;
12+
};
13+
const ProfileComplitionPage = () => {
14+
const searchParams = useSearchParams();
15+
const isComplition = searchParams.get('isComplition');
16+
return (
17+
<Suspense fallback={<div>Loading...</div>}>
18+
<EditProfile completeProfile={isComplition ? true : false} />
19+
</Suspense>
20+
);
21+
};
22+
23+
export default ProfileComplitionPage;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use client';
2+
3+
import React, { useEffect, useRef, useState } from 'react';
4+
import { Box } from '@mui/material';
5+
import Header from '@learner/components/Header/Header';
6+
import UserProfileCard from '@learner/components/UserProfileCard/UserProfileCard';
7+
import Layout from '../../components/Layout';
8+
const ProfilePage = () => {
9+
return (
10+
<Layout>
11+
{/* <Header /> */}
12+
<UserProfileCard />
13+
</Layout>
14+
);
15+
};
16+
17+
export default ProfilePage;

apps/learner-web-app/src/app/registration/RegisterUser.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const RegisterUser = () => {
4949
useState<boolean>(false);
5050

5151
const [otpmodal, setOtpModal] = useState(false);
52-
const [otp, setOtp] = useState<string[]>(['', '', '', '', '', '']);
52+
const [otp, setOtp] = useState<string[]>(['', '', '', '']);
5353
const [hash, setHash] = useState<string>('');
5454
const localFormData = JSON.parse(localStorage.getItem('formData') || '{}');
5555
const [formData, setFormData] = useState<any>(localFormData);
@@ -113,7 +113,9 @@ const RegisterUser = () => {
113113
delete responseForm?.schema?.properties.confirm_password;
114114
delete responseForm?.schema?.properties.username;
115115
delete responseForm?.schema?.properties.program;
116-
116+
delete responseForm?.schema?.properties.batch;
117+
delete responseForm?.schema?.properties.center;
118+
responseForm?.schema?.required.pop('batch');
117119
//unit name is missing from required so handled from frotnend
118120
let alterSchema = responseForm?.schema;
119121
let alterUISchema = responseForm?.uiSchema;
@@ -268,7 +270,7 @@ const RegisterUser = () => {
268270
};
269271
const handleOTPModal = () => {
270272
setOtpModal(false);
271-
setOtp(['', '', '', '', '', '']);
273+
setOtp(['', '', '', '']);
272274
};
273275
const onCreateAnotherAccount = async () => {
274276
setAccountExistModal(false);
@@ -301,7 +303,7 @@ const RegisterUser = () => {
301303
} catch (error) {
302304
showToastMessage('Please enter valid otp', 'error');
303305
} finally {
304-
setOtp(['', '', '', '', '', '']);
306+
setOtp(['', '', '', '']);
305307
}
306308
};
307309
const onResend = async () => {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Box, Button, Typography, Paper } from '@mui/material';
2+
import { useRouter } from 'next/navigation';
3+
4+
export const CompleteProfileBanner = () => {
5+
const router = useRouter();
6+
const handleCompleteProfileClick = () => {
7+
router.push('/profile-complition?isComplition=true');
8+
};
9+
return (
10+
<Paper
11+
elevation={2}
12+
sx={{
13+
backgroundColor: '#FFE08A', // light yellow
14+
padding: 2,
15+
display: 'flex',
16+
alignItems: 'center',
17+
justifyContent: 'space-between',
18+
borderRadius: 2,
19+
}}
20+
>
21+
<Typography variant="body1" sx={{ fontWeight: 500 }}>
22+
Complete your profile so we can guide you better on your learning
23+
journey
24+
</Typography>
25+
<Button
26+
onClick={handleCompleteProfileClick}
27+
variant="contained"
28+
sx={{
29+
backgroundColor: '#FFC400', // yellow button
30+
color: '#000',
31+
fontWeight: 600,
32+
paddingX: 3,
33+
paddingY: 1,
34+
borderRadius: 5,
35+
boxShadow: '0px 3px 5px rgba(0, 0, 0, 0.2)',
36+
'&:hover': {
37+
backgroundColor: '#FFB300', // darker on hover
38+
},
39+
}}
40+
>
41+
Complete Profile
42+
</Button>
43+
</Paper>
44+
);
45+
};

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ const LTwoCourse: React.FC<LTwoCourseProps> = ({ onSubmit }) => {
4040
setSelectedTopic(event.target.value);
4141
};
4242

43+
const handleClose = () => {
44+
setIsModalOpen(false);
45+
setCount(0);
46+
};
47+
4348
return (
4449
<>
4550
<Typography variant="h1" gutterBottom sx={{ color: '#78590C' }}>
@@ -55,9 +60,15 @@ const LTwoCourse: React.FC<LTwoCourseProps> = ({ onSubmit }) => {
5560
display: 'flex',
5661
justifyContent: 'space-between',
5762
alignItems: 'center',
63+
'@media (max-width: 600px)': {
64+
flexDirection: 'column',
65+
alignItems: 'center',
66+
},
5867
}}
5968
>
60-
<Box sx={{ width: '38%' }}>
69+
<Box
70+
sx={{ width: '38%', '@media (max-width: 600px)': { width: '100%' } }}
71+
>
6172
<Typography variant="h1" sx={{ color: '#1F1B13' }} gutterBottom>
6273
{t('LEARNER_APP.L_TWO_COURSE.DESCRIPTION')}
6374
</Typography>
@@ -79,7 +90,7 @@ const LTwoCourse: React.FC<LTwoCourseProps> = ({ onSubmit }) => {
7990
<CommonModal
8091
handleSubmit={handleSubmit}
8192
isOpen={isModalOpen}
82-
onClose={() => setIsModalOpen(false)}
93+
onClose={handleClose}
8394
submitText={t('LEARNER_APP.L_TWO_COURSE.SUBMIT_BUTTON')}
8495
>
8596
<LevelUp
@@ -91,7 +102,7 @@ const LTwoCourse: React.FC<LTwoCourseProps> = ({ onSubmit }) => {
91102
<CommonModal
92103
handleSubmit={handleCloseResponse}
93104
isOpen={isModalOpen}
94-
onClose={() => setIsModalOpen(false)}
105+
onClose={handleClose}
95106
submitText={t('LEARNER_APP.L_TWO_COURSE.OKAY_BUTTON')}
96107
>
97108
<ResponseRecorded />

0 commit comments

Comments
 (0)