add back sign out link on mobile

This commit is contained in:
Sean Yesmunt 2020-08-20 11:10:29 -04:00
parent 4ebb463508
commit 17feef93df

View file

@ -9,13 +9,44 @@ import NotificationBubble from 'component/notificationBubble';
const ESCAPE_KEY_CODE = 27; const ESCAPE_KEY_CODE = 27;
const BACKSLASH_KEY_CODE = 220; const BACKSLASH_KEY_CODE = 220;
const TOP_LEVEL_LINKS: Array<{
type Props = {
subscriptions: Array<Subscription>,
email: ?string,
uploadCount: number,
doSignOut: () => void,
sidebarOpen: boolean,
setSidebarOpen: boolean => void,
isMediumScreen: boolean,
isOnFilePage: boolean,
unreadCount: number,
purchaseSuccess: boolean,
doClearPurchasedUriSuccess: () => void,
user: ?User,
};
function SideNavigation(props: Props) {
const {
subscriptions,
doSignOut,
email,
purchaseSuccess,
doClearPurchasedUriSuccess,
sidebarOpen,
setSidebarOpen,
isMediumScreen,
isOnFilePage,
unreadCount,
user,
} = props;
const TOP_LEVEL_LINKS: Array<{
label: string, label: string,
navigate: string, navigate: string,
icon: string, icon: string,
extra?: Node, extra?: Node,
hideForUnauth?: boolean, hideForUnauth?: boolean,
}> = [ }> = [
{ {
label: 'Home', label: 'Home',
navigate: `/`, navigate: `/`,
@ -43,15 +74,16 @@ const TOP_LEVEL_LINKS: Array<{
icon: ICONS.PURCHASED, icon: ICONS.PURCHASED,
hideForUnauth: true, hideForUnauth: true,
}, },
]; ];
const ABSOLUTE_LINKS: Array<{ const ABSOLUTE_LINKS: Array<{
label: string, label: string,
navigate: string, navigate?: string,
onClick?: () => any,
icon: string, icon: string,
extra?: Node, extra?: Node,
hideForUnauth?: boolean, hideForUnauth?: boolean,
}> = [ }> = [
{ {
label: 'Upload', label: 'Upload',
navigate: `/$/${PAGES.UPLOAD}`, navigate: `/$/${PAGES.UPLOAD}`,
@ -119,15 +151,20 @@ const ABSOLUTE_LINKS: Array<{
icon: ICONS.HELP, icon: ICONS.HELP,
hideForUnauth: true, hideForUnauth: true,
}, },
]; {
label: 'Sign Out',
onClick: doSignOut,
icon: ICONS.SIGN_OUT,
hideForUnauth: true,
},
];
const UNAUTH_LINKS: Array<{ const UNAUTH_LINKS: Array<{
label: string, label: string,
navigate: string, navigate: string,
icon: string, icon: string,
extra?: Node, extra?: Node,
hideForUnauth?: boolean, }> = [
}> = [
{ {
label: 'Sign In', label: 'Sign In',
navigate: `/$/${PAGES.AUTH_SIGNIN}`, navigate: `/$/${PAGES.AUTH_SIGNIN}`,
@ -148,37 +185,8 @@ const UNAUTH_LINKS: Array<{
navigate: `/$/${PAGES.HELP}`, navigate: `/$/${PAGES.HELP}`,
icon: ICONS.HELP, icon: ICONS.HELP,
}, },
]; ];
type Props = {
subscriptions: Array<Subscription>,
email: ?string,
uploadCount: number,
doSignOut: () => void,
sidebarOpen: boolean,
setSidebarOpen: boolean => void,
isMediumScreen: boolean,
isOnFilePage: boolean,
unreadCount: number,
purchaseSuccess: boolean,
doClearPurchasedUriSuccess: () => void,
user: ?User,
};
function SideNavigation(props: Props) {
const {
subscriptions,
// doSignOut,
email,
purchaseSuccess,
doClearPurchasedUriSuccess,
sidebarOpen,
setSidebarOpen,
isMediumScreen,
isOnFilePage,
unreadCount,
user,
} = props;
const notificationsEnabled = user && user.experimental_ui; const notificationsEnabled = user && user.experimental_ui;
const isAuthenticated = Boolean(email); const isAuthenticated = Boolean(email);
const [pulseLibrary, setPulseLibrary] = React.useState(false); const [pulseLibrary, setPulseLibrary] = React.useState(false);