From a8c4e9d0851f2fe296515be24d24d59be02cc7e6 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 19 May 2022 07:52:52 -0500 Subject: add app context but don't use it --- src/web/src/components/AppContext.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/web/src/components/AppContext.js (limited to 'src/web') diff --git a/src/web/src/components/AppContext.js b/src/web/src/components/AppContext.js new file mode 100644 index 00000000..2095b2ab --- /dev/null +++ b/src/web/src/components/AppContext.js @@ -0,0 +1,5 @@ +import React from 'react'; + +const AppContext = React.createContext(); + +export default AppContext; \ No newline at end of file -- cgit v1.2.3 From f1c5fe2f560e2f868a5b1cfde23789ce871cfd42 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 19 May 2022 07:53:20 -0500 Subject: wrap pages in context provider, pass server state to searches --- src/web/src/components/App.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index a5bf936a..5e5ed10f 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -19,6 +19,8 @@ import Chat from './Chat/Chat'; import System from './System/System'; import LoginForm from './LoginForm'; +import AppContext from './AppContext'; + import { Sidebar, Segment, @@ -246,17 +248,26 @@ class App extends Component { - - this.withTokenCheck(
)}/> - this.withTokenCheck()}/> - this.withTokenCheck()}/> - this.withTokenCheck()}/> - this.withTokenCheck()}/> - this.withTokenCheck()}/> - this.withTokenCheck()}/> - this.withTokenCheck()}/> - -
+ + + + this.withTokenCheck(
+ +
)} + /> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + this.withTokenCheck()}/> + +
+
Date: Thu, 19 May 2022 07:53:30 -0500 Subject: disable controls if disconnected from server --- src/web/src/components/Search/Searches.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/Search/Searches.js b/src/web/src/components/Search/Searches.js index c1a3a893..9b0c3dd4 100644 --- a/src/web/src/components/Search/Searches.js +++ b/src/web/src/components/Search/Searches.js @@ -20,7 +20,7 @@ import { import SearchDetail from './Detail/SearchDetail'; import ErrorSegment from '../Shared/ErrorSegment'; -const Searches = () => { +const Searches = ({ server }) => { const [connecting, setConnecting] = useState(true); const [error, setError] = useState(undefined); const [searches, setSearches] = useState({}); @@ -190,12 +190,12 @@ const Searches = () => { size='big' ref={inputRef} loading={creating} - disabled={creating} + disabled={creating || !server.isConnected} className='search-input' placeholder="Search phrase" action={<> -