Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions client/src/shared/components/organisms/sidebar/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
ROUTES_PAGE_V1,
ROUTES_V1,
} from '../../../../../app/routes/constants/routes';
import { useAuth } from '../../../../hooks/use-auth';


const logoutStyle = {
marginTop: 'auto',
Expand All @@ -18,6 +20,8 @@ const logoutStyle = {

const useSidebar = () => {
const [showExpandedView, setShowExpandedView] = useState(false);
const { logout } = useAuth();


const handleMouseHoverIn = useCallback(() => {
setShowExpandedView(true);
Expand All @@ -27,6 +31,7 @@ const useSidebar = () => {
setShowExpandedView(false);
}, []);


const sidebarItems = useMemo(() => {
const items: SideBarItemsType[] = [
{
Expand Down Expand Up @@ -63,10 +68,11 @@ const useSidebar = () => {
screenName: ROUTES_PAGE_V1.SETTINGS,
},
];

const secondaryItems: SideBarItemsType[] = [
{
icon: PowerSettingsNewIcon,
// onClick: onLogout,
onClick: logout,
title: 'Logout',
style: logoutStyle,
},
Expand All @@ -75,7 +81,8 @@ const useSidebar = () => {
items: items.filter(({ disable }) => !disable),
secondaryItems: secondaryItems.filter(({ disable }) => !disable),
};
}, []);
}, [logout]);


return {
showExpandedView,
Expand All @@ -84,5 +91,4 @@ const useSidebar = () => {
sidebarItems,
};
};

export default useSidebar;
Loading