Skip to content

Commit

Permalink
feat: show error message
Browse files Browse the repository at this point in the history
  • Loading branch information
dubisdev committed Mar 29, 2023
1 parent c0a41b2 commit 6fd013a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Settings } from "./components/Settings";
import { useInputStore } from "./state/inputStore";
import { useGptResponseStore } from "./state/gptResponseStore";
import styles from "./styles.module.css";
import { ErrorMessage } from "./components/ErrorMessage";

export const QuickGpt = () => {
const input = useInputStore(s => s.input)
Expand All @@ -16,8 +17,9 @@ export const QuickGpt = () => {
<div data-tauri-drag-region className={styles.container}>
<InputBox />

{shouldDisplayGptResponse && <div className={styles.resultBox}><GptResponse /></div>}
{shouldDisplaySettings && <div className={styles.resultBox}><Settings /></div>}
{shouldDisplayGptResponse && <GptResponse />}
{shouldDisplaySettings && <Settings />}
{gptResponseError && <ErrorMessage />}
</div>
);
}
12 changes: 12 additions & 0 deletions src/components/ErrorMessage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { useGptResponseStore } from "../state/gptResponseStore"
import { ResultLayout } from "./ResultLayout"

export const ErrorMessage = () => {
const gptErrorResponse = useGptResponseStore(s => s.error)

return <ResultLayout>
Error: {gptErrorResponse}
<br />
Check your API key typing <strong>:settings:</strong> in the input box.
</ResultLayout>
}

0 comments on commit 6fd013a

Please sign in to comment.