mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
292d6a7f60
https://linear.app/unleash/issue/2-743/have-a-project-specific-configuration-section ![image](https://user-images.githubusercontent.com/14320932/225657038-1a385e6e-deb3-4229-a30d-e7ca28ef2b3c.png) Adds the "segments" option to project settings, providing the usual CRUD operations but scoped to the specific project.
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { ISegment } from 'interfaces/segment';
|
|
import { Edit } from '@mui/icons-material';
|
|
import PermissionIconButton from 'component/common/PermissionIconButton/PermissionIconButton';
|
|
import { UPDATE_SEGMENT } from 'component/providers/AccessProvider/permissions';
|
|
import { useNavigate } from 'react-router-dom';
|
|
import { useOptionalPathParam } from 'hooks/useOptionalPathParam';
|
|
|
|
interface IEditSegmentButtonProps {
|
|
segment: ISegment;
|
|
}
|
|
|
|
export const EditSegmentButton = ({ segment }: IEditSegmentButtonProps) => {
|
|
const projectId = useOptionalPathParam('projectId');
|
|
const navigate = useNavigate();
|
|
|
|
return (
|
|
<PermissionIconButton
|
|
onClick={() => {
|
|
if (projectId) {
|
|
navigate(
|
|
`/projects/${projectId}/settings/segments/edit/${segment.id}`
|
|
);
|
|
} else {
|
|
navigate(`/segments/edit/${segment.id}`);
|
|
}
|
|
}}
|
|
permission={UPDATE_SEGMENT}
|
|
tooltipProps={{ title: 'Edit segment' }}
|
|
>
|
|
<Edit data-loading />
|
|
</PermissionIconButton>
|
|
);
|
|
};
|