-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): SKFP-874 refact authorized studies widget
- Loading branch information
lflangis
committed
Dec 19, 2023
1 parent
a9628cf
commit 80d471f
Showing
23 changed files
with
538 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
import intl from "react-intl-universal"; | ||
import { Provider as ReduxProvider } from "react-redux"; | ||
import { PersistGate } from "redux-persist/integration/react"; | ||
import KeycloakProvider from "provider/KeycloakProvider"; | ||
import getStoreConfig from "store"; | ||
import { LANG } from "common/constants"; | ||
import locales from "locales"; | ||
import intl from 'react-intl-universal'; | ||
import { Provider as ReduxProvider } from 'react-redux'; | ||
import locales from 'locales'; | ||
import KeycloakProvider from 'provider/KeycloakProvider'; | ||
import { PersistGate } from 'redux-persist/integration/react'; | ||
|
||
import { LANG } from 'common/constants'; | ||
import getStoreConfig from 'store'; | ||
|
||
const { store, persistor } = getStoreConfig(); | ||
persistor.subscribe(function () { | ||
intl.init({ | ||
currentLocale: store.getState().global.lang || LANG.EN, | ||
locales, | ||
warningHandler: () => "" | ||
warningHandler: () => '', | ||
}); | ||
}); | ||
|
||
const ContextProvider = ({ children }: any) => { | ||
return ( | ||
<KeycloakProvider> | ||
<ReduxProvider store={store}> | ||
<PersistGate persistor={persistor}>{children}</PersistGate> | ||
</ReduxProvider> | ||
</KeycloakProvider> | ||
); | ||
}; | ||
const ContextProvider = ({ children }: any) => ( | ||
<KeycloakProvider> | ||
<ReduxProvider store={store}> | ||
<PersistGate persistor={persistor}>{children}</PersistGate> | ||
</ReduxProvider> | ||
</KeycloakProvider> | ||
); | ||
|
||
export default ContextProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useEffect } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
|
||
import { FENCE_NAMES } from 'common/fenceTypes'; | ||
|
||
import { fencesAuthorizedStudiesSelector, fencesSelector } from './selector'; | ||
import { fetchFenceAuthentificationStatus } from './thunks'; | ||
|
||
export type { initialState as fencesInitialState } from './types'; | ||
export { default, FencesState } from './slice'; | ||
|
||
export const useFenceAuthentification = (fence: FENCE_NAMES) => { | ||
const dispatch = useDispatch(); | ||
const state = useSelector(fencesSelector); | ||
|
||
useEffect(() => { | ||
dispatch(fetchFenceAuthentificationStatus(fence)); | ||
}, []); | ||
|
||
return { | ||
...state[fence], | ||
}; | ||
}; | ||
|
||
export const useFencesAuthorizedStudies = () => { | ||
const state = useSelector(fencesAuthorizedStudiesSelector); | ||
return { | ||
...state, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { RootState } from 'store/types'; | ||
|
||
import { initialState } from './types'; | ||
|
||
export type FencesProps = initialState; | ||
|
||
export const fencesSelector = (state: RootState) => state.fences; | ||
export const fencesAuthorizedStudiesSelector = (state: RootState) => state.fences.authorizedStudies; |
Oops, something went wrong.