forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPermissionEditor.tsx
More file actions
46 lines (43 loc) · 1.75 KB
/
Copy pathPermissionEditor.tsx
File metadata and controls
46 lines (43 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react';
import { SubuserPermission } from '@/state/server/subusers';
import { useStoreState } from 'easy-peasy';
import { ApplicationStore } from '@/state';
import { useTranslation } from 'react-i18next';
interface Props {
defaultPermissions: SubuserPermission[];
}
export default ({ defaultPermissions }: Props) => {
const { t } = useTranslation('server.users');
const permissions = useStoreState((state: ApplicationStore) => state.permissions.data);
return (
<div>
{
permissions.map(permission => (
<div className={'flex mb-2'} key={permission}>
<input
id={`permission_${permission}`}
type={'checkbox'}
name={'permissions[]'}
value={permission}
defaultChecked={defaultPermissions.indexOf(permission) >= 0}
/>
<label
htmlFor={`permission_${permission}`}
className={'flex-1 ml-3 text-sm text-neutral-200 cursor-pointer'}
>
{permission}
<p className={'text-xs text-neutral-300'} style={{ textTransform: 'none' }}>
{t(`server.users:permissions.${permission.replace('.', '_')}`)}
</p>
</label>
</div>
))
}
<div className={'mt-4 flex justify-end'}>
<button className={'btn btn-primary btn-sm'}>
Save Changes
</button>
</div>
</div>
);
};