-
Notifications
You must be signed in to change notification settings - Fork 361
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
Showing
20 changed files
with
1,669 additions
and
560 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"live-mobile": patch | ||
--- | ||
|
||
Feature flags: take into account env variable FEATURE_FLAGS to override feature flags |
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,5 @@ | ||
--- | ||
"ledger-live-desktop": patch | ||
--- | ||
|
||
Feature flags: take into account env variable FEATURE_FLAGS to override feature flags |
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,6 @@ | ||
--- | ||
"@ledgerhq/live-common": patch | ||
"@ledgerhq/types-live": patch | ||
--- | ||
|
||
Add FEATURE_FLAGS env variable to override feature flags |
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
248 changes: 0 additions & 248 deletions
248
...dger-live-desktop/src/renderer/screens/settings/sections/Developer/FeatureFlagsButton.tsx
This file was deleted.
Oops, something went wrong.
74 changes: 74 additions & 0 deletions
74
.../renderer/screens/settings/sections/Developer/FeatureFlagsSettings/FeatureFlagDetails.tsx
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,74 @@ | ||
import React, { useCallback } from "react"; | ||
import ButtonV2 from "~/renderer/components/Button"; | ||
import { useFeatureFlags } from "@ledgerhq/live-common/featureFlags/index"; | ||
import { Text, Flex, Tag } from "@ledgerhq/react-ui"; | ||
import { FeatureId } from "@ledgerhq/types-live"; | ||
import { withV2StyleProvider } from "~/renderer/styles/StyleProvider"; | ||
import Box from "~/renderer/components/Box"; | ||
import FeatureFlagEdit from "./FeatureFlagEdit"; | ||
|
||
const OldButton = withV2StyleProvider(ButtonV2); | ||
|
||
type Props = { | ||
flagName: FeatureId; | ||
focused?: boolean; | ||
setFocusedName: (arg0: string | undefined) => void; | ||
}; | ||
|
||
const FeatureFlagDetails: React.FC<Props> = props => { | ||
const { flagName, focused, setFocusedName } = props; | ||
const { getFeature } = useFeatureFlags(); | ||
const flagValue = getFeature(flagName as FeatureId); | ||
|
||
const { | ||
overriddenByEnv, | ||
overridesRemote, | ||
enabledOverriddenForCurrentLanguage, | ||
enabledOverriddenForCurrentDesktopVersion, | ||
} = flagValue || {}; | ||
|
||
const handleClick = useCallback(() => { | ||
focused ? setFocusedName(undefined) : setFocusedName(flagName); | ||
}, [focused, flagName, setFocusedName]); | ||
|
||
if (!flagValue) return null; | ||
|
||
return ( | ||
<> | ||
<OldButton flexDirection="row" py={1} onClick={handleClick}> | ||
<Flex flex={1} mr={3} alignItems="center"> | ||
<Box | ||
bg={flagValue?.enabled ? "success.c100" : "error.c100"} | ||
height={10} | ||
width={10} | ||
mr={2} | ||
borderRadius={999} | ||
/> | ||
<Text mr={1}>{flagName}</Text> | ||
{overriddenByEnv ? ( | ||
<Tag active mx={1} type="opacity" size="small"> | ||
overridden by env | ||
</Tag> | ||
) : overridesRemote ? ( | ||
<Tag active mx={1} type="opacity" size="small"> | ||
overridden locally | ||
</Tag> | ||
) : null} | ||
{enabledOverriddenForCurrentLanguage ? ( | ||
<Tag active mx={1} type="outlinedOpacity" size="small"> | ||
disabled for current language | ||
</Tag> | ||
) : null} | ||
{enabledOverriddenForCurrentDesktopVersion ? ( | ||
<Tag active mx={1} type="outlinedOpacity" size="small"> | ||
disabled for current version | ||
</Tag> | ||
) : null} | ||
</Flex> | ||
</OldButton> | ||
{focused ? <FeatureFlagEdit flagName={flagName} flagValue={flagValue} /> : null} | ||
</> | ||
); | ||
}; | ||
|
||
export default FeatureFlagDetails; |
Oops, something went wrong.