mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
clean(feature-list): remove ternary if in jsx
This commit is contained in:
parent
aaf4243b24
commit
a7a7201590
@ -22,6 +22,7 @@ exports[`renders correctly with one feature 1`] = `
|
||||
>
|
||||
<react-mdl-Switch
|
||||
checked={false}
|
||||
disabled={true}
|
||||
onChange={[Function]}
|
||||
title="Toggle Another"
|
||||
/>
|
||||
|
@ -16,10 +16,8 @@ const Feature = ({
|
||||
revive,
|
||||
}) => {
|
||||
const { name, description, enabled, strategies } = feature;
|
||||
|
||||
const { showLastHour = false } = settings;
|
||||
const isStale = showLastHour ? metricsLastHour.isFallback : metricsLastMinute.isFallback;
|
||||
|
||||
const percent =
|
||||
1 *
|
||||
(showLastHour
|
||||
@ -28,7 +26,6 @@ const Feature = ({
|
||||
|
||||
const strategiesToShow = Math.min(strategies.length, 3);
|
||||
const remainingStrategies = strategies.length - strategiesToShow;
|
||||
|
||||
const strategyChips =
|
||||
strategies &&
|
||||
strategies.slice(0, strategiesToShow).map((s, i) => (
|
||||
@ -37,55 +34,26 @@ const Feature = ({
|
||||
</Chip>
|
||||
));
|
||||
const summaryChip = remainingStrategies > 0 && <Chip className={styles.strategyChip}>+{remainingStrategies}</Chip>;
|
||||
|
||||
const featureUrl = toggleFeature === undefined ? `/archive/strategies/${name}` : `/features/strategies/${name}`;
|
||||
return (
|
||||
<ListItem twoLine>
|
||||
<span className={styles.listItemMetric}>
|
||||
<Progress strokeWidth={15} percentage={percent} isFallback={isStale} />
|
||||
</span>
|
||||
{toggleFeature ? ( // display feature list, toggleFeature is available
|
||||
<span className={styles.listItemToggle}>
|
||||
<Switch
|
||||
title={`Toggle ${name}`}
|
||||
key="left-actions"
|
||||
onChange={() => toggleFeature(name)}
|
||||
checked={enabled}
|
||||
/>
|
||||
</span>
|
||||
) : (
|
||||
// display archive, toggleFeature is undefined
|
||||
<span className={styles.listItemToggle}>
|
||||
<Switch
|
||||
disabled
|
||||
title={`Toggle ${name}`}
|
||||
key="left-actions"
|
||||
onChange={() => toggleFeature(name)}
|
||||
checked={enabled}
|
||||
/>
|
||||
</span>
|
||||
)}
|
||||
<span className={styles.listItemToggle}>
|
||||
<Switch
|
||||
disabled={toggleFeature !== undefined}
|
||||
title={`Toggle ${name}`}
|
||||
key="left-actions"
|
||||
onChange={() => toggleFeature(name)}
|
||||
checked={enabled}
|
||||
/>
|
||||
</span>
|
||||
<span className={['mdl-list__item-primary-content', styles.listItemLink].join(' ')}>
|
||||
{toggleFeature ? ( // display feature list, toggleFeature is available
|
||||
<Link
|
||||
to={`/features/strategies/${name}`}
|
||||
className={[commonStyles.listLink, commonStyles.truncate].join(' ')}
|
||||
>
|
||||
{name}
|
||||
<span className={['mdl-list__item-sub-title', commonStyles.truncate].join(' ')}>
|
||||
{description}
|
||||
</span>
|
||||
</Link>
|
||||
) : (
|
||||
<Link
|
||||
to={`/archive/strategies/${name}`}
|
||||
className={[commonStyles.listLink, commonStyles.truncate].join(' ')}
|
||||
>
|
||||
{name}
|
||||
<span className={['mdl-list__item-sub-title', commonStyles.truncate].join(' ')}>
|
||||
{description}
|
||||
</span>
|
||||
</Link>
|
||||
)}
|
||||
<Link to={featureUrl} className={[commonStyles.listLink, commonStyles.truncate].join(' ')}>
|
||||
{name}
|
||||
<span className={['mdl-list__item-sub-title', commonStyles.truncate].join(' ')}>{description}</span>
|
||||
</Link>
|
||||
</span>
|
||||
<span className={[styles.listItemStrategies, commonStyles.hideLt920].join(' ')}>
|
||||
{strategyChips}
|
||||
|
Loading…
Reference in New Issue
Block a user