mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: only show link to create segment if you have permission (#2291)
This commit is contained in:
parent
9201f4f08f
commit
ce6d2e56bc
@ -1,9 +1,14 @@
|
|||||||
import { Typography } from '@mui/material';
|
import { Typography } from '@mui/material';
|
||||||
import { useStyles } from 'component/segments/SegmentEmpty/SegmentEmpty.styles';
|
import { useStyles } from 'component/segments/SegmentEmpty/SegmentEmpty.styles';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { CREATE_SEGMENT } from 'component/providers/AccessProvider/permissions';
|
||||||
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
|
import AccessContext from 'contexts/AccessContext';
|
||||||
|
import { useContext } from 'react';
|
||||||
|
|
||||||
export const SegmentEmpty = () => {
|
export const SegmentEmpty = () => {
|
||||||
const { classes } = useStyles();
|
const { classes } = useStyles();
|
||||||
|
const { hasAccess } = useContext(AccessContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.empty}>
|
<div className={classes.empty}>
|
||||||
@ -13,9 +18,14 @@ export const SegmentEmpty = () => {
|
|||||||
your feature. The segment is often a collection of constraints
|
your feature. The segment is often a collection of constraints
|
||||||
and can be reused.
|
and can be reused.
|
||||||
</p>
|
</p>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={hasAccess(CREATE_SEGMENT)}
|
||||||
|
show={
|
||||||
<Link to="/segments/create" className={classes.paramButton}>
|
<Link to="/segments/create" className={classes.paramButton}>
|
||||||
Create your first segment
|
Create your first segment
|
||||||
</Link>
|
</Link>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user