aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-05-19 07:53:20 -0500
committerJP Dillingham <jp@dillingham.me>2022-05-19 07:53:20 -0500
commitf1c5fe2f560e2f868a5b1cfde23789ce871cfd42 (patch)
tree7c56a63de7bd04ac7bc037fe447d39610f9d66c9 /src
parenta8c4e9d0851f2fe296515be24d24d59be02cc7e6 (diff)
downloadslskd-f1c5fe2f560e2f868a5b1cfde23789ce871cfd42.tar.gz
wrap pages in context provider, pass server state to searches
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/App.js33
1 files changed, 22 insertions, 11 deletions
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 {
</Menu>
</Sidebar>
<Sidebar.Pusher className='app-content'>
- <Switch>
- <Route path={`${urlBase}/searches/:id?`} render={(props) => this.withTokenCheck(<div className='search-container'><Searches {...props}/></div>)}/>
- <Route path={`${urlBase}/browse`} render={(props) => this.withTokenCheck(<Browse {...props}/>)}/>
- <Route path={`${urlBase}/users`} render={(props) => this.withTokenCheck(<Users {...props}/>)}/>
- <Route path={`${urlBase}/chat`} render={(props) => this.withTokenCheck(<Chat {...props}/>)}/>
- <Route path={`${urlBase}/rooms`} render={(props) => this.withTokenCheck(<Rooms {...props}/>)}/>
- <Route path={`${urlBase}/uploads`} render={(props) => this.withTokenCheck(<Transfers {...props} direction='upload'/>)}/>
- <Route path={`${urlBase}/downloads`} render={(props) => this.withTokenCheck(<Transfers {...props} direction='download'/>)}/>
- <Route path={`${urlBase}/system/:tab?`} render={(props) => this.withTokenCheck(<System {...props} state={applicationState} options={applicationOptions}/>)}/>
- <Redirect from='*' to={`${urlBase}/searches`}/>
- </Switch>
+ <AppContext.Provider value={{ state: applicationState, options: applicationOptions }}>
+ <Switch>
+ <Route path={`${urlBase}/searches/:id?`} render={(props) =>
+ this.withTokenCheck(<div className='search-container'>
+ <Searches
+ server={applicationState.server}
+ {...props}
+ />
+ </div>)}
+ />
+ <Route path={`${urlBase}/browse`} render={(props) => this.withTokenCheck(<Browse {...props}/>)}/>
+ <Route path={`${urlBase}/users`} render={(props) => this.withTokenCheck(<Users {...props}/>)}/>
+ <Route path={`${urlBase}/chat`} render={(props) => this.withTokenCheck(<Chat {...props}/>)}/>
+ <Route path={`${urlBase}/rooms`} render={(props) => this.withTokenCheck(<Rooms {...props}/>)}/>
+ <Route path={`${urlBase}/uploads`} render={(props) => this.withTokenCheck(<Transfers {...props} direction='upload'/>)}/>
+ <Route path={`${urlBase}/downloads`} render={(props) => this.withTokenCheck(<Transfers {...props} direction='download'/>)}/>
+ <Route path={`${urlBase}/system/:tab?`} render={(props) => this.withTokenCheck(<System {...props} state={applicationState} options={applicationOptions}/>)}/>
+ <Redirect from='*' to={`${urlBase}/searches`}/>
+ </Switch>
+ </AppContext.Provider>
</Sidebar.Pusher>
</Sidebar.Pushable>
<ToastContainer