From 17feef93dfd942047461ec1afcc05614578ded49 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 20 Aug 2020 11:10:29 -0400 Subject: [PATCH] add back sign out link on mobile --- ui/component/sideNavigation/view.jsx | 290 ++++++++++++++------------- 1 file changed, 149 insertions(+), 141 deletions(-) diff --git a/ui/component/sideNavigation/view.jsx b/ui/component/sideNavigation/view.jsx index a401e12ee..227857ad5 100644 --- a/ui/component/sideNavigation/view.jsx +++ b/ui/component/sideNavigation/view.jsx @@ -9,146 +9,6 @@ import NotificationBubble from 'component/notificationBubble'; const ESCAPE_KEY_CODE = 27; const BACKSLASH_KEY_CODE = 220; -const TOP_LEVEL_LINKS: Array<{ - label: string, - navigate: string, - icon: string, - extra?: Node, - hideForUnauth?: boolean, -}> = [ - { - label: 'Home', - navigate: `/`, - icon: ICONS.HOME, - }, - { - label: 'Following', - navigate: `/$/${PAGES.CHANNELS_FOLLOWING}`, - icon: ICONS.SUBSCRIBE, - }, - { - label: 'Your Tags', - navigate: `/$/${PAGES.TAGS_FOLLOWING}`, - icon: ICONS.TAG, - hideForUnauth: true, - }, - { - label: 'Discover', - navigate: `/$/${PAGES.DISCOVER}`, - icon: ICONS.DISCOVER, - }, - { - label: 'Purchased', - navigate: `/$/${PAGES.LIBRARY}`, - icon: ICONS.PURCHASED, - hideForUnauth: true, - }, -]; - -const ABSOLUTE_LINKS: Array<{ - label: string, - navigate: string, - icon: string, - extra?: Node, - hideForUnauth?: boolean, -}> = [ - { - label: 'Upload', - navigate: `/$/${PAGES.UPLOAD}`, - icon: ICONS.PUBLISH, - }, - { - label: 'New Channel', - navigate: `/$/${PAGES.CHANNEL_NEW}`, - icon: ICONS.CHANNEL, - hideForUnauth: true, - }, - { - label: 'Uploads', - navigate: `/$/${PAGES.UPLOADS}`, - icon: ICONS.PUBLISH, - hideForUnauth: true, - }, - - { - label: 'Channels', - navigate: `/$/${PAGES.CHANNELS}`, - icon: ICONS.CHANNEL, - hideForUnauth: true, - }, - { - label: 'Creator Analytics', - navigate: `/$/${PAGES.CREATOR_DASHBOARD}`, - icon: ICONS.ANALYTICS, - hideForUnauth: true, - }, - { - label: 'Wallet', - navigate: `/$/${PAGES.WALLET}`, - icon: ICONS.WALLET, - hideForUnauth: true, - }, - { - label: 'Notifications', - navigate: `/$/${PAGES.NOTIFICATIONS}`, - icon: ICONS.NOTIFICATION, - extra: , - hideForUnauth: true, - }, - { - label: 'Rewards', - navigate: `/$/${PAGES.REWARDS}`, - icon: ICONS.REWARDS, - hideForUnauth: true, - }, - { - label: 'Invites', - navigate: `/$/${PAGES.INVITE}`, - icon: ICONS.INVITE, - hideForUnauth: true, - }, - { - label: 'Settings', - navigate: `/$/${PAGES.SETTINGS}`, - icon: ICONS.SETTINGS, - hideForUnauth: true, - }, - { - label: 'Help', - navigate: `/$/${PAGES.HELP}`, - icon: ICONS.HELP, - hideForUnauth: true, - }, -]; - -const UNAUTH_LINKS: Array<{ - label: string, - navigate: string, - icon: string, - extra?: Node, - hideForUnauth?: boolean, -}> = [ - { - label: 'Sign In', - navigate: `/$/${PAGES.AUTH_SIGNIN}`, - icon: ICONS.SIGN_IN, - }, - { - label: 'Register', - navigate: `/$/${PAGES.AUTH}`, - icon: ICONS.SIGN_UP, - }, - { - label: 'Settings', - navigate: `/$/${PAGES.SETTINGS}`, - icon: ICONS.SETTINGS, - }, - { - label: 'Help', - navigate: `/$/${PAGES.HELP}`, - icon: ICONS.HELP, - }, -]; type Props = { subscriptions: Array, @@ -168,7 +28,7 @@ type Props = { function SideNavigation(props: Props) { const { subscriptions, - // doSignOut, + doSignOut, email, purchaseSuccess, doClearPurchasedUriSuccess, @@ -179,6 +39,154 @@ function SideNavigation(props: Props) { unreadCount, user, } = props; + + const TOP_LEVEL_LINKS: Array<{ + label: string, + navigate: string, + icon: string, + extra?: Node, + hideForUnauth?: boolean, + }> = [ + { + label: 'Home', + navigate: `/`, + icon: ICONS.HOME, + }, + { + label: 'Following', + navigate: `/$/${PAGES.CHANNELS_FOLLOWING}`, + icon: ICONS.SUBSCRIBE, + }, + { + label: 'Your Tags', + navigate: `/$/${PAGES.TAGS_FOLLOWING}`, + icon: ICONS.TAG, + hideForUnauth: true, + }, + { + label: 'Discover', + navigate: `/$/${PAGES.DISCOVER}`, + icon: ICONS.DISCOVER, + }, + { + label: 'Purchased', + navigate: `/$/${PAGES.LIBRARY}`, + icon: ICONS.PURCHASED, + hideForUnauth: true, + }, + ]; + + const ABSOLUTE_LINKS: Array<{ + label: string, + navigate?: string, + onClick?: () => any, + icon: string, + extra?: Node, + hideForUnauth?: boolean, + }> = [ + { + label: 'Upload', + navigate: `/$/${PAGES.UPLOAD}`, + icon: ICONS.PUBLISH, + }, + { + label: 'New Channel', + navigate: `/$/${PAGES.CHANNEL_NEW}`, + icon: ICONS.CHANNEL, + hideForUnauth: true, + }, + { + label: 'Uploads', + navigate: `/$/${PAGES.UPLOADS}`, + icon: ICONS.PUBLISH, + hideForUnauth: true, + }, + + { + label: 'Channels', + navigate: `/$/${PAGES.CHANNELS}`, + icon: ICONS.CHANNEL, + hideForUnauth: true, + }, + { + label: 'Creator Analytics', + navigate: `/$/${PAGES.CREATOR_DASHBOARD}`, + icon: ICONS.ANALYTICS, + hideForUnauth: true, + }, + { + label: 'Wallet', + navigate: `/$/${PAGES.WALLET}`, + icon: ICONS.WALLET, + hideForUnauth: true, + }, + { + label: 'Notifications', + navigate: `/$/${PAGES.NOTIFICATIONS}`, + icon: ICONS.NOTIFICATION, + extra: , + hideForUnauth: true, + }, + { + label: 'Rewards', + navigate: `/$/${PAGES.REWARDS}`, + icon: ICONS.REWARDS, + hideForUnauth: true, + }, + { + label: 'Invites', + navigate: `/$/${PAGES.INVITE}`, + icon: ICONS.INVITE, + hideForUnauth: true, + }, + { + label: 'Settings', + navigate: `/$/${PAGES.SETTINGS}`, + icon: ICONS.SETTINGS, + hideForUnauth: true, + }, + { + label: 'Help', + navigate: `/$/${PAGES.HELP}`, + icon: ICONS.HELP, + hideForUnauth: true, + }, + { + label: 'Sign Out', + onClick: doSignOut, + icon: ICONS.SIGN_OUT, + hideForUnauth: true, + }, + ]; + + const UNAUTH_LINKS: Array<{ + label: string, + navigate: string, + icon: string, + extra?: Node, + }> = [ + { + label: 'Sign In', + navigate: `/$/${PAGES.AUTH_SIGNIN}`, + icon: ICONS.SIGN_IN, + }, + { + label: 'Register', + navigate: `/$/${PAGES.AUTH}`, + icon: ICONS.SIGN_UP, + }, + { + label: 'Settings', + navigate: `/$/${PAGES.SETTINGS}`, + icon: ICONS.SETTINGS, + }, + { + label: 'Help', + navigate: `/$/${PAGES.HELP}`, + icon: ICONS.HELP, + }, + ]; + const notificationsEnabled = user && user.experimental_ui; const isAuthenticated = Boolean(email); const [pulseLibrary, setPulseLibrary] = React.useState(false);