From 5a7b5397f3381f67859e3c4df3ff314db0d20236 Mon Sep 17 00:00:00 2001 From: Mats Date: Thu, 13 Jun 2024 23:11:05 +0200 Subject: [PATCH] New mobile friendly navbar --- client/public/en.lang | 3 +- .../client/services/media/MediaManager.jsx | 1 - client/src/components/icons/hamburger.jsx | 28 +++++ client/src/components/tabwindow/TabWindow.jsx | 112 ++++++++++++++---- 4 files changed, 122 insertions(+), 22 deletions(-) create mode 100644 client/src/components/icons/hamburger.jsx diff --git a/client/public/en.lang b/client/public/en.lang index 24d88083fd..a637cd267d 100644 --- a/client/public/en.lang +++ b/client/public/en.lang @@ -18,6 +18,7 @@ navbar.free=free navbar.premium=premium navbar.upgradeRequired=Upgrade required navbar.isPlaying=Playing music +navbar.menu=Open menu home.confirmLoginHeader=Welcome back! home.confirmLoginBody=Are you trying to login as %player?
If you are not, please close this window. @@ -146,4 +147,4 @@ settings.interpolation.button=Enable smoothing network.serverUnhealthy={serverName}'s connection to OpenAudioMc is unstable, client functionality may be limited until the connection is restored. -tooltip.close=Close \ No newline at end of file +tooltip.close=Close diff --git a/client/src/client/services/media/MediaManager.jsx b/client/src/client/services/media/MediaManager.jsx index 610dace123..ac008e4a0f 100644 --- a/client/src/client/services/media/MediaManager.jsx +++ b/client/src/client/services/media/MediaManager.jsx @@ -86,7 +86,6 @@ export const MediaManager = new class IMediaManager { const channel = chls[i]; if (all) { channel.fadeChannel(0, time, () => { - console.log('callback reached'); this.mixer.removeChannel(channel); }); matchedAndStopped = channel; diff --git a/client/src/components/icons/hamburger.jsx b/client/src/components/icons/hamburger.jsx new file mode 100644 index 0000000000..8ae1b2c8b7 --- /dev/null +++ b/client/src/components/icons/hamburger.jsx @@ -0,0 +1,28 @@ +import React from 'react'; +import { msg } from '../../client/OpenAudioAppContainer'; + +export function HamburgerSvg() { + // remix of https://www.svgrepo.com/svg/532195/menu?edit=true + // by: SVG Repo + return ( + + + + + + + + ); +} diff --git a/client/src/components/tabwindow/TabWindow.jsx b/client/src/components/tabwindow/TabWindow.jsx index 0f5871907a..85a4feac38 100644 --- a/client/src/components/tabwindow/TabWindow.jsx +++ b/client/src/components/tabwindow/TabWindow.jsx @@ -7,6 +7,7 @@ import { setGlobalState } from '../../state/store'; import { msg } from '../../client/OpenAudioAppContainer'; import ServerConnectionWarning from '../connectionwarning/ServerConnectionWarning'; import UserAvatar from '../avatar/UserAvatar'; +import { HamburgerSvg } from '../icons/hamburger'; export const setTab = (tab) => { setGlobalState({ @@ -18,6 +19,8 @@ class TabWindow extends Component { constructor(props) { super(props); this.openUpgradeDialog = this.openUpgradeDialog.bind(this); + this.state = { mobileMenuOpen: false }; + this.toggleMobileMenu = this.toggleMobileMenu.bind(this); } openUpgradeDialog() { @@ -30,6 +33,10 @@ class TabWindow extends Component { ); } + toggleMobileMenu() { + this.setState((prevState) => ({ mobileMenuOpen: !prevState.mobileMenuOpen })); + } + render() { let pages = React.Children.toArray(this.props.children).map((child) => ({ name: child.props.name, @@ -63,44 +70,109 @@ class TabWindow extends Component { {!hiddenNavbar && ( - -
-
-

{playerName}

- + {/* Desktop Navbar */} +
- + +
+
+ {pages.map((page, index) => ( + + ))} +
+
+ +
+
+

{playerName}

+ +
+
+ + )}