Skip to content

Commit

Permalink
Merge branch 'main' into refactor-with-mst-2
Browse files Browse the repository at this point in the history
  • Loading branch information
emcelroy committed Dec 3, 2024
2 parents fb77120 + 67d677e commit cd9b2f0
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 35 deletions.
6 changes: 6 additions & 0 deletions src/assets/send-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 0 additions & 27 deletions src/components/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
height: 0;
margin: 20px 0 0;
}
.buttons {
display: flex;
flex-direction: column;
}

button {
margin: 10px;
Expand Down Expand Up @@ -61,29 +57,6 @@
}
}
}
.response-area {
display: flex;
flex-direction: column;
span {
position: relative;
top: 0;
left: 0;
}
.response {
resize: vertical;
min-height: 2em;
height: 10em;
overflow-y: scroll;
border: thin solid darkslategrey;
background-color: rgba(0,0,255,0.1);
margin: 10px;
padding: 0;
font-size: small;
text-align: left;
white-space: pre-wrap;
user-select: text;
}
}

.confirmation-message, .error-message {
font-size: .75rem;
Expand Down
23 changes: 20 additions & 3 deletions src/components/chat-input.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@use "vars" as *;

.chat-input {
margin-top: 10px;
margin: 10px 0;
position: relative;

fieldset {
border: none;
Expand All @@ -23,10 +24,14 @@
align-items: center;
display: flex;
flex-wrap: nowrap;
height: 32px;
justify-content: space-between;
margin: 10px 0;
left: 8px;
margin: 0;
padding: 0;
width: 100%;
position: absolute;
top: 55px;
width: calc(100% - 16px);

button {
display: block;
Expand All @@ -35,7 +40,19 @@
width: auto;

&.send {
background: transparent url(../assets/send-icon.svg) 4px 4px no-repeat;
border: none;
border-radius: 6px;
color: $dark-gray;
cursor: pointer;
font-family: 'Montserrat', sans-serif;
font-size: .75rem;
height: 32px;
margin-left: auto;
order: 2;
overflow: hidden;
text-indent: -9999px;
width: 32px;
}
&.dictate {
order: 1;
Expand Down
1 change: 0 additions & 1 deletion src/components/chat-input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe("test chat input component", () => {
expect(inputError).not.toBeInTheDocument();
expect(chatInputTextarea).not.toHaveAttribute("aria-describedby");
expect(chatInputTextarea).toHaveAttribute("aria-invalid", "false");
expect(chatInputTextarea).not.toHaveAttribute("placeholder", "Ask DAVAI about the data");
expect(mockHandleSubmit).toHaveBeenCalled();
});
});
4 changes: 1 addition & 3 deletions src/components/chat-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const ChatInputComponent = ({keyboardShortcutEnabled, shortcutKeys, onKey
// const [browserSupportsDictation, setBrowserSupportsDictation] = useState(false);
// const [dictationEnabled, setDictationEnabled] = useState(false);
const [inputValue, setInputValue] = useState("");
const [showPlaceholder, setShowPlaceholder] = useState(true);
const [showError, setShowError] = useState(false);

const handleSubmit = (event?: FormEvent) => {
Expand All @@ -29,7 +28,6 @@ export const ChatInputComponent = ({keyboardShortcutEnabled, shortcutKeys, onKey
} else {
onSubmit(inputValue);
setInputValue("");
setShowPlaceholder(false);
textAreaRef.current?.focus();
setShowError(false);
}
Expand Down Expand Up @@ -159,7 +157,7 @@ export const ChatInputComponent = ({keyboardShortcutEnabled, shortcutKeys, onKey
aria-invalid={showError}
data-testid="chat-input-textarea"
id="chat-input"
placeholder={showPlaceholder ? "Ask DAVAI about the data" : ""}
placeholder={"Ask DAVAI about the data"}
ref={textAreaRef}
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/keyboard-shortcut-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const KeyboardShortcutControls = (props: IProps) => {
const handleCustomizeShortcut = (event: FormEvent) => {
event.preventDefault();
const form = event.target as HTMLInputElement;
const shortcut = form.querySelector("input")?.value;
const shortcut = form.querySelector("input")?.value.trim();
if (shortcut) {
onCustomizeShortcut?.(shortcut);
setShowError(false);
Expand Down

0 comments on commit cd9b2f0

Please sign in to comment.