-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Generalize user preferences as per resource kind #793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
@@ -76,30 +88,33 @@ export interface UserPreferencesType { | |||
export interface UpdatedUserPreferencesType extends UserPreferencesType, Pick<ThemeConfigType, 'appTheme'> {} | |||
|
|||
export interface UseUserPreferencesProps { | |||
userPreferenceResourceKind?: ResourceKindType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PreferredResourceKindType, pls check across
@@ -34,6 +33,17 @@ import { | |||
} from './types' | |||
import { getUserPreferenceResourcesMetadata } from './utils' | |||
|
|||
export const getParsedResourcesMap = (resources: GetUserPreferencesParsedDTO['resources']) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls move to utils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still here
export const USER_PREFERENCES_ATTRIBUTE_KEY = 'userPreferences' | ||
|
||
export const PreferredResourceKinds: PreferredResourceKindType[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls move to UPPER_CASE and can we make object since that will be type safe if new type is added
const parsedResourcesMap: UserPreferencesType['resources'] = {} | ||
|
||
PreferredResourceKinds.forEach((resourceKind) => { | ||
parsedResourcesMap[resourceKind] = resources?.[resourceKind] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls add fallback
Description
Context switcher implementation for
Type of change
Checklist