1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-23 13:46:45 +02:00

feat: display total count (#9753)

This commit is contained in:
Mateusz Kwasniewski 2025-04-14 14:30:21 +02:00 committed by GitHub
parent 5b52a6e8d1
commit e6d55ab17a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -27,6 +27,7 @@ const StyledChip = styled(Chip, {
interface ILifecycleFiltersProps {
state: FilterItemParamHolder;
onChange: (value: FilterItemParamHolder) => void;
total?: number;
}
const Wrapper = styled(Box)(({ theme }) => ({
@ -49,6 +50,7 @@ const lifecycleOptions: {
export const LifecycleFilters: FC<ILifecycleFiltersProps> = ({
state,
onChange,
total,
}) => {
const current = state.lifecycle?.values ?? [];
@ -57,6 +59,10 @@ export const LifecycleFilters: FC<ILifecycleFiltersProps> = ({
{lifecycleOptions.map(({ label, value }) => {
const isActive =
value === null ? !state.lifecycle : current.includes(value);
const dynamicLabel =
isActive && Number.isInteger(total)
? `${label} (${total})`
: label;
const handleClick = () =>
onChange(
@ -73,7 +79,7 @@ export const LifecycleFilters: FC<ILifecycleFiltersProps> = ({
return (
<StyledChip
key={label}
label={label}
label={dynamicLabel}
variant='outlined'
isActive={isActive}
onClick={handleClick}

View File

@ -466,6 +466,7 @@ export const FeatureToggleListTable: FC = () => {
<LifecycleFilters
state={filterState}
onChange={setTableState}
total={loading ? undefined : total}
/>
) : null}
<FeatureToggleFilters