@@ -15,7 +15,7 @@ import {
1515 makeStyles ,
1616 Radio ,
1717 RadioGroup ,
18- TextField ,
18+ TextField , Theme ,
1919 Typography ,
2020} from '@material-ui/core'
2121import MuiDialogTitle from '@material-ui/core/DialogTitle'
@@ -30,6 +30,8 @@ import { AiModel } from "../../../types/api/entities/bot";
3030import settings from "../../../utils/settings" ;
3131import { Link } from "@postgres.ai/shared/components/Link2" ;
3232import { ExternalIcon } from "@postgres.ai/shared/icons/External" ;
33+ import Divider from "@material-ui/core/Divider" ;
34+ import cn from "classnames" ;
3335
3436type DialogTitleProps = {
3537 id : string
@@ -123,35 +125,30 @@ const DialogActions = (props: { children: React.ReactNode }) => {
123125 )
124126}
125127
126- const useDialogStyles = makeStyles (
127- ( ) => ( {
128+ const useDialogStyles = makeStyles < Theme > (
129+ ( theme ) => ( {
128130 textField : {
129131 ...styles . inputField ,
130132 marginTop : '0px' ,
131133 width : 480 ,
134+ [ theme . breakpoints . down ( 'sm' ) ] : {
135+
136+ }
132137 } ,
133138 copyButton : {
134139 marginTop : '-3px' ,
135140 fontSize : '20px' ,
136141 } ,
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- } ,
152142 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+ } ,
155152 } ,
156153 radioGroup : {
157154 fontSize : 12 ,
@@ -170,16 +167,34 @@ const useDialogStyles = makeStyles(
170167 marginBottom : 0
171168 }
172169 } ,
170+ unlockNoteDemo : {
171+ paddingLeft : 20
172+ } ,
173173 formControlLabel : {
174174 '& .Mui-disabled > *, & .Mui-disabled' : {
175175 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'
176188 }
177189 } ,
178190 externalIcon : {
179191 width : 14 ,
180192 height : 14 ,
181193 marginLeft : 4 ,
182194 transform : 'translateY(2px)' ,
195+ } ,
196+ divider : {
197+ margin : '12px 0'
183198 }
184199 } ) ,
185200 { index : 1 } ,
@@ -295,8 +310,8 @@ export const SettingsDialog = (props: PublicChatDialogProps) => {
295310 < >
296311 < FormLabel component = "legend" > Visibility</ FormLabel >
297312 < RadioGroup
298- aria-label = "shareUrl "
299- name = "shareUrl "
313+ aria-label = "Thread visibility "
314+ name = "threadVisibility "
300315 value = { visibility }
301316 onChange = { ( event ) => {
302317 setVisibility ( event . target . value as Visibility )
@@ -306,20 +321,22 @@ export const SettingsDialog = (props: PublicChatDialogProps) => {
306321 < FormControlLabel
307322 value = { Visibility . PUBLIC }
308323 className = { classes . formControlLabel }
309- control = { < Radio /> }
324+ control = { < Radio className = { classes . formControlLabelRadio } /> }
310325 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"
311327 />
312328 { visibility === Visibility . PUBLIC && threadId && (
313329 < div className = { classes . urlContainer } > { urlField } </ div >
314330 ) }
315331 < FormControlLabel
316332 value = { Visibility . PRIVATE }
317333 className = { classes . formControlLabel }
318- control = { < Radio /> }
334+ control = { < Radio className = { classes . formControlLabelRadio } /> }
319335 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"
320337 disabled = { Boolean ( isDemoOrg ) || ! isSubscriber }
321338 />
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 > }
323340 { ! Boolean ( isDemoOrg ) && ! isSubscriber && < Typography variant = "body2" className = { classes . unlockNote } >
324341 Unlock private conversations by either:
325342 < ol >
@@ -339,29 +356,6 @@ export const SettingsDialog = (props: PublicChatDialogProps) => {
339356 </ Typography > }
340357 </ RadioGroup >
341358 </ >
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- </ > }
365359 </ DialogContent >
366360
367361 < DialogActions >
0 commit comments