Skip to content

Commit 1c09753

Browse files
committed
refactor: the loading result screen
1 parent 68a4fb4 commit 1c09753

File tree

5 files changed

+29
-26
lines changed

5 files changed

+29
-26
lines changed

src/renderer/components/Toolbar/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ interface ToolbarItemProps {
99
badge?: number;
1010
disabled?: boolean;
1111
onClick?: () => void;
12+
primary?: boolean;
13+
destructive?: boolean;
1214
}
1315

1416
export default function Toolbar({
@@ -37,10 +39,20 @@ Toolbar.Item = function ({
3739
onClick,
3840
badge,
3941
disabled,
42+
destructive,
43+
primary,
4044
}: ToolbarItemProps) {
45+
const className = [
46+
styles.button,
47+
destructive ? styles.destructive : undefined,
48+
primary ? styles.primary : undefined,
49+
]
50+
.filter(Boolean)
51+
.join(' ');
52+
4153
return (
4254
<li
43-
className={styles.button}
55+
className={className}
4456
onClick={disabled ? undefined : onClick}
4557
style={{ opacity: disabled ? 0.5 : 1 }}
4658
>

src/renderer/components/Toolbar/styles.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
}
6161
}
6262

63+
.button.destructive {
64+
color: var(--color-critical);
65+
}
66+
6367
.toolbar {
6468
ul {
6569
list-style-type: none;

src/renderer/screens/DatabaseScreen/QueryResultViewer/QueryResultLoading.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { faSpinner } from '@fortawesome/free-solid-svg-icons';
22
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
33
import styles from './styles.module.scss';
44
import { useEffect, useState, useCallback } from 'react';
5-
import Button from 'renderer/components/Button';
6-
import Stack from 'renderer/components/Stack';
5+
import Toolbar from 'renderer/components/Toolbar';
76

87
export default function QueryResultLoading() {
98
const [initialTime] = useState(Date.now());
@@ -25,12 +24,11 @@ export default function QueryResultLoading() {
2524
return (
2625
<div className={styles.result}>
2726
<div className={styles.container}></div>
28-
<div className={styles.footer} style={{ padding: '5px 10px' }}>
29-
<Stack>
27+
<Toolbar shadowTop>
28+
<Toolbar.Text>
3029
<div
3130
style={{
3231
width: 125,
33-
borderRight: '1px solid var(--color-surface-hover)',
3432
alignItems: 'center',
3533
display: 'flex',
3634
}}
@@ -39,11 +37,14 @@ export default function QueryResultLoading() {
3937
<FontAwesomeIcon icon={faSpinner} spin /> &nbsp;{' '}
4038
{Math.round((currentTime - initialTime) / 1000)}s
4139
</div>
42-
<Button destructive onClick={onTerminateQueryClicked}>
43-
Terminate
44-
</Button>
45-
</Stack>
46-
</div>
40+
</Toolbar.Text>
41+
<Toolbar.Separator />
42+
<Toolbar.Item
43+
onClick={onTerminateQueryClicked}
44+
text="Terminate"
45+
destructive
46+
/>
47+
</Toolbar>
4748
</div>
4849
);
4950
}

src/renderer/screens/DatabaseScreen/QueryResultViewer/styles.module.scss

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@
77
color: var(--color-text);
88
}
99

10-
.footer {
11-
box-shadow: var(--color-shadow) 0 1.95px 5px;
12-
}
13-
14-
.footerPage {
15-
display: flex;
16-
justify-content: center;
17-
align-items: center;
18-
}
19-
20-
.footerAction {
21-
flex-grow: 1;
22-
}
23-
2410
.container {
2511
flex-grow: 1;
2612
white-space: nowrap;

src/renderer/screens/DatabaseScreen/QueryWindow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export default function QueryWindow({
205205
}, [tabKey, setTabData, initialSql]);
206206

207207
return (
208-
<Splitter vertical primaryIndex={1} secondaryInitialSize={200}>
208+
<Splitter vertical primaryIndex={1} secondaryInitialSize={500}>
209209
<div className={styles.queryContainer}>
210210
<QueryHeader tabKey={tabKey} onSave={savedQuery} />
211211

0 commit comments

Comments
 (0)