From 01b5eb5a02cc54d316cbdcba65f9ba5ae94526da Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 16 Nov 2022 09:18:27 -0600 Subject: fix rerender issue --- src/web/src/components/App.js | 200 ++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 103 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index 9380f19d..66fa3945 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -158,64 +158,23 @@ class App extends Component { /> ); } - - const ModeSpecificNavigation = ({ mode }) => { - if (mode === 'Agent') { - return - Agent Mode - ; - } else { - return <> - - - Search - - - - - Downloads - - - - - Uploads - - - - - Rooms - - - - - Chat - - - - - Users - - - - - Browse - - - ; - } - }; - + const ModeSpecificConnectButton = ({ mode, server, controller = {} }) => { - if (mode === 'Agent') { + if (mode !== 'Agent') { const isConnected = controller?.state === 'Connected'; const isTransitioning = ['Connecting', 'Reconnecting'].includes(controller?.state); return <> isConnected ? relayAPI.connect() : relayAPI.disconnect()} + onClick={() => isConnected ? relayAPI.disconnect() : relayAPI.connect()} > - + {!isConnected && } Controller {controller?.state} @@ -239,60 +198,12 @@ class App extends Component { 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( - - ) - }/> - ; } }; + const isAgent = mode !== 'Agent'; + return ( <> @@ -309,9 +220,55 @@ class App extends Component { {version.isCanary && Canary } - + {isAgent ? + Agent Mode + : + <> + + + Search + + + + + Downloads + + + + + Uploads + + + + + Rooms + + + + + Chat + + + + + Users + + + + + Browse + + + } - + + {(pendingReconnect || pendingRestart || pendingShareRescan) && + + + + + Pending Action + } {isUpdateAvailable && @@ -359,7 +316,44 @@ class App extends Component { - + {isAgent ? <> + this.withTokenCheck( + + ) + }/> + + : + <> + + this.withTokenCheck(
+ +
)} + /> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + + this.withTokenCheck(
) + }/> + + this.withTokenCheck(
+ +
) + }/> + this.withTokenCheck( + + ) + }/> + + }
-- cgit v1.2.3