-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d11ced
commit a3fd6f7
Showing
11 changed files
with
55 additions
and
61 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
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import config from './config'; | ||
import ui from './ui'; | ||
import search from './search'; | ||
|
||
export default { | ||
config, | ||
ui, | ||
search, | ||
}; |
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,25 @@ | ||
import { LOCALES } from '@common/i18n/locales'; | ||
import { createBaseSlice, SliceState } from './utils/slice'; | ||
import { generateStore, type StateCreatorTyped } from './utils/storeCreator'; | ||
import { OKAPI_CONFIG } from '@common/constants/api.constants'; | ||
import { localStorageService } from '@common/services/storage'; | ||
|
||
type Locale = (typeof LOCALES)[keyof typeof LOCALES]; | ||
type CustomEvents = Record<string, string> | null; | ||
|
||
export type ConfigState = SliceState<'locale', Locale> & | ||
SliceState<'customEvents', CustomEvents> & | ||
SliceState<'hasNavigationOrigin', boolean>; | ||
|
||
const STORE_NAME = 'Config'; | ||
|
||
const configStore: StateCreatorTyped<ConfigState> = (...args) => ({ | ||
...createBaseSlice( | ||
{ basic: 'locale' }, | ||
localStorageService.deserialize(OKAPI_CONFIG)?.locale || LOCALES.ENGLISH_US, | ||
)(...args), | ||
...createBaseSlice({ basic: 'customEvents' }, null as CustomEvents)(...args), | ||
...createBaseSlice({ basic: 'hasNavigationOrigin' }, false)(...args), | ||
}); | ||
|
||
export const useConfigStore = generateStore(configStore, STORE_NAME); |
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
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