|
7 | 7 | Icon, |
8 | 8 | Field, |
9 | 9 | ToggleSwitch, |
| 10 | + FieldGroup, |
10 | 11 | } from '@rocket.chat/fuselage'; |
11 | 12 | import { useDebouncedCallback } from '@rocket.chat/fuselage-hooks'; |
12 | 13 | import React, { useEffect, useMemo, useState } from 'react'; |
@@ -77,92 +78,94 @@ const CreateChannel = ({ |
77 | 78 | <Modal.Close onClick={onClose} /> |
78 | 79 | </Modal.Header> |
79 | 80 | <Modal.Content> |
80 | | - <Field mbe='x24'> |
81 | | - <Field.Label>{t('Name')}</Field.Label> |
82 | | - <Field.Row> |
83 | | - <TextInput |
84 | | - error={hasUnsavedChanges ? nameError : undefined} |
85 | | - addon={<Icon name={values.type ? 'lock' : 'hash'} size='x20' />} |
86 | | - placeholder={t('Channel_name')} |
87 | | - onChange={handlers.handleName} |
88 | | - /> |
89 | | - </Field.Row> |
90 | | - {hasUnsavedChanges && nameError && <Field.Error>{nameError}</Field.Error>} |
91 | | - </Field> |
92 | | - <Field mbe='x24'> |
93 | | - <Field.Label> |
94 | | - {t('Topic')}{' '} |
95 | | - <Box is='span' color='neutral-600'> |
96 | | - ({t('optional')}) |
| 81 | + <FieldGroup> |
| 82 | + <Field> |
| 83 | + <Field.Label>{t('Name')}</Field.Label> |
| 84 | + <Field.Row> |
| 85 | + <TextInput |
| 86 | + error={hasUnsavedChanges ? nameError : undefined} |
| 87 | + addon={<Icon name={values.type ? 'lock' : 'hash'} size='x20' />} |
| 88 | + placeholder={t('Channel_name')} |
| 89 | + onChange={handlers.handleName} |
| 90 | + /> |
| 91 | + </Field.Row> |
| 92 | + {hasUnsavedChanges && nameError && <Field.Error>{nameError}</Field.Error>} |
| 93 | + </Field> |
| 94 | + <Field> |
| 95 | + <Field.Label> |
| 96 | + {t('Topic')}{' '} |
| 97 | + <Box is='span' color='neutral-600'> |
| 98 | + ({t('optional')}) |
| 99 | + </Box> |
| 100 | + </Field.Label> |
| 101 | + <Field.Row> |
| 102 | + <TextInput |
| 103 | + placeholder={t('Channel_what_is_this_channel_about')} |
| 104 | + onChange={handlers.handleDescription} |
| 105 | + /> |
| 106 | + </Field.Row> |
| 107 | + </Field> |
| 108 | + <Field> |
| 109 | + <Box display='flex' justifyContent='space-between' alignItems='start'> |
| 110 | + <Box display='flex' flexDirection='column' width='full'> |
| 111 | + <Field.Label>{t('Private')}</Field.Label> |
| 112 | + <Field.Description> |
| 113 | + {values.type |
| 114 | + ? t('Only_invited_users_can_acess_this_channel') |
| 115 | + : t('Everyone_can_access_this_channel')} |
| 116 | + </Field.Description> |
| 117 | + </Box> |
| 118 | + <ToggleSwitch |
| 119 | + checked={values.type} |
| 120 | + disabled={!!canOnlyCreateOneType} |
| 121 | + onChange={onChangeType} |
| 122 | + /> |
97 | 123 | </Box> |
98 | | - </Field.Label> |
99 | | - <Field.Row> |
100 | | - <TextInput |
101 | | - placeholder={t('Channel_what_is_this_channel_about')} |
102 | | - onChange={handlers.handleDescription} |
103 | | - /> |
104 | | - </Field.Row> |
105 | | - </Field> |
106 | | - <Field mbe='x24'> |
107 | | - <Box display='flex' justifyContent='space-between' alignItems='start'> |
108 | | - <Box display='flex' flexDirection='column'> |
109 | | - <Field.Label>{t('Private')}</Field.Label> |
110 | | - <Field.Description> |
111 | | - {values.type |
112 | | - ? t('Only_invited_users_can_acess_this_channel') |
113 | | - : t('Everyone_can_access_this_channel')} |
114 | | - </Field.Description> |
| 124 | + </Field> |
| 125 | + <Field> |
| 126 | + <Box display='flex' justifyContent='space-between' alignItems='start'> |
| 127 | + <Box display='flex' flexDirection='column' width='full'> |
| 128 | + <Field.Label>{t('Read_only')}</Field.Label> |
| 129 | + <Field.Description> |
| 130 | + {t('All_users_in_the_channel_can_write_new_messages')} |
| 131 | + </Field.Description> |
| 132 | + </Box> |
| 133 | + <ToggleSwitch |
| 134 | + checked={values.readOnly} |
| 135 | + disabled={values.broadcast} |
| 136 | + onChange={handlers.handleReadOnly} |
| 137 | + /> |
115 | 138 | </Box> |
116 | | - <ToggleSwitch |
117 | | - checked={values.type} |
118 | | - disabled={!!canOnlyCreateOneType} |
119 | | - onChange={onChangeType} |
120 | | - /> |
121 | | - </Box> |
122 | | - </Field> |
123 | | - <Field mbe='x24'> |
124 | | - <Box display='flex' justifyContent='space-between' alignItems='start'> |
125 | | - <Box display='flex' flexDirection='column'> |
126 | | - <Field.Label>{t('Read_only')}</Field.Label> |
127 | | - <Field.Description> |
128 | | - {t('All_users_in_the_channel_can_write_new_messages')} |
129 | | - </Field.Description> |
| 139 | + </Field> |
| 140 | + <Field> |
| 141 | + <Box display='flex' justifyContent='space-between' alignItems='start'> |
| 142 | + <Box display='flex' flexDirection='column' width='full'> |
| 143 | + <Field.Label>{t('Encrypted')}</Field.Label> |
| 144 | + <Field.Description> |
| 145 | + {values.type ? t('Encrypted_channel_Description') : t('Encrypted_not_available')} |
| 146 | + </Field.Description> |
| 147 | + </Box> |
| 148 | + <ToggleSwitch |
| 149 | + checked={values.encrypted} |
| 150 | + disabled={e2edisabled} |
| 151 | + onChange={handlers.handleEncrypted} |
| 152 | + /> |
130 | 153 | </Box> |
131 | | - <ToggleSwitch |
132 | | - checked={values.readOnly} |
133 | | - disabled={values.broadcast} |
134 | | - onChange={handlers.handleReadOnly} |
135 | | - /> |
136 | | - </Box> |
137 | | - </Field> |
138 | | - <Field mbe='x24'> |
139 | | - <Box display='flex' justifyContent='space-between' alignItems='start'> |
140 | | - <Box display='flex' flexDirection='column'> |
141 | | - <Field.Label>{t('Encrypted')}</Field.Label> |
142 | | - <Field.Description> |
143 | | - {values.type ? t('Encrypted_channel_Description') : t('Encrypted_not_available')} |
144 | | - </Field.Description> |
| 154 | + </Field> |
| 155 | + <Field> |
| 156 | + <Box display='flex' justifyContent='space-between' alignItems='start'> |
| 157 | + <Box display='flex' flexDirection='column' width='full'> |
| 158 | + <Field.Label>{t('Broadcast')}</Field.Label> |
| 159 | + <Field.Description>{t('Broadcast_channel_Description')}</Field.Description> |
| 160 | + </Box> |
| 161 | + <ToggleSwitch checked={values.broadcast} onChange={onChangeBroadcast} /> |
145 | 162 | </Box> |
146 | | - <ToggleSwitch |
147 | | - checked={values.encrypted} |
148 | | - disabled={e2edisabled} |
149 | | - onChange={handlers.handleEncrypted} |
150 | | - /> |
151 | | - </Box> |
152 | | - </Field> |
153 | | - <Field mbe='x24'> |
154 | | - <Box display='flex' justifyContent='space-between' alignItems='start'> |
155 | | - <Box display='flex' flexDirection='column'> |
156 | | - <Field.Label>{t('Broadcast')}</Field.Label> |
157 | | - <Field.Description>{t('Broadcast_channel_Description')}</Field.Description> |
158 | | - </Box> |
159 | | - <ToggleSwitch checked={values.broadcast} onChange={onChangeBroadcast} /> |
160 | | - </Box> |
161 | | - </Field> |
162 | | - <Field mbe='x24'> |
163 | | - <Field.Label>{`${t('Add_members')} (${t('optional')})`}</Field.Label> |
164 | | - <UserAutoCompleteMultiple value={values.users} onChange={onChangeUsers} /> |
165 | | - </Field> |
| 163 | + </Field> |
| 164 | + <Field> |
| 165 | + <Field.Label>{`${t('Add_members')} (${t('optional')})`}</Field.Label> |
| 166 | + <UserAutoCompleteMultiple value={values.users} onChange={onChangeUsers} /> |
| 167 | + </Field> |
| 168 | + </FieldGroup> |
166 | 169 | </Modal.Content> |
167 | 170 | <Modal.Footer> |
168 | 171 | <ButtonGroup align='end'> |
|
0 commit comments