@@ -15,7 +15,7 @@ import {
15
15
makeStyles ,
16
16
Radio ,
17
17
RadioGroup ,
18
- TextField ,
18
+ TextField , Theme ,
19
19
Typography ,
20
20
} from '@material-ui/core'
21
21
import MuiDialogTitle from '@material-ui/core/DialogTitle'
@@ -30,6 +30,8 @@ import { AiModel } from "../../../types/api/entities/bot";
30
30
import settings from "../../../utils/settings" ;
31
31
import { Link } from "@postgres.ai/shared/components/Link2" ;
32
32
import { ExternalIcon } from "@postgres.ai/shared/icons/External" ;
33
+ import Divider from "@material-ui/core/Divider" ;
34
+ import cn from "classnames" ;
33
35
34
36
type DialogTitleProps = {
35
37
id : string
@@ -123,35 +125,30 @@ const DialogActions = (props: { children: React.ReactNode }) => {
123
125
)
124
126
}
125
127
126
- const useDialogStyles = makeStyles (
127
- ( ) => ( {
128
+ const useDialogStyles = makeStyles < Theme > (
129
+ ( theme ) => ( {
128
130
textField : {
129
131
...styles . inputField ,
130
132
marginTop : '0px' ,
131
133
width : 480 ,
134
+ [ theme . breakpoints . down ( 'sm' ) ] : {
135
+
136
+ }
132
137
} ,
133
138
copyButton : {
134
139
marginTop : '-3px' ,
135
140
fontSize : '20px' ,
136
141
} ,
137
- dialog : { } ,
138
- remark : {
139
- fontSize : 12 ,
140
- lineHeight : '12px' ,
141
-
142
- paddingLeft : 20 ,
143
- paddingBottom : 5 ,
144
- } ,
145
- remarkIcon : {
146
- display : 'block' ,
147
- height : '20px' ,
148
- width : '22px' ,
149
- float : 'left' ,
150
- paddingTop : '5px' ,
151
- } ,
152
142
urlContainer : {
153
- marginTop : 10 ,
154
- paddingLeft : 22 ,
143
+ marginTop : 8 ,
144
+ paddingLeft : 20 ,
145
+ [ theme . breakpoints . down ( 'sm' ) ] : {
146
+ padding : 0 ,
147
+ width : '100%' ,
148
+ '& .MuiTextField-root' : {
149
+ maxWidth : 'calc(100% - 36px)'
150
+ }
151
+ } ,
155
152
} ,
156
153
radioGroup : {
157
154
fontSize : 12 ,
@@ -170,16 +167,34 @@ const useDialogStyles = makeStyles(
170
167
marginBottom : 0
171
168
}
172
169
} ,
170
+ unlockNoteDemo : {
171
+ paddingLeft : 20
172
+ } ,
173
173
formControlLabel : {
174
174
'& .Mui-disabled > *, & .Mui-disabled' : {
175
175
color : 'rgba(0, 0, 0, 0.6)'
176
+ } ,
177
+ [ theme . breakpoints . down ( 'sm' ) ] : {
178
+ marginRight : 0 ,
179
+ alignItems : 'flex-start' ,
180
+ '&:first-child' : {
181
+ marginTop : 6
182
+ }
183
+ } ,
184
+ } ,
185
+ formControlLabelRadio : {
186
+ [ theme . breakpoints . down ( 'sm' ) ] : {
187
+ padding : '4px 9px'
176
188
}
177
189
} ,
178
190
externalIcon : {
179
191
width : 14 ,
180
192
height : 14 ,
181
193
marginLeft : 4 ,
182
194
transform : 'translateY(2px)' ,
195
+ } ,
196
+ divider : {
197
+ margin : '12px 0'
183
198
}
184
199
} ) ,
185
200
{ index : 1 } ,
@@ -295,8 +310,8 @@ export const SettingsDialog = (props: PublicChatDialogProps) => {
295
310
< >
296
311
< FormLabel component = "legend" > Visibility</ FormLabel >
297
312
< RadioGroup
298
- aria-label = "shareUrl "
299
- name = "shareUrl "
313
+ aria-label = "Thread visibility "
314
+ name = "threadVisibility "
300
315
value = { visibility }
301
316
onChange = { ( event ) => {
302
317
setVisibility ( event . target . value as Visibility )
@@ -306,20 +321,22 @@ export const SettingsDialog = (props: PublicChatDialogProps) => {
306
321
< FormControlLabel
307
322
value = { Visibility . PUBLIC }
308
323
className = { classes . formControlLabel }
309
- control = { < Radio /> }
324
+ control = { < Radio className = { classes . formControlLabelRadio } /> }
310
325
label = { < > < b > Public:</ b > anyone can view chats, but only team members can respond</ > }
326
+ aria-label = "Public: anyone can view chats, but only team members can respond"
311
327
/>
312
328
{ visibility === Visibility . PUBLIC && threadId && (
313
329
< div className = { classes . urlContainer } > { urlField } </ div >
314
330
) }
315
331
< FormControlLabel
316
332
value = { Visibility . PRIVATE }
317
333
className = { classes . formControlLabel }
318
- control = { < Radio /> }
334
+ control = { < Radio className = { classes . formControlLabelRadio } /> }
319
335
label = { < > < b > Private:</ b > chats are visible only to members of your organization</ > }
336
+ aria-label = "Private: chats are visible only to members of your organization"
320
337
disabled = { Boolean ( isDemoOrg ) || ! isSubscriber }
321
338
/>
322
- { Boolean ( isDemoOrg ) && < Typography className = { classes . remark } > Private chats are not allowed in "Demo"</ Typography > }
339
+ { Boolean ( isDemoOrg ) && < Typography className = { cn ( classes . unlockNote , classes . unlockNoteDemo ) } > Private chats are not allowed in "Demo"</ Typography > }
323
340
{ ! Boolean ( isDemoOrg ) && ! isSubscriber && < Typography variant = "body2" className = { classes . unlockNote } >
324
341
Unlock private conversations by either:
325
342
< ol >
@@ -339,29 +356,6 @@ export const SettingsDialog = (props: PublicChatDialogProps) => {
339
356
</ Typography > }
340
357
</ RadioGroup >
341
358
</ >
342
- { aiModels && < >
343
- < FormLabel component = "legend" > Model</ FormLabel >
344
- < RadioGroup
345
- aria-label = "model"
346
- name = "model"
347
- value = { `${ model ?. vendor } /${ model ?. name } ` }
348
- onChange = { ( event ) => {
349
- const selectedModel = aiModels ?. find ( ( model ) => `${ model . vendor } /${ model . name } ` === event . target . value )
350
- setModel ( selectedModel ! )
351
- } }
352
- className = { classes . radioGroup }
353
- >
354
- { aiModels . map ( ( model ) =>
355
- < FormControlLabel
356
- key = { `${ model . vendor } /${ model . name } ` }
357
- value = { `${ model . vendor } /${ model . name } ` }
358
- control = { < Radio /> }
359
- label = { `${ model . name } ${ model . comment ? model . comment : '' } ` }
360
- />
361
- )
362
- }
363
- </ RadioGroup >
364
- </ > }
365
359
</ DialogContent >
366
360
367
361
< DialogActions >
0 commit comments