Skip to content

Commit

Permalink
style: redesign chat UI and input component
Browse files Browse the repository at this point in the history
  • Loading branch information
nl0 committed Oct 8, 2024
1 parent b09a6bd commit d6ad3aa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
12 changes: 1 addition & 11 deletions catalog/app/components/Assistant/UI/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,6 @@ const useChatStyles = M.makeStyles((t) => ({
flexGrow: 1,
overflow: 'hidden',
},
header: {
padding: `${t.spacing(2)}px`,
paddingBottom: `${t.spacing(1)}px`,
},
historyContainer: {
flexGrow: 1,
overflowY: 'auto',
Expand All @@ -309,7 +305,7 @@ const useChatStyles = M.makeStyles((t) => ({
gap: `${t.spacing(2)}px`,
justifyContent: 'flex-end',
minHeight: '100%',
padding: `${t.spacing(2)}px`,
padding: `${t.spacing(3)}px`,
paddingBottom: 0,
},
input: {},
Expand Down Expand Up @@ -346,12 +342,6 @@ export default function Chat({ state, dispatch }: ChatProps) {

return (

Check warning on line 343 in catalog/app/components/Assistant/UI/Chat/Chat.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/components/Assistant/UI/Chat/Chat.tsx#L343

Added line #L343 was not covered by tests
<div className={classes.chat}>
<div className={classes.header}>
<M.Typography variant="h4">Qurator</M.Typography>
<M.Typography variant="caption" color="textSecondary">
Qurator may make errors. Verify important information.
</M.Typography>
</div>
<div className={classes.historyContainer}>
<div className={classes.history}>
<MessageContainer>
Expand Down
41 changes: 28 additions & 13 deletions catalog/app/components/Assistant/UI/Chat/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ const useStyles = M.makeStyles((t) => ({
input: {
alignItems: 'center',
display: 'flex',
padding: `${t.spacing(2)}px`,
paddingRight: `${t.spacing(1)}px`,
paddingLeft: `${t.spacing(2)}px`,
paddingRight: `${t.spacing(2)}px`,
},
textField: {
marginTop: 0,
},
}))

Expand All @@ -32,24 +35,36 @@ export default function ChatInput({ className, disabled, onSubmit }: ChatInputPr
[disabled, onSubmit, value],
)

// TODO: customize colors
return (

Check warning on line 39 in catalog/app/components/Assistant/UI/Chat/Input.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/components/Assistant/UI/Chat/Input.tsx#L39

Added line #L39 was not covered by tests
<form className={cx(classes.input, className)} onSubmit={handleSubmit}>
<M.OutlinedInput
<M.TextField
className={classes.textField}
onChange={(e) => setValue(e.target.value)}

Check warning on line 43 in catalog/app/components/Assistant/UI/Chat/Input.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/components/Assistant/UI/Chat/Input.tsx#L43

Added line #L43 was not covered by tests
value={value}
variant="filled"
autoFocus
fullWidth
margin="dense"
placeholder="Type a message..."
margin="normal"
label="Ask Qurator"
helperText="Qurator may make errors. Verify important information."
InputProps={{
endAdornment: (
<M.InputAdornment position="end" variant="filled">
<M.IconButton
disabled={disabled || !value}
onClick={handleSubmit}
type="submit"
color="primary"
edge="end"
>
<M.Icon>send</M.Icon>
</M.IconButton>
</M.InputAdornment>
),
}}
InputLabelProps={{}}
/>
<M.IconButton
disabled={disabled || !value}
onClick={handleSubmit}
type="submit"
color="primary"
>
<M.Icon>send</M.Icon>
</M.IconButton>
</form>
)
}

0 comments on commit d6ad3aa

Please sign in to comment.