Skip to content

Commit

Permalink
fix(flags): better redistribute experience (#25611)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
dmarticus and github-actions[bot] authored Oct 17, 2024
1 parent 3653de9 commit f79f573
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IconBalance } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonDivider, LemonInput, LemonTable, Link, Spinner } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
Expand Down Expand Up @@ -99,8 +100,11 @@ export const SidePanelExperimentFeatureFlag = (): JSX.Element => {
title: (
<div className="flex items-center justify-between space-x-2">
<span>Rollout Percentage</span>
<LemonButton type="secondary" size="xsmall" onClick={distributeVariantsEqually}>
Redistribute
<LemonButton
onClick={distributeVariantsEqually}
tooltip="Redistribute variant rollout percentages equally"
>
<IconBalance />
</LemonButton>
</div>
),
Expand All @@ -121,6 +125,7 @@ export const SidePanelExperimentFeatureFlag = (): JSX.Element => {
}}
min={0}
max={100}
suffix={<span>%</span>}
/>
),
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/lemon-ui/icons/categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export const TEAMS_AND_COMPANIES = {
'IconRewindPlay',
'IconVideoCamera',
],
'Feature Success': ['IconFlask', 'IconTestTube', 'IconMultivariateTesting', 'IconSplitTesting'],
'Feature Success': ['IconFlask', 'IconTestTube', 'IconMultivariateTesting', 'IconSplitTesting', 'IconBalance'],
Pipeline: ['IconWebhooks', 'IconDecisionTree'],
'Product OS': ['IconNotebook', 'IconHogQL', 'IconDashboard', 'IconSupport'],
Logos: ['IconLogomark', 'IconGithub'],
Expand Down
12 changes: 9 additions & 3 deletions frontend/src/scenes/feature-flags/FeatureFlag.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './FeatureFlag.scss'

import { IconCollapse, IconExpand, IconPlus, IconTrash } from '@posthog/icons'
import { IconBalance, IconCollapse, IconExpand, IconPlus, IconTrash } from '@posthog/icons'
import { LemonDialog, LemonSegmentedButton, LemonSkeleton, LemonSwitch } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { Form, Group } from 'kea-forms'
Expand Down Expand Up @@ -950,9 +950,14 @@ function FeatureFlagRollout({ readOnly }: { readOnly?: boolean }): JSX.Element {
</span>
</div>
</div>
<div className="col-span-4 flex items-center gap-1">
<div className="col-span-3 flex justify-between items-center gap-1">
<span>Rollout</span>
<LemonButton onClick={distributeVariantsEqually}>(Redistribute)</LemonButton>
<LemonButton
onClick={distributeVariantsEqually}
tooltip="Normalize variant rollout percentages"
>
<IconBalance />
</LemonButton>
</div>
</div>
{variants.map((variant, index) => (
Expand Down Expand Up @@ -1023,6 +1028,7 @@ function FeatureFlagRollout({ readOnly }: { readOnly?: boolean }): JSX.Element {
}
}
}}
suffix={<span>%</span>}
/>
{filterGroups.filter((group) => group.variant === variant.key)
.length > 0 && (
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@microlink/react-json-view": "^1.21.3",
"@monaco-editor/react": "4.6.0",
"@posthog/hogvm": "^1.0.54",
"@posthog/icons": "0.8.4",
"@posthog/icons": "0.8.5",
"@posthog/plugin-scaffold": "^1.4.4",
"@react-hook/size": "^2.1.2",
"@rrweb/types": "2.0.0-alpha.13",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f79f573

Please sign in to comment.