-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/env toggle #1192
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
Merged
Merged
Feat/env toggle #1192
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
aa9d2d6
✨ Add SwitchWrapper style for improved layout in Account component
bjorngoa 8053fc2
✨ Add custom hook for toggling active environment features
bjorngoa fa68c1a
✨ Implement custom hook for managing environment feature toggles
bjorngoa 2c8c3c2
✨ Add EnvironmentAvatar component for displaying active environment f…
bjorngoa 9a857f6
✨ Add PointToProdFeaturesLocalStorageKey enum for feature toggle keys
bjorngoa acf9a0f
✨ Add environment feature toggle functionality to Account component
bjorngoa eaa8d9c
:recycle: Refactor feature toggle handler in Account component
bjorngoa 1310fce
:recycle: Remove unused feature toggle handler in Account component
bjorngoa 91fa6b5
:recycle: remove redundant fragment
bjorngoa 0ea0fba
:recycle: Remove empty Typography component in Account component
bjorngoa c82e3f6
:recycle: Refactor environment toggle implementation in Account compo…
bjorngoa dc7a49f
:sparkles: Add EnvironmentToggle component for managing environment s…
bjorngoa 00277d3
:recycle: Update import path for PointToProdFeaturesLocalStorageKey a…
bjorngoa 0866f56
:recycle: Update import path for PointToProdFeaturesLocalStorageKey i…
bjorngoa e2db4a8
:recycle: Add enableEnvironmentToggle prop to Account component for c…
bjorngoa d03b4bd
:recycle: remove old way of applying current env settings
bjorngoa 51d250c
:fire: Remove unused PointToProdFeaturesLocalStorageKey enum from Env…
bjorngoa a53fceb
:recycle: Refactor EnvironmentToggle rendering to use EnvironmentTogg…
bjorngoa ae73f17
:recycle: Add placeholder and helper text to EnvironmentToggle
bjorngoa 01c5fa2
:recycle: StatusAvatar component for displaying user status with cust…
bjorngoa 8b2c388
:recycle: Update AccountAvatar to use StatusAvatar and support enviro…
bjorngoa 18488c4
:recycle: Refactor AccountButton to use StatusAvatar and integrate en…
bjorngoa 6b93af2
:recycle: Integrate environment toggle props into AccountButton and A…
bjorngoa 8cfc385
:recycle: Remove unused console log for environment toggle in Account…
bjorngoa 205010a
:recycle: Enhance AccountAvatar to support combined status display an…
bjorngoa 9e0031a
:recycle: Refactor AccountButton to enhance avatar rendering and stat…
bjorngoa ef55bf4
:recycle: Replace ImpersonateAvatar with StatusAvatar in DeleteUser c…
bjorngoa fb727a7
:fire: replaced with StatusAvatar
bjorngoa da7d42e
:recycle: Remove unused console log from EnvironmentToggle component
bjorngoa 61d015a
:recycle: Refactor StatusAvatar to improve variant handling and color…
bjorngoa 88a6e3a
:fire: not needed, passed in props instead
bjorngoa 786b6b3
:recycle: Rename RoleChips to StatusChips and update usage in Account…
bjorngoa fde8ffb
:recycle: update prop naming
bjorngoa 3a38bbd
:recycle: update interface name
bjorngoa 5e2babe
:recycle: Update StatusChips prop naming from roles to statuses in Ac…
bjorngoa ba766f7
:recycle: Refactor environment toggle handling and add cleanStatusTex…
bjorngoa c8e4a47
:recycle: Rename cleanStatusText to getActiveFeatureDisplayName and u…
bjorngoa 4a55318
:pencil2: Fix typo in environmentToggle import and rename file for co…
bjorngoa 07c2976
:recycle: use same text as used before when active impersonation
bjorngoa f1e59ce
:recycle: Replace hardcoded env-toggle key with ENVIRONMENT_TOGGLE_KE…
bjorngoa 39c6fbb
:recycle: Refactor environment toggle components to use EnvironmentTo…
bjorngoa 0a40eb9
:recycle: Update environment toggle components to use formatFeatureNa…
bjorngoa 6441f55
:bookmark: `10.8.0`
bjorngoa bb24fb0
:recycle: Introduce StatusVariant type and refactor StatusAvatar to u…
bjorngoa 90fb463
:recycle: Refactor AccountAvatar and AccountButton to utilize getVari…
bjorngoa 19083b1
:recycle: Remove unused getVariantColors import from AccountAvatar
bjorngoa 70b87c9
:recycle: Refactor AccountAvatar and AccountButton to use getVariantC…
bjorngoa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,52 @@ | ||
| import { EnvironmentToggleFeatures } from '@equinor/subsurface-app-management'; | ||
|
|
||
| import { colors } from 'src/atoms'; | ||
| import { StatusVariant } from 'src/organisms/TopBar/Account/Account.types'; | ||
|
|
||
| export function formatFeatureName(activeFeature: EnvironmentToggleFeatures) { | ||
| return ( | ||
| activeFeature.charAt(0).toUpperCase() + | ||
| activeFeature.slice(1).replaceAll('-', ' ') | ||
| ); | ||
| } | ||
|
|
||
| type ColorConfig = { | ||
| border: string; | ||
| background: string; | ||
| chipBackground: string; | ||
| outline: string; | ||
| }; | ||
|
|
||
| const VARIANT_COLORS: Record<StatusVariant, ColorConfig> = { | ||
| combined: { | ||
| border: colors.interactive.success__resting.rgba, | ||
| background: colors.interactive.warning__text.rgba, | ||
| chipBackground: colors.interactive.warning__resting.rgba, | ||
| outline: colors.interactive.success__resting.rgba, | ||
| }, | ||
| environment: { | ||
| border: colors.interactive.success__resting.rgba, | ||
| background: colors.interactive.success__text.rgba, | ||
| chipBackground: colors.interactive.success__resting.rgba, | ||
| outline: colors.interactive.success__resting.rgba, | ||
| }, | ||
| impersonate: { | ||
| border: colors.interactive.warning__resting.rgba, | ||
| background: colors.interactive.warning__text.rgba, | ||
| chipBackground: colors.interactive.warning__resting.rgba, | ||
| outline: colors.interactive.warning__resting.rgba, | ||
| }, | ||
| }; | ||
|
|
||
| const DEFAULT_COLORS: ColorConfig = { | ||
| border: colors.interactive.warning__resting.rgba, | ||
| background: colors.interactive.warning__text.rgba, | ||
| chipBackground: colors.interactive.warning__resting.rgba, | ||
| outline: colors.interactive.warning__resting.rgba, | ||
| }; | ||
|
|
||
| export function getVariantColors( | ||
| variant: StatusVariant | undefined | ||
| ): ColorConfig { | ||
| return variant ? VARIANT_COLORS[variant] : DEFAULT_COLORS; | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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,4 @@ | ||
| export type StatusVariant = 'impersonate' | 'environment' | 'combined'; | ||
| export interface StatusVariantProps { | ||
| $variant?: StatusVariant; | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The prop name is
statuses(line 9) but the component is receiving a prop calledroleswhen invoked (line 156). This is a mismatch that will cause the component to not receive the expected data. Either update the prop name in StatusChips.tsx torolesor update the usage in Account.tsx to passstatuses.