Skip to content

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

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

shivani170
Copy link
Contributor

@shivani170 shivani170 commented Jun 19, 2025

Description

Context switcher implementation for

  • SDH

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@@ -76,30 +88,33 @@ export interface UserPreferencesType {
export interface UpdatedUserPreferencesType extends UserPreferencesType, Pick<ThemeConfigType, 'appTheme'> {}

export interface UseUserPreferencesProps {
userPreferenceResourceKind?: ResourceKindType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreferredResourceKindType, pls check across

@shivani170 shivani170 self-assigned this Jun 24, 2025
@@ -34,6 +33,17 @@ import {
} from './types'
import { getUserPreferenceResourcesMetadata } from './utils'

export const getParsedResourcesMap = (resources: GetUserPreferencesParsedDTO['resources']) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls move to utils

Copy link
Member

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[] = [
Copy link
Member

@AbhishekA1509 AbhishekA1509 Jun 25, 2025

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]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls add fallback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants