Skip to content

Commit d0ffa51

Browse files
committed
Replace prompt type dropdown with prompt type buttons in header
- instead of 'ui prompt type dropdown', place 'prompt type button', for 'edit' use icon "edit-sparkle", for 'ask' use "chat-sparkle" - 'edit' should use 'bg green', ask should use 'bg orange' - implement compacting of 'ask'/'edit' - which one gets compacted first, 'ask' or 'edit'? the one that is not active should get compacted first - remove compacting from promp type buttons - don't just Object. entries, place prompt type buttons statically - non-active prompt type should compact first - compacting in `apps/editor/src/views/prompt/frontend/Main/MainView/components/Header/Header.tsx` doesn't work - remove unused styles - because of the way how we handle 'home'/'main' views, compacting on the initially hidden view ('main') doesn't work - fix label={'xxxxxxxxxxxxxxxxx'} - 'prompt type button' should not have background prop. make it only var(--vscode-toolbar-hoverBackground); on hover (transparent when not hovered) - swap 'prompt type' with 'mode' buttons - wrap 'prompt type' buttons in a div without gap - in `packages/ui/src/components/editor/prompt/PromptTypeButton/PromptTypeButton.tsx` implement 'keycap', inspired by 'esc'. shown with filled prop 'keycap_char' - new keyboard shortcuts: 'Edit' prompt type: 'alt+E', 'Ask prompt type: 'alt+A' - keycap should never be dimmed - in main, remove hover background from 'chatbots'/'api calls' button, make it animate on hover with a wave animation - on mode hover, building on the current animation, progrssively move the whole thing up so the other mode in a dimmed color appears, hover out - reverse operation, unless clicked - the other mode is visible under the current one, should not - remove wave animation - chatbots/api calls should stick to each other, though make the stickiness only visible during animation ├── apps │ └── editor │ └── src │ └── views │ └── prompt │ └── frontend │ ├── Home │ │ ├── Home.module.scss │ │ ├── Home.tsx │ │ ├── hooks │ │ │ ├── use-has-scrolled-past-mode-button.ts │ │ │ └── use-tasks.ts │ │ └── index.ts │ ├── Main │ │ ├── Main.tsx │ │ ├── MainView │ │ │ ├── MainView.module.scss │ │ │ ├── MainView.tsx │ │ │ ├── components │ │ │ │ └── Header │ │ │ │ ├── Header.module.scss │ │ │ │ ├── Header.tsx │ │ │ │ ├── hooks │ │ │ │ │ └── use-keyboard-shortcuts.ts │ │ │ │ └── index.ts │ │ │ ├── hooks │ │ │ │ ├── use-invocation-counts.ts │ │ │ │ ├── use-last-choice-tooltip.ts │ │ │ │ └── use-re-render-on-interval.ts │ │ │ ├── index.ts │ │ │ └── prompt-type-labels.ts │ │ └── index.ts │ ├── Prompt.tsx │ ├── components │ │ ├── Layout │ │ │ └── Footer │ │ │ ├── Footer.tsx │ │ │ └── index.ts │ │ └── recent-donations │ │ └── RecentDonationsFooter │ │ └── RecentDonationsFooter.tsx │ └── hooks │ └── use-prompt │ └── use-prompt.ts └── packages ├── shared │ └── src │ └── hooks │ └── use-compacting.ts └── ui └── src ├── components │ └── editor │ └── prompt │ ├── BrowserExtensionMessage │ │ └── BrowserExtensionMessage.tsx │ ├── CompactableActionButton │ │ ├── CompactableActionButton.module.scss │ │ ├── CompactableActionButton.tsx │ │ └── index.ts │ ├── ModeButton │ │ ├── ModeButton.module.scss │ │ ├── ModeButton.stories.tsx │ │ ├── ModeButton.tsx │ │ └── index.ts │ ├── PromptTypeButton │ │ ├── PromptTypeButton.module.scss │ │ ├── PromptTypeButton.stories.tsx │ │ ├── PromptTypeButton.tsx │ │ └── index.ts │ ├── PromptTypeDropdown │ │ ├── PromptTypeDropdown.module.scss │ │ ├── PromptTypeDropdown.stories.tsx │ │ ├── PromptTypeDropdown.tsx │ │ └── index.ts │ └── ResponsePreviewFooter │ └── ResponsePreviewFooter.tsx ├── constants │ └── sizes.ts └── styles └── foundation └── _colors.scss
1 parent 584e0bd commit d0ffa51

17 files changed

Lines changed: 380 additions & 291 deletions

