1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00
unleash.unleash/frontend/src/component/feature/FeatureView2/FeatureOverview/FeatureOverviewMetaData/FeatureOverviewMetaData.tsx
Fredrik Strand Oseberg 37b818fce4 Feat/feature toggle view tags (#399)
* feat: new tags

* feat: archive

* wip: variants

* add support for deletion, variable/fixed weight toggle and weight editing

* Add confirmation dialogue for deleting variants

* feat: settings

* fix: recalculate on project name change

* feat: feature environment metrics

* feat: environment

* Add toggle for stale

* fix: refetch on create strategy

* fix: lint

* fix: update snapshots

* fix: add link to icon button

* fix: revert test user

* fix: increase size!

* fix: use permission attr for ResponsiveButton

* fix: dev dependency

* fix: theme

* fix: stale style

* Update src/component/feature/FeatureView2/FeatureSettings/FeatureSettingsMetadata/FeatureTypeSelect/FeatureTypeSelect.tsx

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>

* Update src/component/feature/FeatureView2/FeatureVariants/FeatureVariantsList/FeatureVariantsList.tsx

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>

* Update src/component/feature/FeatureView2/FeatureVariants/FeatureVariantsList/FeatureVariantsListItem/useDeleteVariantMarkup.tsx

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Christopher Kolstad <git@chriswk.no>
2021-10-08 11:23:29 +02:00

69 lines
2.7 KiB
TypeScript

import { capitalize, IconButton } from '@material-ui/core';
import classnames from 'classnames';
import { useParams } from 'react-router-dom';
import { Link } from 'react-router-dom';
import useFeature from '../../../../../hooks/api/getters/useFeature/useFeature';
import { getFeatureTypeIcons } from '../../../../../utils/get-feature-type-icons';
import ConditionallyRender from '../../../../common/ConditionallyRender';
import { useStyles } from './FeatureOverviewMetadata.styles';
import { Edit } from '@material-ui/icons';
import { IFeatureViewParams } from '../../../../../interfaces/params';
const FeatureOverviewMetaData = () => {
const styles = useStyles();
const { projectId, featureId } = useParams<IFeatureViewParams>();
const { feature } = useFeature(projectId, featureId);
const { project, description, type } = feature;
const IconComponent = getFeatureTypeIcons(type);
return (
<div className={classnames(styles.container)}>
<div className={styles.metaDataHeader}>
<IconComponent className={styles.headerIcon} />{' '}
<h3 className={styles.header}>
{capitalize(type || '')} toggle
</h3>
</div>
<div className={styles.body}>
<span className={styles.bodyItem}>Project: {project}</span>
<ConditionallyRender
condition={description}
show={
<span className={styles.bodyItem}>
<div>Description:</div>
<div className={styles.descriptionContainer}>
<p>{description}</p>
<IconButton
component={Link}
to={`/projects/${projectId}/features2/${featureId}/settings`}
>
<Edit />
</IconButton>
</div>
</span>
}
elseShow={
<span>
<div className={styles.descriptionContainer}>
No description.{' '}
<IconButton
component={Link}
to={`/projects/${projectId}/features2/${featureId}/settings`}
>
<Edit />
</IconButton>
</div>
</span>
}
/>
</div>
</div>
);
};
export default FeatureOverviewMetaData;