From c4b5fc5c8c98b61f6a80a1c107c68a0f5a9c40b0 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Wed, 6 Mar 2024 14:24:03 +0000 Subject: [PATCH] chore: Update tooltips for flag enabled state / value (#3538) --- frontend/web/components/Feature.js | 42 ++++++++++++++++++++--------- frontend/web/components/Tooltip.tsx | 4 +++ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/frontend/web/components/Feature.js b/frontend/web/components/Feature.js index 95b148a18e73..c30f98b95c0c 100644 --- a/frontend/web/components/Feature.js +++ b/frontend/web/components/Feature.js @@ -5,6 +5,8 @@ import Constants from 'common/constants' import VariationOptions from './mv/VariationOptions' import AddVariationButton from './mv/AddVariationButton' import ErrorMessage from './ErrorMessage' +import Tooltip from './Tooltip' +import Icon from './Icon' export default class Feature extends PureComponent { static displayName = 'Feature' @@ -49,7 +51,7 @@ export default class Feature extends PureComponent { ? 'User override' : !!multivariate_options && multivariate_options.length ? `Control Value - ${controlPercentage}%` - : `Value (optional)${' - these can be set per environment'}` + : `Value (optional)` const showValue = !( !!identity && @@ -58,16 +60,28 @@ export default class Feature extends PureComponent { ) return (
- - -
{enabledString || 'Enabled'}
+ + + +
+ {enabledString || 'Enabled'} +
+ {!isEdit && } +
+ } + > + {!isEdit && + 'This will determine the initial enabled state for all environments. You can edit the this individually for each environment once the feature is created.'} + {showValue && ( @@ -86,7 +100,11 @@ export default class Feature extends PureComponent { placeholder="e.g. 'big' " /> } - tooltip={Constants.strings.REMOTE_CONFIG_DESCRIPTION} + tooltip={`${Constants.strings.REMOTE_CONFIG_DESCRIPTION}${ + !isEdit + ? '
Setting this when creating a feature will set the value for all environments. You can edit the this individually for each environment once the feature is created.' + : '' + }`} title={`${valueString}`} /> diff --git a/frontend/web/components/Tooltip.tsx b/frontend/web/components/Tooltip.tsx index 5c8ceb8336ac..458f313fbf35 100644 --- a/frontend/web/components/Tooltip.tsx +++ b/frontend/web/components/Tooltip.tsx @@ -12,6 +12,10 @@ export type TooltipProps = { const Tooltip: FC = ({ children, place, plainText, title }) => { const id = Utils.GUID() + if (!children) { + // Skip tooltip by supplying falsy children + return <>{title} + } return ( <> {title && (