|
1 | 1 | import React from 'react'; |
2 | | -import { Form, Select, Card, Space, Alert } from 'antd'; |
| 2 | +import { Form, Select, Space, Alert } from 'antd'; |
3 | 3 | import { AllowedUsersSettings, AllowedUsersMode, PermissionType, MODE_CONFIGURATIONS, getPermissionLabel } from '@app/types/allowedUsers.types'; |
4 | 4 | import * as S from './PermissionsConfig.styles'; |
5 | 5 |
|
@@ -62,67 +62,54 @@ export const PermissionsConfig: React.FC<PermissionsConfigProps> = ({ |
62 | 62 |
|
63 | 63 | return ( |
64 | 64 | <S.Container> |
65 | | - <Card title="Global Access Permissions" size="small"> |
66 | | - <Space direction="vertical" style={{ width: '100%' }}> |
67 | | - {/* Mode description */} |
68 | | - <Alert |
69 | | - message={`${settings.mode.charAt(0).toUpperCase() + settings.mode.slice(1)} Mode`} |
70 | | - description={modeConfig.description} |
71 | | - type="info" |
72 | | - showIcon |
73 | | - style={{ |
74 | | - backgroundColor: '#25284B', |
75 | | - border: '1px solid #d9d9d9', |
76 | | - color: '#d9d9d9' |
77 | | - }} |
78 | | - /> |
79 | | - |
80 | | - <Form layout="vertical"> |
81 | | - {/* Read Permission */} |
82 | | - <Form.Item |
83 | | - label={<span style={{ color: '#d9d9d9' }}>Read Permission</span>} |
84 | | - help={<span style={{ color: '#d9d9d9' }}>{isReadForced ? "This permission is automatically set based on the selected mode" : "Who can read from this relay"}</span>} |
85 | | - > |
86 | | - <S.ForcedSelectWrapper $isForced={isReadForced}> |
87 | | - <Select |
88 | | - value={settings.read} |
89 | | - onChange={handleReadPermissionChange} |
90 | | - options={readOptions} |
91 | | - disabled={disabled || isReadForced} |
92 | | - placeholder="Select read permission" |
93 | | - /> |
94 | | - </S.ForcedSelectWrapper> |
95 | | - </Form.Item> |
| 65 | + <Space direction="vertical" style={{ width: '100%' }}> |
| 66 | + {/* Mode description */} |
| 67 | + <Alert |
| 68 | + message={`${settings.mode.charAt(0).toUpperCase() + settings.mode.slice(1)} Mode`} |
| 69 | + description={modeConfig.description} |
| 70 | + type="info" |
| 71 | + showIcon |
| 72 | + style={{ |
| 73 | + backgroundColor: '#25284B', |
| 74 | + border: '1px solid #d9d9d9', |
| 75 | + color: '#d9d9d9' |
| 76 | + }} |
| 77 | + /> |
96 | 78 |
|
97 | | - {/* Write Permission */} |
98 | | - <Form.Item |
99 | | - label={<span style={{ color: '#d9d9d9' }}>Write Permission</span>} |
100 | | - help={<span style={{ color: '#d9d9d9' }}>{isWriteForced ? "This permission is automatically set based on the selected mode" : "Who can write to this relay"}</span>} |
101 | | - > |
102 | | - <S.ForcedSelectWrapper $isForced={isWriteForced}> |
103 | | - <Select |
104 | | - value={settings.write} |
105 | | - onChange={handleWritePermissionChange} |
106 | | - options={writeOptions} |
107 | | - disabled={disabled || isWriteForced} |
108 | | - placeholder="Select write permission" |
109 | | - /> |
110 | | - </S.ForcedSelectWrapper> |
111 | | - </Form.Item> |
112 | | - </Form> |
| 79 | + <Form layout="vertical"> |
| 80 | + {/* Read Permission */} |
| 81 | + <Form.Item |
| 82 | + label={<span style={{ color: '#d9d9d9' }}>Read Permission</span>} |
| 83 | + help={<span style={{ color: '#d9d9d9' }}>{isReadForced ? "This permission is automatically set based on the selected mode" : "Who can read from this relay"}</span>} |
| 84 | + > |
| 85 | + <S.ForcedSelectWrapper $isForced={isReadForced}> |
| 86 | + <Select |
| 87 | + value={settings.read} |
| 88 | + onChange={handleReadPermissionChange} |
| 89 | + options={readOptions} |
| 90 | + disabled={disabled || isReadForced} |
| 91 | + placeholder="Select read permission" |
| 92 | + /> |
| 93 | + </S.ForcedSelectWrapper> |
| 94 | + </Form.Item> |
113 | 95 |
|
114 | | - {/* Permission explanations */} |
115 | | - <S.PermissionExplanations> |
116 | | - <h4>Permission Types:</h4> |
117 | | - <ul> |
118 | | - <li><strong>All Users:</strong> Everyone can access (no restrictions)</li> |
119 | | - <li><strong>Paid Users:</strong> Only users with active paid subscriptions</li> |
120 | | - <li><strong>Allowed Users:</strong> Only users in the allowed users list</li> |
121 | | - <li><strong>Only Me:</strong> Only the relay owner can access</li> |
122 | | - </ul> |
123 | | - </S.PermissionExplanations> |
124 | | - </Space> |
125 | | - </Card> |
| 96 | + {/* Write Permission */} |
| 97 | + <Form.Item |
| 98 | + label={<span style={{ color: '#d9d9d9' }}>Write Permission</span>} |
| 99 | + help={<span style={{ color: '#d9d9d9' }}>{isWriteForced ? "This permission is automatically set based on the selected mode" : "Who can write to this relay"}</span>} |
| 100 | + > |
| 101 | + <S.ForcedSelectWrapper $isForced={isWriteForced}> |
| 102 | + <Select |
| 103 | + value={settings.write} |
| 104 | + onChange={handleWritePermissionChange} |
| 105 | + options={writeOptions} |
| 106 | + disabled={disabled || isWriteForced} |
| 107 | + placeholder="Select write permission" |
| 108 | + /> |
| 109 | + </S.ForcedSelectWrapper> |
| 110 | + </Form.Item> |
| 111 | + </Form> |
| 112 | + </Space> |
126 | 113 | </S.Container> |
127 | 114 | ); |
128 | 115 | }; |
0 commit comments