Skip to content

Commit 5f34b04

Browse files
committed
Merge branch 'feature/up' into develop
2 parents 6addf71 + 7700f26 commit 5f34b04

35 files changed

Lines changed: 927 additions & 413 deletions

src-tauri/Cargo.lock

Lines changed: 149 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/capabilities/main.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@
33
"identifier": "main-window",
44
"description": "Capabilities for the main window: core defaults plus the dialog plugin for import/export file pickers.",
55
"windows": ["main"],
6-
"permissions": ["core:default", "core:window:allow-start-dragging", "dialog:default", "updater:default"]
6+
"permissions": [
7+
"core:default",
8+
"core:window:allow-start-dragging",
9+
"core:window:allow-minimize",
10+
"core:window:allow-toggle-maximize",
11+
"dialog:default",
12+
"updater:default"
13+
]
714
}

src-tauri/src/storage/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub struct AppConfig {
2626
pub left_panel_show: bool,
2727
pub left_panel_width: u32,
2828
pub right_panel_show: bool,
29+
pub right_panel_width: u32,
2930
pub use_system_window_frame: bool,
3031

3132
// preferences
@@ -63,6 +64,7 @@ impl Default for AppConfig {
6364
left_panel_show: true,
6465
left_panel_width: 270,
6566
right_panel_show: true,
67+
right_panel_width: 240,
6668
use_system_window_frame: false,
6769

6870
write_mode: "append".to_string(),

src/common/default_configs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const configs = {
1111
left_panel_show: true,
1212
left_panel_width: 270,
1313
right_panel_show: true,
14+
right_panel_width: 240,
1415
use_system_window_frame: false,
1516

1617
// preferences
Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
@use '../../styles/common';
2-
31
.root {
4-
// padding-bottom: 20px;
5-
62
a {
73
color: var(--swh-primary-color);
84

@@ -20,21 +16,9 @@
2016
}
2117

2218
.names {
23-
@include common.swh-scroll-y;
24-
display: flex;
25-
flex-wrap: wrap;
26-
gap: 4px 16px;
27-
//justify-content: center;
2819
margin: 8px 0;
29-
//max-width: 350px;
3020
max-height: 160px;
31-
overflow-y: auto;
3221
border: 1px solid var(--swh-border-color-1);
3322
border-radius: 4px;
3423
padding: 8px;
35-
36-
// a {
37-
// margin: 0 0.5em;
38-
// display: inline-block;
39-
// }
4024
}

src/renderer/components/About/AboutContent.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import logo from '@/assets/logo@512w.png'
77
import version from '@/version.json'
88
import acknowledgements from '@common/acknowledgements'
99
import { homepageUrl, sourceUrl } from '@common/constants'
10-
import { Box, Center, Flex, Image, Stack } from '@mantine/core'
10+
import { Center, Flex, Image, ScrollArea, Stack } from '@mantine/core'
1111
import { default as Link } from '@renderer/components/BrowserLink'
1212
import useI18n from '@renderer/models/useI18n'
1313
import styles from './AboutContent.module.scss'
@@ -29,13 +29,15 @@ const AboutContent = () => {
2929
</Flex>
3030

3131
<Center style={{ paddingTop: 32, fontWeight: 'bold' }}>{lang.acknowledgement}</Center>
32-
<Box className={styles.names}>
33-
{acknowledgements.map((o, idx) => (
34-
<Link key={idx} href={o.link}>
35-
{o.name}
36-
</Link>
37-
))}
38-
</Box>
32+
<ScrollArea className={styles.names} scrollbars="y" type="hover">
33+
<Flex wrap="wrap" gap="4px 16px">
34+
{acknowledgements.map((o, idx) => (
35+
<Link key={idx} href={o.link}>
36+
{o.name}
37+
</Link>
38+
))}
39+
</Flex>
40+
</ScrollArea>
3941
</Stack>
4042
)
4143
}

src/renderer/components/Editor/HostsEditor.module.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@
3030
// monospace rule which is injected after this stylesheet at runtime.
3131
.cm-scroller {
3232
font-family: common.$font-editor;
33+
34+
&::-webkit-scrollbar {
35+
width: 8px;
36+
height: 8px;
37+
}
38+
&::-webkit-scrollbar-track {
39+
background: transparent;
40+
}
41+
&::-webkit-scrollbar-thumb {
42+
background: var(--swh-scrollbar-thumb);
43+
border-radius: 4px;
44+
}
45+
&::-webkit-scrollbar-thumb:hover {
46+
background: var(--swh-scrollbar-thumb-hover, var(--swh-scrollbar-thumb));
47+
}
48+
&::-webkit-scrollbar-corner {
49+
background: transparent;
50+
}
3351
}
3452
}
3553

src/renderer/components/History.module.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
.item {
2+
border-radius: 4px;
3+
4+
& + & {
5+
margin-top: 2px;
6+
}
7+
}
8+
19
.selected {
210
background: var(--swh-tree-selected-bg);
311
color: var(--swh-font-color-reverse);

src/renderer/components/History.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
Group,
1414
Loader,
1515
NativeSelect,
16+
ScrollArea,
1617
Text,
1718
Tooltip,
1819
} from '@mantine/core'
@@ -60,13 +61,15 @@ const HistoryList = (props: IHistoryProps): React.ReactElement => {
6061
>
6162
<HostsViewer content={selectedItem ? selectedItem.content : ''} />
6263
</Box>
63-
<Box
64+
<ScrollArea
6465
w={200}
6566
h="100%"
67+
scrollbars="y"
68+
type="hover"
6669
style={{
67-
overflow: 'auto',
6870
border: '1px solid var(--swh-border-color-0)',
6971
borderRadius: 6,
72+
padding: 4,
7073
}}
7174
>
7275
{list.map((item) => (
@@ -76,7 +79,7 @@ const HistoryList = (props: IHistoryProps): React.ReactElement => {
7679
px="12px"
7780
py="8px"
7881
style={{ userSelect: 'none' }}
79-
className={clsx(item.id === selectedItem?.id && styles.selected)}
82+
className={clsx(styles.item, item.id === selectedItem?.id && styles.selected)}
8083
>
8184
<Group gap="8px" wrap="nowrap" align="flex-start">
8285
<Box>
@@ -99,7 +102,7 @@ const HistoryList = (props: IHistoryProps): React.ReactElement => {
99102
</Group>
100103
</Box>
101104
))}
102-
</Box>
105+
</ScrollArea>
103106
</Flex>
104107
)
105108
}
@@ -218,11 +221,7 @@ const History = () => {
218221
{isLoading ? (
219222
<Loading />
220223
) : (
221-
<HistoryList
222-
list={list}
223-
selectedItem={selectedItem}
224-
setSelectedItem={setSelectedItem}
225-
/>
224+
<HistoryList list={list} selectedItem={selectedItem} setSelectedItem={setSelectedItem} />
226225
)}
227226
</Box>
228227
</SideDrawer>
Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,84 @@
1-
@use "../styles/common";
1+
@use '../styles/common';
22

33
.root {
44
@include common.code;
5+
width: 100%;
56
height: 100%;
67
}
78

8-
.content {
9+
.editor {
910
height: calc(100% - var(--swh-status-bar-height));
10-
background: var(--swh-editor-read-only-bg);
11-
font-size: var(--swh-editor-font-size);
12-
line-height: var(--swh-editor-line-height);
13-
color: var(--swh-editor-text-color);
14-
overflow: auto;
15-
padding: 8px 10px;
11+
box-sizing: border-box;
12+
overflow: hidden;
13+
14+
:global {
15+
.cm-editor {
16+
height: 100%;
17+
18+
&.cm-focused {
19+
outline: none;
20+
}
21+
22+
.cm-scroller {
23+
font-family: common.$font-editor;
24+
25+
&::-webkit-scrollbar {
26+
width: 8px;
27+
height: 8px;
28+
}
29+
&::-webkit-scrollbar-track {
30+
background: transparent;
31+
}
32+
&::-webkit-scrollbar-thumb {
33+
background: var(--swh-scrollbar-thumb);
34+
border-radius: 4px;
35+
}
36+
&::-webkit-scrollbar-thumb:hover {
37+
background: var(--swh-scrollbar-thumb-hover, var(--swh-scrollbar-thumb));
38+
}
39+
&::-webkit-scrollbar-corner {
40+
background: transparent;
41+
}
42+
}
43+
}
44+
45+
.hl-comment {
46+
color: var(--swh-editor-comment);
47+
}
48+
49+
.hl-ip {
50+
color: var(--swh-editor-ip);
51+
font-weight: bold;
52+
}
53+
54+
.hl-error {
55+
color: var(--swh-editor-error);
56+
}
57+
}
58+
59+
&.read_only {
60+
:global {
61+
.cm-editor,
62+
.cm-gutters {
63+
background: var(--swh-editor-read-only-bg);
64+
}
65+
66+
.cm-content {
67+
caret-color: transparent;
68+
opacity: 0.8;
69+
}
70+
}
71+
}
72+
}
73+
74+
.mount {
75+
height: 100%;
1676
}
1777

18-
.line {
19-
min-height: var(--swh-editor-line-height);
78+
:global(.theme-dark) {
79+
.editor.read_only {
80+
:global(.cm-content) {
81+
caret-color: transparent;
82+
}
83+
}
2084
}

0 commit comments

Comments
 (0)