Skip to content

Commit fa1c49b

Browse files
committed
fix: ui improvements
1 parent 4dcfeca commit fa1c49b

7 files changed

Lines changed: 30 additions & 13 deletions

File tree

src/components/GptResponse.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import a11yDark from 'react-syntax-highlighter/dist/esm/styles/prism/a11y-dark'
55
import styles from "./gptresponse.module.css"
66
import { ResultLayout } from "./ResultLayout";
77
import { getCurrent } from "@tauri-apps/api/window";
8+
import { useRef } from "react";
89

910
export const GptResponse = () => {
11+
const responseEndRef = useRef<HTMLDivElement>(null)
1012
const [gptResponse, setGptResponse, loadingResponse] = useGptResponseStore(s => [
1113
s.gptResponse,
1214
s.setGptResponse,
@@ -18,7 +20,14 @@ export const GptResponse = () => {
1820
getCurrent().emit("set-input", "");
1921
}
2022

23+
const scrollToBottom = () => {
24+
responseEndRef.current?.scrollIntoView({ behavior: "smooth" })
25+
}
26+
27+
scrollToBottom()
28+
2129
return <ResultLayout>
30+
2231
<ReactMarkdown children={gptResponse} className={styles.response}
2332
components={{
2433
code({ node, inline, className, children, ...props }) {
@@ -38,11 +47,8 @@ export const GptResponse = () => {
3847

3948
}
4049
}} />
41-
{
42-
loadingResponse
43-
? <button className={styles.clearButton}>Loading...</button>
44-
: <button onClick={handleClear} className={styles.clearButton}>Clear</button>
45-
}
50+
{!loadingResponse && <button onClick={handleClear} className={styles.clearButton}>Clear</button>}
51+
<div ref={responseEndRef}></div>
4652
</ResultLayout>
4753

4854
};

src/components/Settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const Settings = () => {
88
<h2 className={styles.title}>QuickGTP Settings</h2>
99
<section className={styles.options}>
1010
<label>
11-
Model (only one available for now):
11+
Model:
1212
<input defaultValue={settingsManager.getCache("model")} disabled />
1313
</label>
1414
<label>

src/components/gptresponse.module.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@
5454
margin: 5px 0;
5555
}
5656

57+
.response>p>code,
58+
.response>pre>code {
59+
font-family: monospace;
60+
font-size: medium;
61+
font-weight: 600;
62+
background-color: rgb(192, 212, 255);
63+
border-radius: 5px;
64+
padding: 1px 4px;
65+
}
66+
5767
.clearButton {
5868
color: white;
5969
background-color: rgba(21, 21, 21, 0.875);

src/components/inputbox.module.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
.topArea {
22
display: flex;
3-
background-color: rgb(255, 255, 255, 0.5);
3+
background-color: rgb(39, 43, 84);
44
padding: 2px 12px;
55
height: 40px;
66
width: 100%;
7-
border-bottom: .5px solid rgb(104, 101, 101);
7+
border-bottom: .5px solid rgb(29, 28, 28);
88
justify-content: space-between;
99
align-items: center;
10+
color: white;
1011
}
1112

1213
.inputBox {
@@ -16,7 +17,7 @@
1617
}
1718

1819
.inputBox:placeholder-shown {
19-
color: gray;
20+
color: rgb(186, 186, 186);
2021
}
2122

2223
.settingsIcon {

src/components/loadingicon.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
position: absolute;
1414
width: 20px;
1515
height: 20px;
16-
border: 2px solid black;
16+
border: 2px solid rgb(255, 255, 255);
1717
border-radius: 50%;
1818
animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
19-
border-color: black transparent transparent transparent;
19+
border-color: white transparent transparent transparent;
2020
}
2121

2222
.loadingIcon div:nth-child(1) {

src/components/settings.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
gap: 1rem;
2424
font-size: large;
2525
font-weight: 500;
26-
background-color: rgb(255, 255, 255);
2726
border-radius: 5px;
2827
padding: 10px 4px;
2928
}

src/styles.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.container {
2-
background-color: rgb(192, 192, 192);
2+
background-color: rgb(248, 248, 248);
33
border-radius: 8px;
4+
border: 0.25px solid black;
45
height: 100%;
56
overflow: hidden;
67
}

0 commit comments

Comments
 (0)