Skip to content

Commit 43256ed

Browse files
committed
style: more prominent conversations (#329)
1 parent ea51c09 commit 43256ed

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

src/components/ConversationCard/index.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ function ConversationCard(props) {
5959
else {
6060
const ret = []
6161
for (const record of session.conversationRecords) {
62-
ret.push(new ConversationItemData('question', record.question + '\n<hr/>', true))
63-
ret.push(new ConversationItemData('answer', record.answer + '\n<hr/>', true))
62+
ret.push(new ConversationItemData('question', record.question, true))
63+
ret.push(new ConversationItemData('answer', record.answer, true))
6464
}
6565
return ret
6666
}
@@ -139,7 +139,7 @@ function ConversationCard(props) {
139139
setSession(msg.session)
140140
}
141141
if (msg.done) {
142-
updateAnswer('\n<hr/>', true, 'answer', true)
142+
updateAnswer('', true, 'answer', true)
143143
setIsReady(true)
144144
}
145145
if (msg.error) {
@@ -151,7 +151,7 @@ function ConversationCard(props) {
151151
}<br>${t('And refresh this page or type you question again')}` +
152152
`<br><br>${t(
153153
'Consider creating an api key at https://platform.openai.com/account/api-keys',
154-
)}\n<hr/>`,
154+
)}`,
155155
false,
156156
'error',
157157
)
@@ -165,7 +165,7 @@ function ConversationCard(props) {
165165
}<br>${t('And refresh this page or type you question again')}` +
166166
`<br><br>${t(
167167
'Consider creating an api key at https://platform.openai.com/account/api-keys',
168-
)}\n<hr/>`,
168+
)}`,
169169
false,
170170
'error',
171171
)
@@ -174,11 +174,11 @@ function ConversationCard(props) {
174174
if (
175175
conversationItemData[conversationItemData.length - 1].content.includes('gpt-loading')
176176
)
177-
updateAnswer(msg.error + '\n<hr/>', false, 'error')
177+
updateAnswer(msg.error, false, 'error')
178178
else
179179
setConversationItemData([
180180
...conversationItemData,
181-
new ConversationItemData('error', msg.error + '\n<hr/>'),
181+
new ConversationItemData('error', msg.error),
182182
])
183183
break
184184
}
@@ -392,7 +392,7 @@ function ConversationCard(props) {
392392
port={port}
393393
reverseResizeDir={props.pageMode}
394394
onSubmit={(question) => {
395-
const newQuestion = new ConversationItemData('question', question + '\n<hr/>')
395+
const newQuestion = new ConversationItemData('question', question)
396396
const newAnswer = new ConversationItemData(
397397
'answer',
398398
`<p class="gpt-loading">${t('Waiting for response...')}</p>`,

src/content-script/styles.scss

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@import 'highlight.js/scss/github-dark.scss';
88
--font-color: #c9d1d9;
99
--theme-color: #202124;
10+
--question-bg-color: #2d2e33;
1011
--theme-border-color: #3c4043;
1112
--dragbar-color: #3c4043;
1213
--color-neutral-muted: rgba(110, 118, 129, 0.4);
@@ -16,6 +17,7 @@
1617
@import 'highlight.js/scss/github.scss';
1718
--font-color: #24292f;
1819
--theme-color: #eaecf0;
20+
--question-bg-color: #e2e4e8;
1921
--theme-border-color: #aeafb2;
2022
--dragbar-color: #dfe0e1;
2123
--color-neutral-muted: rgba(150, 160, 170, 0.3);
@@ -29,6 +31,7 @@
2931

3032
--font-color: #c9d1d9;
3133
--theme-color: #202124;
34+
--question-bg-color: #2d2e33;
3235
--theme-border-color: #3c4043;
3336
--dragbar-color: #3c4043;
3437
--color-neutral-muted: rgba(110, 118, 129, 0.4);
@@ -41,6 +44,7 @@
4144

4245
--font-color: #24292f;
4346
--theme-color: #eaecf0;
47+
--question-bg-color: #e2e4e8;
4448
--theme-border-color: #aeafb2;
4549
--dragbar-color: #ccced0;
4650
--color-neutral-muted: rgba(150, 160, 170, 0.3);
@@ -80,14 +84,27 @@
8084
height: 1px;
8185
background-color: var(--theme-border-color);
8286
border: none;
83-
margin: 5px 0;
87+
margin: 0;
8488
}
8589
}
8690

8791
.markdown-body {
88-
padding: 5px 15px 10px;
8992
background-color: var(--theme-color);
9093
color: var(--font-color);
94+
overflow-y: auto;
95+
96+
::-webkit-scrollbar {
97+
background-color: var(--theme-color);
98+
width: 9px;
99+
}
100+
::-webkit-scrollbar-thumb {
101+
background-color: var(--theme-border-color);
102+
border-radius: 20px;
103+
border: transparent;
104+
}
105+
::-webkit-scrollbar-corner {
106+
background: transparent;
107+
}
91108
&::-webkit-scrollbar {
92109
background-color: var(--theme-color);
93110
width: 9px;
@@ -100,8 +117,6 @@
100117
&::-webkit-scrollbar-corner {
101118
background: transparent;
102119
}
103-
104-
overflow-y: auto;
105120
p {
106121
color: var(--font-color);
107122
}
@@ -178,10 +193,14 @@
178193
white-space: nowrap;
179194
}
180195

196+
.question {
197+
background: var(--question-bg-color);
198+
}
199+
181200
:is(.answer, .question, .error) {
182201
font-size: 15px;
183202
line-height: 1.6;
184-
border-radius: 8px;
203+
padding: 4px 15px;
185204
word-break: break-word;
186205

187206
pre {

0 commit comments

Comments
 (0)