1
1
import type { AuthorizationResponse , Organization } from "api/typesGenerated" ;
2
2
import { Loader } from "components/Loader/Loader" ;
3
- import { Margins } from "components/Margins/Margins" ;
4
- import { Stack } from "components/Stack/Stack" ;
5
3
import { useAuthenticated } from "contexts/auth/RequireAuth" ;
6
4
import { RequirePermission } from "contexts/auth/RequirePermission" ;
7
5
import { useDashboard } from "modules/dashboard/useDashboard" ;
8
6
import { type FC , Suspense , createContext , useContext } from "react" ;
9
7
import { Outlet , useParams } from "react-router-dom" ;
10
- import { Sidebar } from "./Sidebar " ;
8
+ import { OrganizationSidebar } from "./OrganizationSidebar " ;
11
9
12
- export const ManagementSettingsContext = createContext <
13
- ManagementSettingsValue | undefined
10
+ export const OrganizationSettingsContext = createContext <
11
+ OrganizationSettingsValue | undefined
14
12
> ( undefined ) ;
15
13
16
- type ManagementSettingsValue = Readonly < {
14
+ type OrganizationSettingsValue = Readonly < {
17
15
organizations : readonly Organization [ ] ;
18
16
organization ?: Organization ;
19
17
} > ;
20
18
21
- export const useManagementSettings = ( ) : ManagementSettingsValue => {
22
- const context = useContext ( ManagementSettingsContext ) ;
19
+ export const useOrganizationSettings = ( ) : OrganizationSettingsValue => {
20
+ const context = useContext ( OrganizationSettingsContext ) ;
23
21
if ( ! context ) {
24
22
throw new Error (
25
- "useManagementSettings should be used inside of ManagementSettingsLayout " ,
23
+ "useOrganizationSettings should be used inside of OrganizationSettingsLayout " ,
26
24
) ;
27
25
}
28
26
@@ -43,47 +41,41 @@ export const canEditOrganization = (
43
41
) ;
44
42
} ;
45
43
46
- const ManagementSettingsLayout : FC = ( ) => {
44
+ const OrganizationSettingsLayout : FC = ( ) => {
47
45
const { permissions } = useAuthenticated ( ) ;
48
46
const { organizations } = useDashboard ( ) ;
49
47
const { organization : orgName } = useParams ( ) as {
50
48
organization ?: string ;
51
49
} ;
52
50
53
- // The deployment settings page also contains users, audit logs, groups and
54
- // organizations, so this page must be visible if you can see any of these.
55
- const canViewDeploymentSettingsPage =
56
- permissions . viewDeploymentValues ||
57
- permissions . viewAllUsers ||
58
- permissions . editAnyOrganization ||
59
- permissions . viewAnyAuditLog ;
51
+ const canViewOrganizationSettingsPage = permissions . editAnyOrganization ;
60
52
61
53
const organization =
62
54
organizations && orgName
63
55
? organizations . find ( ( org ) => org . name === orgName )
64
56
: undefined ;
65
57
66
58
return (
67
- < RequirePermission isFeatureVisible = { canViewDeploymentSettingsPage } >
68
- < ManagementSettingsContext . Provider
59
+ < RequirePermission isFeatureVisible = { canViewOrganizationSettingsPage } >
60
+ < OrganizationSettingsContext . Provider
69
61
value = { {
70
62
organizations,
71
63
organization,
72
64
} }
73
65
>
74
- < Margins >
75
- < Stack css = { { padding : "48px 0" } } direction = "row" spacing = { 6 } >
76
- < Sidebar />
66
+ < div className = "px-10 max-w-screen-2xl" >
67
+ < div className = "flex flex-row gap-12 py-10" >
68
+ < OrganizationSidebar />
77
69
< main css = { { flexGrow : 1 } } >
78
70
< Suspense fallback = { < Loader /> } >
79
71
< Outlet />
80
72
</ Suspense >
81
73
</ main >
82
- </ Stack >
83
- </ Margins >
84
- </ ManagementSettingsContext . Provider >
74
+ </ div >
75
+ </ div >
76
+ </ OrganizationSettingsContext . Provider >
85
77
</ RequirePermission >
86
78
) ;
87
79
} ;
88
80
89
- export default ManagementSettingsLayout ;
81
+ export default OrganizationSettingsLayout ;
0 commit comments