File tree

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
.container {
2-
position: relative;
3-
display: flex;
4-
flex-direction: column;
5-
height: 100%;
6-
pointer-events: none;
7-
8-
> div {
9-
pointer-events: all;
10-
}
11-
}
12-
13-
.content {
14-
display: flex;
15-
flex-direction: column;
16-
}
17-
181
.chat-input-container {
192
display: flex;
203
flex-direction: column;
@@ -26,40 +9,7 @@
269
}
2710
}
2811

29-
.edit-format {
30-
display: flex;
31-
flex-direction: column;
32-
gap: 4px;
33-
padding: 6px 12px 0 12px;
34-
35-
> span {
36-
font-size: 12px;
37-
color: var(--cwc-text-color-dimmed);
38-
}
39-
}
40-
4112
.browser-extension-message {
4213
padding: 0 16px;
4314
position: relative;
4415
}
45-
46-
.shrink-source-code-checkbox {
47-
display: flex;
48-
align-items: center;
49-
gap: 6px;
50-
padding: 0 16px 8px 16px;
51-
52-
:global([data-modern-ui='true']) & {
53-
padding: 0 12px 8px 16px;
54-
}
55-
56-
label {
57-
font-size: 12px;
58-
color: var(--cwc-text-color-dimmed);
59-
cursor: pointer;
60-
user-select: none;
61-
overflow: hidden;
62-
text-overflow: ellipsis;
63-
white-space: nowrap;
64-
}
65-
}
Lines changed: 69 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
11
.header {
2+
--height: 32px;
23
display: flex;
34
justify-content: space-between;
45
align-items: center;
5-
padding: 4px 12px;
6+
padding: 0 12px;
67
gap: 14px;
8+
height: var(--height);
79

810
:global([data-modern-ui='true']) & {
9-
padding: 4px 10px;
11+
padding: 0 10px;
1012
}
1113

1214
&__left {
1315
display: flex;
1416
align-items: center;
15-
gap: 4px;
17+
padding: 4px 0;
1618

17-
&__home-view-type {
18-
font-weight: 600;
19+
&__prompt-types {
20+
display: flex;
21+
align-items: center;
22+
gap: 0;
1923
}
24+
}
25+
26+
&__right {
27+
display: flex;
28+
align-items: center;
2029

2130
&__toggler {
2231
font-family: var(--font-family-accent);
2332
font-size: 18px;
2433
display: flex;
34+
flex-direction: column;
2535
align-items: center;
26-
justify-content: center;
27-
height: 24px;
36+
justify-content: flex-start;
37+
height: var(--height);
2838
border-radius: 5px;
2939
--padding: 6px;
3040
padding: 1px var(--padding) 0 var(--padding);
@@ -33,13 +43,63 @@
3343
white-space: nowrap;
3444
letter-spacing: 1px;
3545
position: relative;
46+
overflow: hidden;
3647

3748
&:focus {
3849
outline: none;
3950
}
4051

41-
&:hover {
42-
background-color: var(--vscode-toolbar-hoverBackground);
52+
&__wrapper {
53+
display: grid;
54+
grid-template-areas: 'overlap';
55+
align-items: center;
56+
justify-items: center;
57+
height: 100%;
58+
width: 100%;
59+
flex-shrink: 0;
60+
61+
&--hover {
62+
> span:first-child {
63+
transform: translateY(-100%);
64+
opacity: 0;
65+
}
66+
> span:last-child {
67+
transform: translateY(0);
68+
opacity: 0.5;
69+
}
70+
}
71+
72+
&--no-transition {
73+
> span {
74+
transition: none !important;
75+
}
76+
}
77+
}
78+
79+
&__label {
80+
grid-area: overlap;
81+
width: 100%;
82+
display: flex;
83+
align-items: center;
84+
justify-content: center;
85+
white-space: nowrap;
86+
overflow: hidden;
87+
max-width: 100%;
88+
transition:
89+
transform var(--transition-duration-250)
90+
var(--transition-timing-function),
91+
opacity var(--transition-duration-250)
92+
var(--transition-timing-function);
93+
94+
&:first-child {
95+
transform: translateY(0);
96+
opacity: 1;
97+
}
98+
99+
&:last-child {
100+
transform: translateY(100%);
101+
opacity: 0;
102+
}
43103
}
44104

45105
&__esc {
@@ -58,18 +118,4 @@
58118
}
59119
}
60120
}
61-
62-
&__right {
63-
flex: 1;
64-
display: flex;
65-
align-items: center;
66-
gap: 8px;
67-
68-
&__dropdown {
69-
position: relative;
70-
flex: 1;
71-
width: 100%;
72-
height: 24px;
73-
}
74-
}
75121
}

0 commit comments

Comments
 (0)