Skip to content

Commit 81b9283

Browse files
committed
Centralize modal footer styling and standardize scrollable content handling within the generic Modal component
1 parent f04fbd4 commit 81b9283

8 files changed

Lines changed: 51 additions & 62 deletions

File tree

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.textarea {
2+
display: flex;
23
width: 100%;
34
background-color: var(--vscode-input-background);
45
color: var(--vscode-input-foreground);
@@ -15,13 +16,3 @@
1516
outline-offset: -1px;
1617
}
1718
}
18-
19-
.actions {
20-
display: flex;
21-
justify-content: flex-end;
22-
gap: var(--padding-8px);
23-
24-
> button {
25-
flex: 1;
26-
}
27-
}

‎packages/ui/src/components/editor/panel/modals/CommitMessageModal/CommitMessageModal.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const CommitMessageModal: React.FC<Props> = (props) => {
6969
/>
7070
}
7171
footer_slot={
72-
<div className={styles.actions} onMouseDown={stop_timer}>
72+
<>
7373
<Button on_click={props.on_cancel} is_secondary={true}>
7474
Cancel
7575
</Button>
@@ -81,7 +81,7 @@ export const CommitMessageModal: React.FC<Props> = (props) => {
8181
Commit
8282
{is_timer_active && countdown > 0 && ` (${countdown})`}
8383
</Button>
84-
</div>
84+
</>
8585
}
8686
/>
8787
)

‎packages/ui/src/components/editor/panel/modals/Modal/Modal.module.scss‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
display: flex;
88
align-items: center;
99
justify-content: center;
10-
padding-bottom: 30px;
10+
padding-bottom: var(--padding-24px) var(--padding-24px) var(--padding-30px)
11+
var(--padding-24px);
1112

1213
&::before {
1314
content: '';
@@ -25,17 +26,31 @@
2526
text-align: center;
2627
font-weight: 500;
2728
font-size: var(--font-size-14px);
28-
padding: var(--padding-12px) var(--padding-12px) var(--padding-2px)
29-
var(--padding-12px);
29+
padding: var(--padding-14px) var(--padding-12px) 0 var(--padding-12px);
30+
}
31+
32+
.scrollable {
33+
margin-top: var(--padding-4px);
34+
35+
&__inner {
36+
padding: var(--padding-4px) var(--padding-12px) var(--padding-8px)
37+
var(--padding-12px);
38+
}
3039
}
3140

3241
.content {
33-
padding: var(--padding-8px) var(--padding-12px);
42+
padding: var(--padding-12px);
3443
}
3544

3645
.footer {
46+
display: flex;
47+
gap: var(--padding-8px);
3748
padding: var(--padding-12px);
3849
border-top: 1px solid var(--vscode-sideBarSectionHeader-border);
50+
51+
> button {
52+
flex: 1;
53+
}
3954
}
4055

4156
.container {
@@ -44,7 +59,6 @@
4459
border-radius: var(--border-radius-8px);
4560
border: 1px solid var(--vscode-sideBarSectionHeader-border);
4661
width: 100%;
47-
margin: var(--padding-24px);
4862
max-width: 320px;
4963
background-color: var(--vscode-quickInput-background);
5064
color: var(--vscode-quickInput-foreground);

‎packages/ui/src/components/editor/panel/modals/Modal/Modal.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ export const Modal: React.FC<Props> = (props) => {
1616

1717
{props.content_slot &&
1818
(props.content_max_height ? (
19-
<Scrollable max_height={props.content_max_height}>
20-
<div className={styles.content}>{props.content_slot}</div>
21-
</Scrollable>
19+
<div className={styles.scrollable}>
20+
<Scrollable max_height={props.content_max_height}>
21+
<div className={styles.scrollable__inner}>
22+
{props.content_slot}
23+
</div>
24+
</Scrollable>
25+
</div>
2226
) : (
2327
<div className={styles.content}>{props.content_slot}</div>
2428
))}

‎packages/ui/src/components/editor/panel/modals/ProgressModal/ProgressModal.module.scss‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
}
3333
}
3434

