Skip to content

Commit 4bec80c

Browse files
committed
Redesign home target buttons into full-width rows with descriptions and embedded background effects
- stack target buttons vertically - show 'ascii art effect' on each target individually (place in target button) - on the right side of target button, show chevron-right icon and text 'Copy prompts'/'Send requests' - keep target button's label on the left side - in target button, sub label should get ellipsis truncations, not overlay label - add translations to [Fragment] - rename 'sub label' to 'description' - if connected, replace 'copy prompts' to 'autofill chatbots' ├── apps │ └── editor │ └── src │ └── views │ └── prompt │ └── frontend │ ├── Home │ │ ├── Home.module.scss │ │ └── Home.tsx │ └── i18n │ └── translations │ └── home.ts └── packages └── ui └── src └── components └── editor └── prompt ├── Configurations │ └── Configurations.module.scss ├── HomeLinkButton │ └── HomeLinkButton.module.scss ├── IconAccentButton │ └── IconAccentButton.module.scss ├── TargetButton │ ├── TargetButton.module.scss │ └── TargetButton.tsx └── modals └── OngoingApiCallsModal └── OngoingApiCallsModal.module.scss
1 parent bf8a747 commit 4bec80c

5 files changed

Lines changed: 106 additions & 28 deletions

File tree

‎apps/editor/src/views/prompt/frontend/Home/Home.module.scss‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@
6666
transform: translateY(0);
6767
pointer-events: auto;
6868
}
69-
70-
&-divider {
71-
width: 1px;
72-
height: 16px;
73-
background-color: var(--cwc-purple-background);
74-
}
7569
}
7670
}
7771

@@ -95,8 +89,8 @@
9589
}
9690

