auth footer
This commit is contained in:
1 parent
a390ee5f21
commit
4c5c2d2d5e
4 files changed
+20
-13
No files matched your search
@@ -4,6 +4,7 @@ interface IconProps {
|
|||||||
icon: LucideIcon;
|
icon: LucideIcon;
|
||||||
size?: number;
|
size?: number;
|
||||||
strokeWidth?: number;
|
strokeWidth?: number;
|
||||||
|
stroke?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Icon = ({ icon: Icon, size = 20, strokeWidth = 1.5 }: IconProps) => {
|
const Icon = ({ icon: Icon, size = 20, strokeWidth = 1.5 }: IconProps) => {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import { useState } from "react";
|
|||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { clearAuthState } from "@/Features/Auth/authSlice.js";
|
import { clearAuthState } from "@/Features/Auth/authSlice.js";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import type { RootState } from "@/Types/state.js";
|
import type { RootState } from "@/Types/state.js";
|
||||||
|
|
||||||
const getFilteredAccountMenuItems = (user: any, items: any[]) => {
|
const getFilteredAccountMenuItems = (user: any, items: any[]) => {
|
||||||
@@ -45,7 +44,7 @@ const getRoleDisplayText = (user: any, t: Function) => {
|
|||||||
return user.role;
|
return user.role;
|
||||||
};
|
};
|
||||||
|
|
||||||
const AuthFooter = ({
|
export const AuthFooter = ({
|
||||||
collapsed,
|
collapsed,
|
||||||
accountMenuItems,
|
accountMenuItems,
|
||||||
}: {
|
}: {
|
||||||
@@ -86,6 +85,9 @@ const AuthFooter = ({
|
|||||||
gap: theme.spacing(2),
|
gap: theme.spacing(2),
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
pl: theme.spacing(4),
|
pl: theme.spacing(4),
|
||||||
|
"& svg": {
|
||||||
|
stroke: theme.palette.text.secondary,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.icon}
|
{item.icon}
|
||||||
@@ -140,6 +142,7 @@ const AuthFooter = ({
|
|||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
textOverflow: "ellipsis",
|
textOverflow: "ellipsis",
|
||||||
|
color: theme.palette.text.primary,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{authState.user?.firstName} {authState.user?.lastName}
|
{authState.user?.firstName} {authState.user?.lastName}
|
||||||
@@ -148,7 +151,10 @@ const AuthFooter = ({
|
|||||||
textOverflow="ellipsis"
|
textOverflow="ellipsis"
|
||||||
overflow="hidden"
|
overflow="hidden"
|
||||||
whiteSpace="nowrap"
|
whiteSpace="nowrap"
|
||||||
sx={{ textTransform: "capitalize", opacity: 0.8 }}
|
sx={{
|
||||||
|
textTransform: "capitalize",
|
||||||
|
color: theme.palette.text.secondary,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{getRoleDisplayText(authState.user, t)}
|
{getRoleDisplayText(authState.user, t)}
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -162,6 +168,9 @@ const AuthFooter = ({
|
|||||||
ml: "50px",
|
ml: "50px",
|
||||||
"&:focus": { outline: "none" },
|
"&:focus": { outline: "none" },
|
||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
|
"& svg": {
|
||||||
|
stroke: theme.palette.text.secondary,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
onClick={(event) => openPopup(event)}
|
onClick={(event) => openPopup(event)}
|
||||||
>
|
>
|
||||||
@@ -244,9 +253,12 @@ const AuthFooter = ({
|
|||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={logout}
|
onClick={logout}
|
||||||
sx={{
|
sx={{
|
||||||
gap: theme.spacing(4),
|
gap: theme.spacing(2),
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
pl: theme.spacing(4),
|
pl: theme.spacing(4),
|
||||||
|
"& svg": {
|
||||||
|
stroke: theme.palette.text.secondary,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
@@ -259,10 +271,3 @@ const AuthFooter = ({
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
AuthFooter.propTypes = {
|
|
||||||
collapsed: PropTypes.bool,
|
|
||||||
accountMenuItems: PropTypes.array,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AuthFooter;
|
|
||||||
@@ -7,7 +7,7 @@ import { Logo } from "@/Components/v2/sidebar/Logo";
|
|||||||
import { getMenu, getBottomMenu, getAccountMenu } from "@/Components/v2/sidebar/Menu";
|
import { getMenu, getBottomMenu, getAccountMenu } from "@/Components/v2/sidebar/Menu";
|
||||||
import { NavItem } from "@/Components/v2/sidebar/NavItem";
|
import { NavItem } from "@/Components/v2/sidebar/NavItem";
|
||||||
import { StarPrompt } from "@/Components/v2/sidebar/StarPrompt";
|
import { StarPrompt } from "@/Components/v2/sidebar/StarPrompt";
|
||||||
import AuthFooter from "@/Components/v2/sidebar/Authfooter";
|
import { AuthFooter } from "@/Components/v2/sidebar/Authfooter";
|
||||||
|
|
||||||
import { useNavigate, useLocation } from "react-router";
|
import { useNavigate, useLocation } from "react-router";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|||||||
@@ -359,7 +359,8 @@
|
|||||||
"starPrompt": {
|
"starPrompt": {
|
||||||
"title": "Star Checkmate",
|
"title": "Star Checkmate",
|
||||||
"description": "See the latest releases and help grow the community on GitHub"
|
"description": "See the latest releases and help grow the community on GitHub"
|
||||||
}
|
},
|
||||||
|
"authFooter": {}
|
||||||
},
|
},
|
||||||
"starPrompt": {
|
"starPrompt": {
|
||||||
"title": "Star Checkmate",
|
"title": "Star Checkmate",
|
||||||
|
|||||||
Reference in new issue
Block a user