mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
chore: add quick filter for custom strategies (#10686)
https://linear.app/unleash/issue/2-3896/add-quick-filter-for-custom-strategies Adds a quick filter for custom strategies in the new "add strategy" modal. <img width="793" height="234" alt="image" src="https://github.com/user-attachments/assets/b7190ff1-ef92-44b2-ad78-f3b283bdf6a2" />
This commit is contained in:
parent
27af5cb0b9
commit
e98b511bb2
@ -33,6 +33,7 @@ const FILTERS = [
|
|||||||
{ label: 'Standard strategies', value: 'standard' },
|
{ label: 'Standard strategies', value: 'standard' },
|
||||||
{ label: 'Release templates', value: 'releaseTemplates' },
|
{ label: 'Release templates', value: 'releaseTemplates' },
|
||||||
{ label: 'Advanced strategies', value: 'advanced' },
|
{ label: 'Advanced strategies', value: 'advanced' },
|
||||||
|
{ label: 'Custom strategies', value: 'custom' },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type StrategyFilterValue = (typeof FILTERS)[number]['value'];
|
export type StrategyFilterValue = (typeof FILTERS)[number]['value'];
|
||||||
@ -121,11 +122,8 @@ export const FeatureStrategyMenuCards = ({
|
|||||||
() =>
|
() =>
|
||||||
FILTERS.filter(({ value }) => {
|
FILTERS.filter(({ value }) => {
|
||||||
if (value === 'releaseTemplates') return isEnterprise();
|
if (value === 'releaseTemplates') return isEnterprise();
|
||||||
if (value === 'advanced')
|
if (value === 'advanced') return advancedStrategies.length > 0;
|
||||||
return (
|
if (value === 'custom') return customStrategies.length > 0;
|
||||||
advancedStrategies.length > 0 ||
|
|
||||||
customStrategies.length > 0
|
|
||||||
);
|
|
||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
[isEnterprise, advancedStrategies.length, customStrategies.length],
|
[isEnterprise, advancedStrategies.length, customStrategies.length],
|
||||||
@ -277,19 +275,15 @@ export const FeatureStrategyMenuCards = ({
|
|||||||
setFilter={setFilter}
|
setFilter={setFilter}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{shouldRender('advanced') && (
|
{shouldRender('advanced') && advancedStrategies.length > 0 && (
|
||||||
<>
|
<FeatureStrategyMenuCardsSection title='Advanced strategies'>
|
||||||
{advancedStrategies.length > 0 && (
|
{advancedStrategies.map(renderStrategy)}
|
||||||
<FeatureStrategyMenuCardsSection title='Advanced strategies'>
|
</FeatureStrategyMenuCardsSection>
|
||||||
{advancedStrategies.map(renderStrategy)}
|
)}
|
||||||
</FeatureStrategyMenuCardsSection>
|
{shouldRender('custom') && customStrategies.length > 0 && (
|
||||||
)}
|
<FeatureStrategyMenuCardsSection title='Custom strategies'>
|
||||||
{customStrategies.length > 0 && (
|
{customStrategies.map(renderStrategy)}
|
||||||
<FeatureStrategyMenuCardsSection title='Custom strategies'>
|
</FeatureStrategyMenuCardsSection>
|
||||||
{customStrategies.map(renderStrategy)}
|
|
||||||
</FeatureStrategyMenuCardsSection>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</StyledScrollableContent>
|
</StyledScrollableContent>
|
||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
|
Loading…
Reference in New Issue
Block a user