Skip to content

Commit fa992b9

Browse files
create settings modal
1 parent cdf7ce2 commit fa992b9

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

src/client/components/ChatV2/ChatV2.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ import { Message } from '../../types'
99
import useRetryTimeout from '../../hooks/useRetryTimeout'
1010
import { useTranslation } from 'react-i18next'
1111
import { handleCompletionStreamError } from './error'
12-
import { Box, Button } from '@mui/material'
12+
import { Box, Button, IconButton, Modal, Typography } from '@mui/material'
1313
import { Disclaimer } from './Disclaimer'
1414
import { Conversation } from './Conversation'
1515
import { ChatBox } from './ChatBox'
1616
import { getCompletionStream } from './util'
1717
import { SystemPrompt } from './System'
1818
import { AppContext } from '../../util/context'
19+
import { Close, Settings } from '@mui/icons-material'
20+
import { SettingsModal } from './SettingsModal'
1921

2022
export const ChatV2 = () => {
23+
const [settingsModalOpen, setSettingsModalOpen] = useState(false)
2124
const { courseId } = useParams()
2225

2326
const { course } = useCourse(courseId)
@@ -165,10 +168,16 @@ export const ChatV2 = () => {
165168
flexDirection: 'column',
166169
}}
167170
>
171+
172+
<SettingsModal open={settingsModalOpen} setOpen={setSettingsModalOpen}></SettingsModal>
168173
<Box sx={{ display: 'flex', gap: '1rem' }}>
169174
{disclaimerInfo && <Disclaimer disclaimer={disclaimerInfo} />}
170175
<SystemPrompt content={system.content} setContent={(content) => setSystem({ content })} />
171176
<Button onClick={handleReset}>Reset</Button>
177+
<IconButton onClick={() => setSettingsModalOpen(true)} title="Settings">
178+
<Settings></Settings>
179+
</IconButton>
180+
172181
</Box>
173182
<Box ref={chatContainerRef}>
174183
<Conversation messages={messages} completion={completion} />
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Close } from "@mui/icons-material"
2+
import { Box, IconButton, Modal, Typography } from "@mui/material"
3+
4+
5+
6+
7+
8+
export const SettingsModal = ({open, setOpen}) => {
9+
return(
10+
<Modal open={open} onClose={() => setOpen(false)}>
11+
<Box
12+
sx={{
13+
position: 'absolute',
14+
top: '50%',
15+
left: '50%',
16+
transform: 'translate(-50%, -50%)',
17+
width: '85vw',
18+
minHeight: '70vh',
19+
bgcolor: 'background.paper',
20+
boxShadow: 24,
21+
p: 4,
22+
}}
23+
>
24+
<IconButton
25+
onClick={() => setOpen(false)}
26+
sx={{ position: 'absolute', top: 8, right: 8, color: 'grey.500' }}
27+
>
28+
<Close></Close>
29+
</IconButton>
30+
<Typography id="modal-title" variant="h6" component="h2">
31+
Settings
32+
</Typography>
33+
34+
35+
</Box>
36+
</Modal>
37+
)
38+
}

0 commit comments

Comments
 (0)