1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-13 11:17:26 +02:00
unleash.unleash/frontend/src/component/project/ProjectAccess/ProjectAccess.tsx
Thomas Heartman bbe389d19e
chore: re-order project settings menu (#8626)
This PR re-orders the project settings menu according to the new design.
It also renames pages as specified. It does *not* add the new
"applications and sdks" link because we don't have that page yet.

I have not put this change behind a flag, because it's not a new feature
and doesn't really change the user experience. However, I'd be happy to
flag it if you think that's better.


![image](https://github.com/user-attachments/assets/42dc3348-e873-49b2-9bd7-8c3b3f4a2532)


The header for the user access tab has also been updated:

![image](https://github.com/user-attachments/assets/7c61da17-2b28-4f39-a9d4-83d9ec1903cd)
2024-11-01 09:29:25 +00:00

47 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { useContext } from 'react';
import { PageContent } from 'component/common/PageContent/PageContent';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { Alert } from '@mui/material';
import { PageHeader } from 'component/common/PageHeader/PageHeader';
import AccessContext from 'contexts/AccessContext';
import {
PROJECT_USER_ACCESS_READ,
UPDATE_PROJECT,
} from 'component/providers/AccessProvider/permissions';
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
import { usePageTitle } from 'hooks/usePageTitle';
import { ProjectAccessTable } from 'component/project/ProjectAccess/ProjectAccessTable/ProjectAccessTable';
import { PremiumFeature } from 'component/common/PremiumFeature/PremiumFeature';
import { useProjectOverviewNameOrId } from 'hooks/api/getters/useProjectOverview/useProjectOverview';
export const ProjectAccess = () => {
const projectId = useRequiredPathParam('projectId');
const projectName = useProjectOverviewNameOrId(projectId);
const { hasAccess } = useContext(AccessContext);
const { isOss } = useUiConfig();
usePageTitle(`Project access ${projectName}`);
if (isOss()) {
return (
<PageContent
header={<PageHeader title='User access' />}
sx={{ justifyContent: 'center' }}
>
<PremiumFeature feature='access' />
</PageContent>
);
}
if (!hasAccess([UPDATE_PROJECT, PROJECT_USER_ACCESS_READ], projectId)) {
return (
<PageContent header={<PageHeader title='User access' />}>
<Alert severity='error'>
You need project owner permissions to access this section.
</Alert>
</PageContent>
);
}
return <ProjectAccessTable />;
};