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:
parent
5b52a6e8d1
commit
e6d55ab17a
@ -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}
|
||||
|
@ -466,6 +466,7 @@ export const FeatureToggleListTable: FC = () => {
|
||||
<LifecycleFilters
|
||||
state={filterState}
|
||||
onChange={setTableState}
|
||||
total={loading ? undefined : total}
|
||||
/>
|
||||
) : null}
|
||||
<FeatureToggleFilters
|
||||
|
Loading…
Reference in New Issue
Block a user