Skip to content

Commit

Permalink
make feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Jan 8, 2025
1 parent b28ef1e commit 82ffe8a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@
"OT_PD_ENABLE_LIQUID_CLASSES": {
"title": "Enable liquid classes",
"description": "Enable liquid classes support"
},
"OT_PD_ENABLE_PARTIAL_TIP_SUPPORT": {
"title": "Enable partial tip support",
"description": "Partial tip configurations that are not released yet"
}
}
4 changes: 3 additions & 1 deletion protocol-designer/src/feature-flags/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const initialFlags: Flags = {
process.env.OT_PD_ENABLE_HOT_KEYS_DISPLAY === '1' || true,
OT_PD_ENABLE_REACT_SCAN: process.env.OT_PD_ENABLE_REACT_SCAN === '1' || false,
OT_PD_ENABLE_LIQUID_CLASSES:
process.env.OT_PD_ENABLE_REACT_SCAN === '1' || false,
process.env.OT_PD_ENABLE_LIQUID_CLASSES === '1' || false,
OT_PD_ENABLE_PARTIAL_TIP_SUPPORT:
process.env.OT_PD_ENABLE_PARTIAL_TIP_SUPPORT === '1' || false,
}
// @ts-expect-error(sa, 2021-6-10): cannot use string literals as action type
// TODO IMMEDIATELY: refactor this to the old fashioned way if we cannot have type safety: https://github.com/redux-utilities/redux-actions/issues/282#issuecomment-595163081
Expand Down
4 changes: 4 additions & 0 deletions protocol-designer/src/feature-flags/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ export const getEnableLiquidClasses: Selector<boolean> = createSelector(
getFeatureFlagData,
flags => flags.OT_PD_ENABLE_LIQUID_CLASSES ?? false
)
export const getEnablePartialTipSupport: Selector<boolean> = createSelector(
getFeatureFlagData,
flags => flags.OT_PD_ENABLE_PARTIAL_TIP_SUPPORT ?? false
)
2 changes: 2 additions & 0 deletions protocol-designer/src/feature-flags/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type FlagTypes =
| 'OT_PD_ENABLE_HOT_KEYS_DISPLAY'
| 'OT_PD_ENABLE_REACT_SCAN'
| 'OT_PD_ENABLE_LIQUID_CLASSES'
| 'OT_PD_ENABLE_PARTIAL_TIP_SUPPORT'
// flags that are not in this list only show in prerelease mode
export const userFacingFlags: FlagTypes[] = [
'OT_PD_DISABLE_MODULE_RESTRICTIONS',
Expand All @@ -51,5 +52,6 @@ export const allFlags: FlagTypes[] = [
'OT_PD_ENABLE_RETURN_TIP',
'OT_PD_ENABLE_REACT_SCAN',
'OT_PD_ENABLE_LIQUID_CLASSES',
'OT_PD_ENABLE_PARTIAL_TIP_SUPPORT',
]
export type Flags = Partial<Record<FlagTypes, boolean | null | undefined>>

0 comments on commit 82ffe8a

Please sign in to comment.