From 1c3a6246738a8fa1a2bce401ab29d8d0d2f23231 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 10 Nov 2022 18:00:21 -0600 Subject: split navigation into mode-specific versions --- src/web/src/components/App.js | 225 +++++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 88 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index ea24924a..c55ab830 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -116,10 +116,20 @@ class App extends Component { render = () => { const { login, applicationState = {}, applicationOptions = {}, error, initialized, retriesExhausted } = this.state; - const { version = {}, server, pendingReconnect, pendingRestart, shares = {}, user } = applicationState; + const { + version = {}, + network = {}, + server, + pendingReconnect, + pendingRestart, + shares = {}, + user, + } = applicationState; const { isUpdateAvailable, current, latest } = version; const { scanPending: pendingShareRescan } = shares; + const { mode } = network; + if (!initialized) { return ; } @@ -148,6 +158,129 @@ class App extends Component { ); } + const ModeSpecificNavigation = ({ mode }) => { + if (mode === 'Agent') { + return + + Agent + + ; + } else { + return <> + + + Search + + + + + Downloads + + + + + Uploads + + + + + Rooms + + + + + Chat + + + + + Users + + + + + Browse + + + ; + } + }; + + const ModeSpecificConnectButton = ({ mode, server }) => { + if (mode === 'Agent') { + return <>; + } else { + return <> + {server?.isConnected && disconnect()} + > + + + {user?.privileges?.isPrivileged && + } + Connected + } + {(!server?.isConnected) && connect()} + > + + + + Disconnected + } + {(pendingReconnect || pendingRestart || pendingShareRescan) && + + + + + Pending Action + }; + } + }; + + const ModeSpecificRoutes = ({ mode }) => { + if (mode === 'Agent') { + return <> + this.withTokenCheck( + + ) + }/> + + ; + } else { + return <> + + this.withTokenCheck(
+ +
)} + /> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + + this.withTokenCheck(
) + }/> + + this.withTokenCheck(
+ +
) + }/> + this.withTokenCheck( + + ) + }/> + ; + } + }; + return ( <> @@ -164,66 +297,9 @@ class App extends Component { {version.isCanary && Canary } - - - Search - - - - - Downloads - - - - - Uploads - - - - - Rooms - - - - - Chat - - - - - Users - - - - - Browse - - + - {server?.isConnected && disconnect()} - > - - - {user?.privileges?.isPrivileged && - } - Connected - } - {(!server?.isConnected) && connect()} - > - - - - Disconnected - } - {(pendingReconnect || pendingRestart || pendingShareRescan) && - - - - - Pending Action - } + {isUpdateAvailable && @@ -271,34 +347,7 @@ class App extends Component { - - this.withTokenCheck(
- -
)} - /> - this.withTokenCheck()}/> - this.withTokenCheck()}/> - this.withTokenCheck()}/> - this.withTokenCheck()}/> - - this.withTokenCheck(
) - }/> - - this.withTokenCheck(
- -
) - }/> - this.withTokenCheck( - - ) - }/> - +
-- cgit v1.2.3