9791
&__target {
98-
position: relative;
9992
display: flex;
93+
flex-direction: column;
10094
margin: 0 12px;
10195

10296
:global([data-modern-ui='true']) & {
@@ -106,18 +100,6 @@
106100
> button {
107101
flex: 1;
108102
}
109-
110-
&::after {
111-
content: '';
112-
position: absolute;
113-
left: 50%;
114-
top: 50%;
115-
transform: translate(-50%, -50%);
116-
width: 1px;
117-
height: 35px;
118-
background-color: var(--cwc-purple-background);
119-
pointer-events: none;
120-
}
121103
}
122104

123105
&__empty {
@@ -184,7 +166,7 @@
184166
gap: 8px;
185167
font-size: 12px;
186168
user-select: text;
187-
width: 100%; // For easier text selection
169+
width: 100%;
188170
padding: 0 12px 12px 12px;
189171

190172
&__links {

‎apps/editor/src/views/prompt/frontend/Home/Home.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import cn from 'classnames'
88
import { post_message } from '../utils/post-message'
99
import { BackendMessage } from '@/views/prompt/types/messages'
1010
import { Separator as UiSeparator } from '@ui/components/editor/prompt/Separator'
11-
import { AsciiArtEffect } from '@ui/components/editor/prompt/AsciiArtEffect'
1211
import { Translation, use_translation } from '../i18n/use-translation'
1312
import { CompactableActionButton } from '@ui/components/editor/prompt/CompactableActionButton'
1413
import { Tasks as UiTasks } from '@ui/components/editor/prompt/Tasks'
@@ -166,15 +165,13 @@ export const Home: React.FC<Props> = (props) => {
166165
has_scrolled_past_target_button
167166
})}
168167
>
169-
<AsciiArtEffect density={2.3} />
170168
<UiKeycapWrapper char={is_alt_pressed ? 'W' : undefined} full_width>
171169
<UiTargetButton
172170
label={TARGET.WEB}
173171
on_click={props.on_chatbots_click}
174172
is_compact
175173
/>
176174
</UiKeycapWrapper>
177-
<div className={styles['header__targets-divider']} />
178175
<UiKeycapWrapper char={is_alt_pressed ? 'A' : undefined} full_width>
179176
<UiTargetButton
180177
label={TARGET.API}
@@ -189,13 +186,17 @@ export const Home: React.FC<Props> = (props) => {
189186
<div className={styles.content}>
190187
<div className={styles.inner}>
191188
<div className={styles.inner__target} ref={target_ref}>
192-
<AsciiArtEffect />
193189
<UiKeycapWrapper
194190
char={is_alt_pressed ? 'W' : undefined}
195191
full_width
196192
>
197193
<UiTargetButton
198194
label={TARGET.WEB}
195+
description={
196+
props.is_connected
197+
? t('home.target.web.description-connected')
198+
: t('home.target.web.description')
199+
}
199200
on_click={props.on_chatbots_click}
200201
/>
201202
</UiKeycapWrapper>
@@ -205,6 +206,7 @@ export const Home: React.FC<Props> = (props) => {
205206
>
206207
<UiTargetButton
207208
label={TARGET.API}
209+
description={t('home.target.api.description')}
208210
on_click={props.on_api_calls_click}
209211
/>
210212
</UiKeycapWrapper>

‎apps/editor/src/views/prompt/frontend/i18n/translations/home.ts‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,59 @@ export const home = {
124124
cs: 'Odstranit těla funkcí',
125125
hu: 'Függvénytestek eltávolítása',
126126
bg: 'Премахване на телата на функциите'
127+
},
128+
'home.target.web.description': {
129+
en: 'Copy prompts',
130+
pl: 'Kopiuj prompty',
131+
'zh-cn': '复制提示',
132+
ja: 'プロンプトをコピー',
133+
'zh-tw': '複製提示',
134+
de: 'Prompts kopieren',
135+
es: 'Copiar prompts',
136+
fr: 'Copier les prompts',
137+
'pt-br': 'Copiar prompts',
138+
ru: 'Копировать промпты',
139+
ko: '프롬프트 복사',
140+
it: 'Copia prompt',
141+
tr: 'İstemleri kopyala',
142+
cs: 'Kopírovat prompty',
143+
hu: 'Promptok másolása',
144+
bg: 'Копиране на промптове'
145+
},
146+
'home.target.web.description-connected': {
147+
en: 'Autofill chatbots',
148+
pl: 'Autouzupełniaj chatboty',
149+
'zh-cn': '自动填充聊天机器人',
150+
ja: 'チャットボットを自動入力',
151+
'zh-tw': '自動填寫聊天機器人',
152+
de: 'Chatbots automatisch ausfüllen',
153+
es: 'Autocompletar chatbots',
154+
fr: 'Remplissage automatique des chatbots',
155+
'pt-br': 'Preenchimento automático de chatbots',
156+
ru: 'Автозаполнение чат-ботов',
157+
ko: '챗봇 자동 완성',
158+
it: 'Compilazione automatica chatbot',
159+
tr: 'Sohbet robotlarını otomatik doldur',
160+
cs: 'Automatické vyplňování chatbotů',
161+
hu: 'Chatbotok automatikus kitöltése',
162+
bg: 'Автоматично попълване на чатботове'
163+
},
164+
'home.target.api.description': {
165+
en: 'Send requests',
166+
pl: 'Wyślij requesty',
167+
'zh-cn': '发送请求',
168+
ja: 'リクエストを送信',
169+
'zh-tw': '發送請求',
170+
de: 'Anfragen senden',
171+
es: 'Enviar solicitudes',
172+
fr: 'Envoyer des requêtes',
173+
'pt-br': 'Enviar requisições',
174+
ru: 'Отправить запросы',
175+
ko: '요청 보내기',
176+
it: 'Invia richieste',
177+
tr: 'İstek gönder',
178+
cs: 'Odeslat požadavky',
179+
hu: 'Kérések küldése',
180+
bg: 'Изпращане на заявки'
127181
}
128182
} as const

‎packages/ui/src/components/editor/prompt/TargetButton/TargetButton.module.scss‎

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@
1212
.button {
1313
display: flex;
1414
align-items: center;
15-
justify-content: center;
16-
flex-direction: column;
15+
justify-content: space-between;
1716
padding: 0 12px;
18-
height: 81px;
17+
height: 50px;
1918
width: 100%;
2019
border-radius: 10px;
2120
overflow: hidden;
2221
flex: 1;
2322
position: relative;
2423
cursor: pointer;
24+
gap: 12px;
2525

2626
&--compact {
27+
justify-content: center;
2728
height: 100%;
2829
gap: 8px;
2930
border-radius: 0;
@@ -39,6 +40,11 @@
3940
.button__label-char {
4041
animation: wave 0.5s ease-in-out;
4142
}
43+
44+
.button__description {
45+
color: var(--vscode-foreground);
46+
opacity: 1;
47+
}
4248
}
4349

4450
&--compact:not(:disabled):hover .button__label-char {
@@ -52,13 +58,38 @@
5258

5359
&__label {
5460
@include accent-font;
55-
font-size: 32px;
61+
font-size: 26px;
62+
position: relative;
63+
z-index: 1;
64+
white-space: nowrap;
65+
flex-shrink: 0;
5666
}
5767

5868
&__label-char {
5969
display: inline-block;
6070
position: relative;
6171
}
72+
73+
&__description {
74+
display: flex;
75+
align-items: center;
76+
gap: 2px;
77+
font-size: 12px;
78+
color: var(--vscode-descriptionForeground);
79+
z-index: 1;
80+
opacity: 0.8;
81+
min-width: 0;
82+
83+
> span:first-child {
84+
overflow: hidden;
85+
text-overflow: ellipsis;
86+
white-space: nowrap;
87+
}
88+
89+
> span:last-child {
90+
flex-shrink: 0;
91+
}
92+
}
6293
}
6394

6495
@keyframes wave {

‎packages/ui/src/components/editor/prompt/TargetButton/TargetButton.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import styles from './TargetButton.module.scss'
22
import cn from 'classnames'
3+
import { AsciiArtEffect } from '../AsciiArtEffect'
34

45
type Props = {
56
label: string
7+
description?: string
68
on_click: () => void
79
is_compact?: boolean
810
disabled?: boolean
@@ -22,6 +24,7 @@ export const TargetButton: React.FC<Props> = (props) => {
2224
onClick={props.disabled ? undefined : props.on_click}
2325
disabled={!!props.disabled}
2426
>
27+
<AsciiArtEffect density={props.is_compact ? 2.3 : undefined} />
2528
<div className={styles['button__label']}>
2629
{props.label.split('').map((char, index) => (
2730
<span
@@ -33,6 +36,12 @@ export const TargetButton: React.FC<Props> = (props) => {
3336
</span>
3437
))}
3538
</div>
39+
{props.description && !props.is_compact && (
40+
<div className={styles['button__description']}>
41+
<span>{props.description}</span>
42+
<span className="codicon codicon-chevron-right" />
43+
</div>
44+
)}
3645
</button>
3746
</div>
3847
)

0 commit comments

Comments
 (0)