@@ -4,8 +4,11 @@ import {
4
4
Box ,
5
5
Grid ,
6
6
IconButton ,
7
+ Tooltip ,
7
8
Typography ,
8
9
} from "../../../node_modules/@mui/material/index" ;
10
+ import LogoutImg from "../../assets/images/logout.svg" ;
11
+ import { styled } from "@mui/material/styles" ;
9
12
import {
10
13
RoundTick ,
11
14
SelectLanguageButton ,
@@ -16,9 +19,7 @@ import {
16
19
setLocalData ,
17
20
} from "../../utils/constants" ;
18
21
import practicebg from "../../assets/images/practice-bg.svg" ;
19
- import {
20
- useNavigate ,
21
- } from "../../../node_modules/react-router-dom/dist/index" ;
22
+ import { useNavigate } from "../../../node_modules/react-router-dom/dist/index" ;
22
23
import { useEffect , useState } from "react" ;
23
24
import axios from "../../../node_modules/axios/index" ;
24
25
// import { useDispatch } from 'react-redux';
@@ -42,6 +43,7 @@ import config from "../../utils/urlConstants.json";
42
43
import panda from "../../assets/images/panda.svg" ;
43
44
import cryPanda from "../../assets/images/cryPanda.svg" ;
44
45
import { uniqueId } from "../../services/utilService" ;
46
+ import { end } from "../../services/telementryService" ;
45
47
46
48
export const LanguageModal = ( { lang, setLang, setOpenLangModal } ) => {
47
49
const [ selectedLang , setSelectedLang ] = useState ( lang ) ;
@@ -169,7 +171,8 @@ export const LanguageModal = ({ lang, setLang, setOpenLangModal }) => {
169
171
</ Box >
170
172
< Box
171
173
sx = { { width : "100%" , display : "flex" , justifyContent : "center" } }
172
- mt = { 5 } mb = { 1 }
174
+ mt = { 5 }
175
+ mb = { 1 }
173
176
// mr="110px"
174
177
>
175
178
< Box
@@ -340,17 +343,49 @@ export const ProfileHeader = ({
340
343
341
344
const handleProfileBack = ( ) => {
342
345
try {
343
- if ( process . env . REACT_APP_IS_APP_IFRAME === ' true' ) {
344
- window . parent . postMessage ( { type : ' restore-iframe-content' } , '*' ) ;
345
- navigate ( "/" )
346
+ if ( process . env . REACT_APP_IS_APP_IFRAME === " true" ) {
347
+ window . parent . postMessage ( { type : " restore-iframe-content" } , "*" ) ;
348
+ navigate ( "/" ) ;
346
349
} else {
347
- navigate ( "/discover-start" )
350
+ navigate ( "/discover-start" ) ;
348
351
}
349
352
} catch ( error ) {
350
353
console . error ( "Error posting message:" , error ) ;
351
354
}
352
355
} ;
353
356
357
+ const handleLogout = ( ) => {
358
+ localStorage . clear ( ) ;
359
+ end ( { } ) ;
360
+ navigate ( "/Login" ) ;
361
+ } ;
362
+
363
+ const CustomIconButton = styled ( IconButton ) ( {
364
+ padding : "6px 20px" ,
365
+ color : "white" ,
366
+ fontSize : "20px" ,
367
+ fontWeight : 500 ,
368
+ borderRadius : "8px" ,
369
+ marginRight : "10px" ,
370
+ fontFamily : '"Lato", "sans-serif"' ,
371
+ position : "relative" ,
372
+ display : "flex" ,
373
+ alignItems : "center" ,
374
+ justifyContent : "center" ,
375
+ "& .logout-img" : {
376
+ display : "block" ,
377
+ filter : "invert(1)" ,
378
+ } ,
379
+ } ) ;
380
+
381
+ const CustomTooltip = styled ( ( { className, ...props } ) => (
382
+ < Tooltip { ...props } classes = { { popper : className } } />
383
+ ) ) ( {
384
+ [ `& .MuiTooltip-tooltip` ] : {
385
+ fontSize : "1.2rem" , // Adjust the font size as needed
386
+ } ,
387
+ } ) ;
388
+
354
389
return (
355
390
< >
356
391
{ ! ! openMessageDialog && (
@@ -377,7 +412,13 @@ export const ProfileHeader = ({
377
412
zIndex : 5555 ,
378
413
} }
379
414
>
380
- < Box sx = { { display : "flex" , alignItems : "center" , width : { xs : "100%" , sm : "50%" } } } >
415
+ < Box
416
+ sx = { {
417
+ display : "flex" ,
418
+ alignItems : "center" ,
419
+ width : { xs : "100%" , sm : "50%" } ,
420
+ } }
421
+ >
381
422
{ handleBack && (
382
423
< Box ml = { { xs : "10px" , sm : "94px" } } >
383
424
< IconButton onClick = { handleBack } >
@@ -388,11 +429,19 @@ export const ProfileHeader = ({
388
429
{ username && (
389
430
< >
390
431
< Box
391
- ml = { handleBack ? { xs : "10px" , sm : "12px" } : { xs : "10px" , sm : "94px" } }
432
+ ml = {
433
+ handleBack
434
+ ? { xs : "10px" , sm : "12px" }
435
+ : { xs : "10px" , sm : "94px" }
436
+ }
392
437
sx = { { cursor : "pointer" } }
393
438
onClick = { handleProfileBack }
394
439
>
395
- < img src = { profilePic } alt = "profile-pic" style = { { height : "30px" } } />
440
+ < img
441
+ src = { profilePic }
442
+ alt = "profile-pic"
443
+ style = { { height : "30px" } }
444
+ />
396
445
</ Box >
397
446
< Box ml = "12px" >
398
447
< span
@@ -404,13 +453,13 @@ export const ProfileHeader = ({
404
453
lineHeight : "25px" ,
405
454
} }
406
455
>
407
- { username || "" }
456
+ { username || "" }
408
457
</ span >
409
458
</ Box >
410
459
</ >
411
460
) }
412
461
</ Box >
413
-
462
+
414
463
< Box
415
464
sx = { {
416
465
justifySelf : "flex-end" ,
@@ -440,7 +489,7 @@ export const ProfileHeader = ({
440
489
</span>
441
490
</Box>
442
491
</Box> */ }
443
-
492
+
444
493
< Box
445
494
mr = { { xs : "10px" , sm : "90px" } }
446
495
onClick = { ( ) =>
@@ -470,6 +519,20 @@ export const ProfileHeader = ({
470
519
</ Box >
471
520
</ Box >
472
521
</ Box >
522
+ { process . env . REACT_APP_IS_IN_APP_AUTHORISATION === "true" && (
523
+ < CustomTooltip title = "Logout" >
524
+ < Box >
525
+ < CustomIconButton onClick = { handleLogout } >
526
+ < img
527
+ className = "logout-img"
528
+ style = { { height : 30 , width : 35 } }
529
+ src = { LogoutImg }
530
+ alt = "Logout"
531
+ />
532
+ </ CustomIconButton >
533
+ </ Box >
534
+ </ CustomTooltip >
535
+ ) }
473
536
</ Box >
474
537
</ Box >
475
538
</ >
@@ -491,7 +554,7 @@ const Assesment = ({ discoverStart }) => {
491
554
const [ level , setLevel ] = useState ( "" ) ;
492
555
const dispatch = useDispatch ( ) ;
493
556
const [ openLangModal , setOpenLangModal ] = useState ( false ) ;
494
- const [ lang , setLang ] = useState ( getLocalData ( "lang" ) || "en" ) ;
557
+ const [ lang , setLang ] = useState ( getLocalData ( "lang" ) || "en" ) ;
495
558
const [ points , setPoints ] = useState ( 0 ) ;
496
559
497
560
useEffect ( ( ) => {
@@ -524,11 +587,11 @@ const Assesment = ({ discoverStart }) => {
524
587
) ;
525
588
let session_id = localStorage . getItem ( "sessionId" ) ;
526
589
527
- if ( ! session_id ) {
590
+ if ( ! session_id ) {
528
591
session_id = uniqueId ( ) ;
529
- localStorage . setItem ( "sessionId" , session_id )
592
+ localStorage . setItem ( "sessionId" , session_id ) ;
530
593
}
531
-
594
+
532
595
localStorage . setItem ( "lang" , lang || "ta" ) ;
533
596
const getPointersDetails = await axios . get (
534
597
`${ process . env . REACT_APP_LEARNER_AI_ORCHESTRATION_HOST } /${ config . URLS . GET_POINTER } /${ usernameDetails ?. data ?. result ?. virtualID } /${ session_id } ?language=${ lang } `
@@ -555,9 +618,9 @@ const Assesment = ({ discoverStart }) => {
555
618
) ;
556
619
let sessionId = getLocalData ( "sessionId" ) ;
557
620
558
- if ( ! sessionId || sessionId === ' null' ) {
621
+ if ( ! sessionId || sessionId === " null" ) {
559
622
sessionId = uniqueId ( ) ;
560
- localStorage . setItem ( "sessionId" , sessionId )
623
+ localStorage . setItem ( "sessionId" , sessionId ) ;
561
624
}
562
625
563
626
if ( virtualId ) {
@@ -607,7 +670,7 @@ const Assesment = ({ discoverStart }) => {
607
670
height : "100vh" ,
608
671
backgroundImage : `url(${ images ?. [ `desktopLevel${ level || 1 } ` ] } )` ,
609
672
backgroundRepeat : "round" ,
610
- backgroundSize : ' auto' ,
673
+ backgroundSize : " auto" ,
611
674
position : "relative" ,
612
675
} ;
613
676
@@ -675,68 +738,68 @@ const Assesment = ({ discoverStart }) => {
675
738
</ Box >
676
739
) : (
677
740
< MainLayout
678
- showNext = { false }
679
- showTimer = { false }
680
- cardBackground = { assessmentBackground }
681
- backgroundImage = { practicebg }
682
- { ...{
683
- setOpenLangModal,
684
- lang,
685
- points,
686
- } }
687
- >
688
- < Box
689
- sx = { {
690
- position : "absolute" ,
691
- right : { xs : 20 , md : 200 } ,
692
- display : "flex" ,
693
- flexDirection : "column" ,
694
- justifyContent : "center" ,
695
- alignItems : "center" ,
696
- mt : { xs : 2 , md : 5 } ,
741
+ showNext = { false }
742
+ showTimer = { false }
743
+ cardBackground = { assessmentBackground }
744
+ backgroundImage = { practicebg }
745
+ { ...{
746
+ setOpenLangModal,
747
+ lang,
748
+ points,
697
749
} }
698
750
>
699
- < Typography
751
+ < Box
700
752
sx = { {
701
- color : "#322020" ,
702
- fontWeight : 700 ,
703
- fontSize : { xs : "24px" , md : "40px" } ,
704
- fontFamily : "Quicksand" ,
705
- lineHeight : { xs : "36px" , md : "62px" } ,
706
- textAlign : "center" ,
753
+ position : "absolute" ,
754
+ right : { xs : 20 , md : 200 } ,
755
+ display : "flex" ,
756
+ flexDirection : "column" ,
757
+ justifyContent : "center" ,
758
+ alignItems : "center" ,
759
+ mt : { xs : 2 , md : 5 } ,
707
760
} }
708
761
>
709
- { discoverStart
710
- ? "Let's test your language skills"
711
- : "You have good language skills" }
712
- </ Typography >
713
- < Box >
714
762
< Typography
715
763
sx = { {
716
- color : "#1CB0F6 " ,
717
- fontWeight : 600 ,
718
- fontSize : { xs : "20px " , md : "30px " } ,
764
+ color : "#322020 " ,
765
+ fontWeight : 700 ,
766
+ fontSize : { xs : "24px " , md : "40px " } ,
719
767
fontFamily : "Quicksand" ,
720
- lineHeight : { xs : "30px " , md : "50px " } ,
768
+ lineHeight : { xs : "36px " , md : "62px " } ,
721
769
textAlign : "center" ,
722
770
} }
723
771
>
724
- { level > 0
725
- ? `Take the assessment to complete Level ${ level } .`
726
- : "Take the assessment to discover your level " }
772
+ { discoverStart
773
+ ? "Let's test your language skills"
774
+ : "You have good language skills " }
727
775
</ Typography >
776
+ < Box >
777
+ < Typography
778
+ sx = { {
779
+ color : "#1CB0F6" ,
780
+ fontWeight : 600 ,
781
+ fontSize : { xs : "20px" , md : "30px" } ,
782
+ fontFamily : "Quicksand" ,
783
+ lineHeight : { xs : "30px" , md : "50px" } ,
784
+ textAlign : "center" ,
785
+ } }
786
+ >
787
+ { level > 0
788
+ ? `Take the assessment to complete Level ${ level } .`
789
+ : "Take the assessment to discover your level" }
790
+ </ Typography >
791
+ </ Box >
792
+ < Box
793
+ sx = { {
794
+ cursor : "pointer" ,
795
+ mt : { xs : 1 , md : 2 } ,
796
+ } }
797
+ onClick = { handleRedirect }
798
+ >
799
+ < StartAssessmentButton />
800
+ </ Box >
728
801
</ Box >
729
- < Box
730
- sx = { {
731
- cursor : "pointer" ,
732
- mt : { xs : 1 , md : 2 } ,
733
- } }
734
- onClick = { handleRedirect }
735
- >
736
- < StartAssessmentButton />
737
- </ Box >
738
- </ Box >
739
- </ MainLayout >
802
+ </ MainLayout >
740
803
) }
741
804
</ >
742
805
) ;
0 commit comments