From c9031d8d6b4d1afebc8d88b78d4e40393584b338 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Thu, 17 Nov 2022 20:40:57 -0800 Subject: [PATCH] Migrate to the updated antd menu items. Closes #2228 --- web/components/MainLayout.tsx | 242 +++++++++++++++++++--------------- 1 file changed, 135 insertions(+), 107 deletions(-) diff --git a/web/components/MainLayout.tsx b/web/components/MainLayout.tsx index f3a5c9aaa..3227eb478 100644 --- a/web/components/MainLayout.tsx +++ b/web/components/MainLayout.tsx @@ -50,7 +50,6 @@ export const MainLayout: FC = ({ children }) => { const { route } = router || {}; const { Header, Footer, Content, Sider } = Layout; - const { SubMenu } = Menu; const [upgradeVersion, setUpgradeVersion] = useState(''); const checkForUpgrade = async () => { @@ -83,10 +82,8 @@ export const MainLayout: FC = ({ children }) => { online, }); - const upgradeMenuItemStyle = upgradeVersion ? 'block' : 'none'; const upgradeVersionString = `${upgradeVersion}` || ''; const upgradeMessage = `Upgrade to v${upgradeVersionString}`; - const chatMenuItemStyle = chatDisabled ? 'none' : 'block'; const openMenuItems = upgradeVersion ? ['utilities-menu'] : []; const clearAlertMessage = () => { @@ -122,6 +119,139 @@ export const MainLayout: FC = ({ children }) => { statusIndicator ); + const integrationsMenu = [ + { + label: Webhooks, + key: 'webhooks', + }, + { + label: Access Tokens, + key: 'access-tokens', + }, + { + label: External Actions, + key: 'actions', + }, + ]; + + const chatMenu = [ + { + label: Messages, + key: 'messages', + }, + { + label: Users, + key: 'chat-users', + }, + ]; + + const utilitiesMenu = [ + { + label: Hardware, + key: 'hardware-info', + }, + { + label: Stream Health, + key: 'stream-health', + }, + { + label: Logs, + key: 'logs', + }, + federationEnabled && { + label: Social Actions, + key: 'federation-activities', + }, + ]; + + const configurationMenu = [ + { + label: General, + key: 'config-public-details', + }, + { + label: Server Setup, + key: 'config-server-details', + }, + { + label: Video, + key: 'config-video', + }, + { + label: Chat, + key: 'config-chat', + }, + { + label: Social, + key: 'config-federation', + }, + { + label: Notifications, + key: 'config-notify', + }, + { + label: Appearance, + key: 'config-appearance', + }, + { + label: S3 Storage, + key: 'config-storage', + }, + ]; + + const menuItems = [ + { label: Home, icon: , key: 'home' }, + { + label: Viewers, + icon: , + key: 'viewer-info', + }, + !chatDisabled && { + key: 'chat-config', + label: Chat & Users, + icon: , + children: chatMenu, + }, + federationEnabled && { + key: 'fediverse-followers', + label: Followers, + icon: ( + fediverse icon + ), + }, + { + key: 'configuration', + label: 'Configuration', + icon: , + children: configurationMenu, + }, + { + key: 'utilities', + label: 'Utilities', + icon: , + children: utilitiesMenu, + }, + { + key: 'integrations', + label: 'Integrations', + icon: , + children: integrationsMenu, + }, + upgradeVersion && { + key: 'upgrade', + label: {upgradeMessage}, + }, + { + key: 'help', + label: 'Help', + icon: , + }, + ]; return ( @@ -141,110 +271,8 @@ export const MainLayout: FC = ({ children }) => { defaultOpenKeys={openMenuItems} mode="inline" className="menu-container" - > - }> - Home - - - } title="Current stream"> - Viewers - - - } - style={{ display: chatMenuItemStyle }} - > - - Messages - - - - Users - - - - - } - > - Followers - - - }> - - General - - - - Server Setup - - - Video - - - Chat - - - Social - - - Notifications - - - Appearance - - - S3 Storage - - - - } title="Utilities"> - - Hardware - - - Stream Health - - - Logs - - - Social Actions - - - {upgradeMessage} - - - } title="Integrations"> - - Webhooks - - - Access Tokens - - - External Actions - - - } title="Help"> - Help - - + items={menuItems} + />