Skip to content

Commit 3c35a51

Browse files
authored
Merge pull request #120 from ajinkyapandetekdi/all-2.0-offline
IssueId #223082 Create Log Out Button in Test-Rig [React]
2 parents ff24031 + f127938 commit 3c35a51

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

src/assets/images/logout.svg

Lines changed: 4 additions & 0 deletions
Loading

src/components/Assesment/Assesment.jsx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import {
44
Box,
55
Grid,
66
IconButton,
7+
Tooltip,
78
Typography,
89
} from "../../../node_modules/@mui/material/index";
10+
import LogoutImg from "../../assets/images/logout.svg";
11+
import { styled } from "@mui/material/styles";
912
import {
1013
RoundTick,
1114
SelectLanguageButton,
@@ -41,6 +44,7 @@ import panda from "../../assets/images/panda.svg";
4144
import cryPanda from "../../assets/images/cryPanda.svg";
4245
import { uniqueId } from "../../services/utilService";
4346
import CircularProgressOverlay from "../CommonComponent/CircularProgressOverlay";
47+
import { end } from "../../services/telementryService";
4448

4549
export const LanguageModal = ({
4650
lang,
@@ -513,6 +517,38 @@ export const ProfileHeader = ({
513517

514518
const displayLanguage = selectedLanguage?.name || "Select Language";
515519

520+
const handleLogout = () => {
521+
localStorage.clear();
522+
end({});
523+
navigate("/Login");
524+
};
525+
526+
const CustomIconButton = styled(IconButton)({
527+
padding: "6px 20px",
528+
color: "white",
529+
fontSize: "20px",
530+
fontWeight: 500,
531+
borderRadius: "8px",
532+
marginRight: "10px",
533+
fontFamily: '"Lato", "sans-serif"',
534+
position: "relative",
535+
display: "flex",
536+
alignItems: "center",
537+
justifyContent: "center",
538+
"& .logout-img": {
539+
display: "block",
540+
filter: "invert(1)",
541+
},
542+
});
543+
544+
const CustomTooltip = styled(({ className, ...props }) => (
545+
<Tooltip {...props} classes={{ popper: className }} />
546+
))({
547+
[`& .MuiTooltip-tooltip`]: {
548+
fontSize: "1.2rem", // Adjust the font size as needed
549+
},
550+
});
551+
516552
return (
517553
<>
518554
{!!openMessageDialog && (
@@ -645,6 +681,20 @@ export const ProfileHeader = ({
645681
</Box>
646682
</Box>
647683
</Box>
684+
{process.env.REACT_APP_IS_IN_APP_AUTHORISATION === "true" && (
685+
<CustomTooltip title="Logout">
686+
<Box>
687+
<CustomIconButton onClick={handleLogout}>
688+
<img
689+
className="logout-img"
690+
style={{ height: 30, width: 35 }}
691+
src={LogoutImg}
692+
alt="Logout"
693+
/>
694+
</CustomIconButton>
695+
</Box>
696+
</CustomTooltip>
697+
)}
648698
</Box>
649699
</Box>
650700
</>

src/services/telementryService.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const start = (duration) => {
7272
mode: 'play',
7373
stageid: url,
7474
duration: Number((duration / 1e3).toFixed(2)),
75+
dspec: window.navigator.userAgent
7576
},
7677
});
7778
} catch (error) {

0 commit comments

Comments
 (0)