35-
.files-container {
35+
.content {
3636
display: flex;
3737
flex-direction: column;
3838
gap: var(--padding-8px);

‎packages/ui/src/components/editor/panel/modals/ProgressModal/ProgressModal.tsx‎

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,23 @@ export const ProgressModal: React.FC<Props> = (props) => {
6666
return (
6767
<Modal
6868
title={props.title}
69+
content_max_height={props.files ? '30vh' : undefined}
6970
content_slot={
7071
<>
7172
<div className={styles['elapsed-time']}>
7273
{elapsed_time.toFixed(1)}s
7374
</div>
7475

7576
{props.files ? (
76-
<div className={styles['files-container']}>
77+
<div className={styles.content}>
7778
{props.files.map((file) => {
7879
const last_slash_index = file.file_path.lastIndexOf('/')
7980
const file_name =
80-
last_slash_index === -1
81+
last_slash_index == -1
8182
? file.file_path
8283
: file.file_path.substring(last_slash_index + 1)
8384
const directory_path =
84-
last_slash_index === -1
85+
last_slash_index == -1
8586
? ''
8687
: file.file_path.substring(0, last_slash_index)
8788

@@ -102,8 +103,8 @@ export const ProgressModal: React.FC<Props> = (props) => {
102103
</div>
103104
</div>
104105
<div className={styles.progress}>
105-
{file.status === 'thinking' ||
106-
(file.status === 'receiving' &&
106+
{file.status == 'thinking' ||
107+
(file.status == 'receiving' &&
107108
file.progress === undefined) ? (
108109
<div
109110
className={styles['progress__fill--indeterminate']}
@@ -112,15 +113,15 @@ export const ProgressModal: React.FC<Props> = (props) => {
112113
<div
113114
className={cn(styles.progress__fill, {
114115
[styles['progress__fill--done']]:
115-
file.status === 'done',
116+
file.status == 'done',
116117
[styles['progress__fill--error']]:
117-
file.status === 'error'
118+
file.status == 'error'
118119
})}
119120
style={{
120121
width: `${
121-
file.status === 'done' || file.status === 'error'
122+
file.status == 'done' || file.status == 'error'
122123
? 100
123-
: file.status === 'receiving' &&
124+
: file.status == 'receiving' &&
124125
file.progress !== undefined
125126
? file.progress
126127
: 0
@@ -129,7 +130,7 @@ export const ProgressModal: React.FC<Props> = (props) => {
129130
/>
130131
)}
131132
</div>
132-
{file.status === 'receiving' &&
133+
{file.status == 'receiving' &&
133134
file.tokens_per_second !== undefined && (
134135
<div className={styles['file-item__details']}>
135136
~{format_tokens_per_second(file.tokens_per_second)}{' '}
@@ -141,10 +142,10 @@ export const ProgressModal: React.FC<Props> = (props) => {
141142
})}
142143
</div>
143144
) : (
144-
<>
145+
<div className={styles.content}>
145146
{props.tokens_per_second !== undefined && (
146147
<div className={styles['tokens-per-second']}>
147-
~{format_tokens_per_second(props.tokens_per_second)} tokens/s
148+
{format_tokens_per_second(props.tokens_per_second)} tokens/s
148149
</div>
149150
)}
150151
<div className={styles.progress}>
@@ -157,7 +158,7 @@ export const ProgressModal: React.FC<Props> = (props) => {
157158
<div className={styles['progress__fill--indeterminate']} />
158159
)}
159160
</div>
160-
</>
161+
</div>
161162
)}
162163
</>
163164
}

‎packages/ui/src/components/editor/panel/modals/StageFilesModal/StageFilesModal.module.scss‎

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,14 @@
1111
font-size: var(--vscode-font-size);
1212

1313
&__details {
14-
display: flex;
15-
flex: 1;
16-
gap: var(--padding-6px);
1714
overflow: hidden;
18-
}
19-
20-
&__name {
2115
white-space: nowrap;
16+
text-overflow: ellipsis;
2217
}
2318

2419
&__path {
25-
white-space: nowrap;
26-
overflow: hidden;
27-
text-overflow: ellipsis;
20+
padding-left: var(--padding-6px);
2821
color: var(--vscode-descriptionForeground);
2922
}
3023
}
3124
}
32-
33-
.actions {
34-
display: flex;
35-
justify-content: flex-end;
36-
gap: var(--padding-8px);
37-
38-
> button {
39-
flex: 1;
40-
}
41-
}

‎packages/ui/src/components/editor/panel/modals/StageFilesModal/StageFilesModal.tsx‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,10 @@ export const StageFilesModal: React.FC<Props> = (props) => {
4848
handle_toggle_file(file, is_checked)
4949
}
5050
/>
51-
<div className={styles.files__item__details}>
52-
<span className={styles.files__item__name} title={filename}>
53-
{filename}
54-
</span>
51+
<div className={styles.files__item__details} title={file}>
52+
<span>{filename}</span>
5553
{dir_path && (
56-
<span className={styles.files__item__path} title={dir_path}>
57-
{dir_path}
58-
</span>
54+
<span className={styles.files__item__path}>{dir_path}</span>
5955
)}
6056
</div>
6157
</label>
@@ -64,7 +60,7 @@ export const StageFilesModal: React.FC<Props> = (props) => {
6460
</div>
6561
}
6662
footer_slot={
67-
<div className={styles.actions}>
63+
<>
6864
<Button on_click={props.on_cancel} is_secondary={true}>
6965
Cancel
7066
</Button>
@@ -75,7 +71,7 @@ export const StageFilesModal: React.FC<Props> = (props) => {
7571
>
7672
Proceed
7773
</Button>
78-
</div>
74+
</>
7975
}
8076
/>
8177
)

0 commit comments

Comments
 (0)