Context fixes
This commit is contained in:
@@ -48,6 +48,8 @@ import 'react-toastify/dist/ReactToastify.css';
|
|||||||
|
|
||||||
import Drift from "react-driftjs";
|
import Drift from "react-driftjs";
|
||||||
|
|
||||||
|
import { AppContext } from './context/contextApi.jsx';
|
||||||
|
|
||||||
// Production - backend proxy forwarding in nginx
|
// Production - backend proxy forwarding in nginx
|
||||||
var globalUrl = window.location.origin;
|
var globalUrl = window.location.origin;
|
||||||
|
|
||||||
@@ -612,6 +614,7 @@ const App = (message, props) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<AppContext>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<CookiesProvider>
|
<CookiesProvider>
|
||||||
@@ -632,6 +635,7 @@ const App = (message, props) => {
|
|||||||
/>
|
/>
|
||||||
</CookiesProvider>
|
</CookiesProvider>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
|
</AppContext>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import theme from '../theme.jsx';
|
|||||||
import { useNavigate, Link, useParams } from "react-router-dom";
|
import { useNavigate, Link, useParams } from "react-router-dom";
|
||||||
import SearchBox from "../components/SearchData.jsx";
|
import SearchBox from "../components/SearchData.jsx";
|
||||||
|
|
||||||
import { Context } from '../Context/contextApi.js';
|
import { Context } from '../context/contextApi.jsx';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Chip,
|
Chip,
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
import { createContext, useState } from 'react';
|
||||||
|
|
||||||
|
export const Context = createContext();
|
||||||
|
|
||||||
|
export const AppContext =(props) => {
|
||||||
|
|
||||||
|
// Left side bar global states
|
||||||
|
const [searchBarModalOpen, setSearchBarModalOpen] = useState(false);
|
||||||
|
const [leftSideBarOpenByClick, setLeftSideBarOpenByClick] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Context.Provider value={{
|
||||||
|
searchBarModalOpen,
|
||||||
|
setSearchBarModalOpen,
|
||||||
|
leftSideBarOpenByClick,
|
||||||
|
setLeftSideBarOpenByClick
|
||||||
|
}}>
|
||||||
|
{props.children}
|
||||||
|
</Context.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user