Skip to content

Commit

Permalink
Adds helper text to chat input field (jupyterlab#139)
Browse files Browse the repository at this point in the history
* Adds helper text to chat input field

* use minor version bump in check_release

---------

Co-authored-by: David L. Qiu <[email protected]>
  • Loading branch information
3coins and dlqqq authored May 2, 2023
1 parent 778ecaa commit f21445e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ jobs:
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version_spec: minor
10 changes: 8 additions & 2 deletions packages/jupyter-ai/src/components/chat-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ type ChatInputProps = {
toggleIncludeSelection: () => unknown;
replaceSelection: boolean;
toggleReplaceSelection: () => unknown;
helperText: JSX.Element
sx?: SxProps<Theme>;
};

export function ChatInput(props: ChatInputProps): JSX.Element {

function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {
if (event.key === 'Enter' && event.shiftKey) {
props.onSend();
Expand All @@ -35,7 +37,7 @@ export function ChatInput(props: ChatInputProps): JSX.Element {
}
return (
<Box sx={props.sx}>
<Box sx={{ display: 'flex' }}>
<Box sx={{ display: 'flex'}}>
<TextField
value={props.value}
onChange={e => props.onChange(e.target.value)}
Expand All @@ -50,8 +52,12 @@ export function ChatInput(props: ChatInputProps): JSX.Element {
<SendIcon />
</IconButton>
</InputAdornment>
),
)
}}
FormHelperTextProps={{
sx: {marginLeft: 'auto', marginRight: 0}
}}
helperText={props.value.length > 2 ? props.helperText : ' '}
/>
</Box>
{props.hasSelection && (
Expand Down
5 changes: 3 additions & 2 deletions packages/jupyter-ai/src/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ function ChatBody({ chatHandler }: ChatBodyProps): JSX.Element {
sx={{
paddingLeft: 4,
paddingRight: 4,
paddingTop: 2,
paddingBottom: 2,
paddingTop: 3.5,
paddingBottom: 0,
borderTop: '1px solid var(--jp-border-color1)'
}}
helperText={<span><b>Press Shift</b> + <b>Enter</b> to submit message</span>}
/>
</Box>
);
Expand Down

0 comments on commit f21445e

Please sign in to comment.