Skip to content

Commit aa4b7eb

Browse files
committed
feat(ui): refine feature flags, switch hover styles, and component interactions
1 parent e7f6e31 commit aa4b7eb

File tree

9 files changed

+52
-24
lines changed

9 files changed

+52
-24
lines changed

frontend/src/assets/styles/custom.less

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
body[debug-outline='true'] {
1+
body[feature-outline='true'] {
22
* {
33
outline: 1px solid var(--color);
44
}
55
}
66

7-
body[debug-no-animation='true'] {
7+
body[feature-no-animation='true'] {
88
* {
99
transition: none !important;
1010
}
1111
}
1212

13-
body[debug-no-rounded='true'] {
13+
body[feature-no-rounded='true'] {
1414
.rounded-2,
1515
.rounded-4,
1616
.rounded-6,
@@ -21,9 +21,15 @@ body[debug-no-rounded='true'] {
2121
.rounded-full {
2222
border-radius: 0;
2323
}
24+
::-webkit-scrollbar-track {
25+
border-radius: 0;
26+
}
27+
::-webkit-scrollbar-thumb {
28+
border-radius: 0;
29+
}
2430
}
2531

26-
body[debug-border='true'] {
32+
body[feature-border='true'] {
2733
box-shadow: inset 0 0 1px var(--color);
2834
}
2935

frontend/src/assets/styles/theme.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@
6767

6868
// Switch
6969
--switch-on-bg: ~'var(--switch-on-bg-@{theme})';
70+
--switch-on-hover-bg: ~'var(--switch-on-hover-bg-@{theme})';
7071
--switch-on-dot-bg: ~'var(--switch-on-dot-bg-@{theme})';
7172
--switch-off-bg: ~'var(--switch-off-bg-@{theme})';
73+
--switch-off-hover-bg: ~'var(--switch-off-hover-bg-@{theme})';
7274
--switch-off-dot-bg: ~'var(--switch-off-dot-bg-@{theme})';
7375

7476
// Input

frontend/src/assets/styles/utilities/others.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@
122122
cursor: move;
123123
}
124124

125+
.cursor-not-allowed {
126+
cursor: not-allowed;
127+
}
128+
125129
.pointer-events-none {
126130
pointer-events: none;
127131
}

frontend/src/assets/styles/variables.less

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,17 @@
111111

112112
// Switch
113113
--switch-on-bg-light: var(--primary-color);
114+
--switch-on-hover-bg-light: var(--secondary-color);
114115
--switch-on-dot-bg-light: #fff;
115116
--switch-on-bg-dark: var(--primary-color);
117+
--switch-on-hover-bg-dark: var(--secondary-color);
116118
--switch-on-dot-bg-dark: #fff;
117119

118120
--switch-off-bg-light: rgba(0, 0, 0, 0.06);
121+
--switch-off-hover-bg-light: rgba(0, 0, 0, 0.1);
119122
--switch-off-dot-bg-light: #fff;
120-
--switch-off-bg-dark: rgba(255, 255, 255, 0.06);
123+
--switch-off-bg-dark: rgba(255, 255, 255, 0.1);
124+
--switch-off-hover-bg-dark: rgba(255, 255, 255, 0.06);
121125
--switch-off-dot-bg-dark: #fff;
122126

123127
// Input

frontend/src/components/ColorPicker/index.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const pick = () => {
2020
<template>
2121
<div
2222
:class="{ 'pl-8': $slots.prefix, 'pr-8': $slots.suffix }"
23-
class="gui-color-picker rounded-full inline-flex items-center overflow-hidden"
23+
class="gui-color-picker rounded-full inline-flex items-center overflow-hidden cursor-pointer duration-200"
2424
>
2525
<div v-if="$slots.prefix" class="flex items-center line-clamp-1 break-all">
2626
<slot name="prefix" v-bind="{ pick }"></slot>
@@ -43,6 +43,10 @@ const pick = () => {
4343
color: var(--color);
4444
border: 1px solid var(--primary-color);
4545
background: var(--color-picker-bg);
46+
47+
&:hover {
48+
color: var(--primary-color);
49+
}
4650
}
4751
4852
input::-webkit-color-swatch-wrapper {
@@ -52,7 +56,13 @@ input::-webkit-color-swatch-wrapper {
5256
}
5357
5458
input::-webkit-color-swatch {
55-
border-radius: 6px;
59+
border-radius: 8px;
5660
border: none;
5761
}
62+
63+
body[feature-no-rounded='true'] {
64+
input::-webkit-color-swatch {
65+
border-radius: 0;
66+
}
67+
}
5868
</style>

frontend/src/components/Switch/index.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ const toggle = () => {
3939
size,
4040
border,
4141
model ? 'on' : 'off',
42-
disabled ? 'disabled' : '',
4342
border === 'square' ? 'rounded-4' : 'rounded-full',
43+
{ 'cursor-not-allowed': disabled },
4444
]"
45-
class="gui-switch relative cursor-pointer h-24 inline-flex items-center text-12"
45+
class="gui-switch relative cursor-pointer h-24 inline-flex items-center text-12 duration-200"
4646
>
4747
<div
4848
:class="[border === 'square' ? 'rounded-4' : 'rounded-full']"
@@ -59,9 +59,9 @@ const toggle = () => {
5959
<style lang="less" scoped>
6060
.gui-switch {
6161
min-width: 50px;
62-
.slot {
63-
transition: margin 0.2s;
64-
}
62+
// .slot {
63+
// transition: margin 0.2s;
64+
// }
6565
}
6666
6767
.small {
@@ -81,6 +81,9 @@ const toggle = () => {
8181
.on {
8282
color: #fff;
8383
background-color: var(--switch-on-bg);
84+
&:hover {
85+
background-color: var(--switch-on-hover-bg);
86+
}
8487
.dot {
8588
left: calc(100% - 22px);
8689
background-color: var(--switch-on-dot-bg);
@@ -115,6 +118,9 @@ const toggle = () => {
115118
.off {
116119
color: var(--card-color);
117120
background-color: var(--switch-off-bg);
121+
&:hover {
122+
background-color: var(--switch-off-hover-bg);
123+
}
118124
.dot {
119125
left: 4px;
120126
background-color: var(--switch-off-dot-bg);
@@ -142,8 +148,4 @@ const toggle = () => {
142148
}
143149
}
144150
}
145-
146-
.disabled {
147-
cursor: not-allowed;
148-
}
149151
</style>

frontend/src/lang/locale/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ export default {
619619
addGroupToMenu: 'Add proxy group to tray menu',
620620
multipleInstance: 'Allow multiple app instances',
621621
rollingRelease: 'Enable Rolling Release',
622-
debugOutline: 'Show interface outline',
622+
debugOutline: 'Show component outlines',
623623
debugNoAnimation: 'Disable animations',
624624
debugNoRounded: 'Disable rounded corners',
625625
debugBorder: 'Show window border',

frontend/src/lang/locale/zh.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ export default {
570570
green: '绿色',
571571
purple: '紫色',
572572
custom: '自定义',
573-
primary: '主颜色',
574-
secondary: '次颜色',
573+
primary: '主色',
574+
secondary: '辅助色',
575575
},
576576
fontFamily: '字体',
577577
resetFont: '重置字体',
@@ -618,7 +618,7 @@ export default {
618618
addGroupToMenu: '将代理组添加到托盘菜单',
619619
multipleInstance: '允许多APP实例运行',
620620
rollingRelease: '启用滚动发行',
621-
debugOutline: '显示界面轮廓',
621+
debugOutline: '组件轮廓',
622622
debugNoAnimation: '禁用动画',
623623
debugNoRounded: '禁用圆角',
624624
debugBorder: '显示窗口边框',

frontend/src/stores/appSettings.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ export const useAppSettingsStore = defineStore('app-settings', () => {
188188
document.documentElement.style.setProperty('--primary-color', primary)
189189
document.documentElement.style.setProperty('--secondary-color', secondary)
190190
document.body.style.fontFamily = settings.fontFamily
191-
document.body.setAttribute('debug-outline', String(settings.debugOutline))
192-
document.body.setAttribute('debug-no-animation', String(settings.debugNoAnimation))
193-
document.body.setAttribute('debug-no-rounded', String(settings.debugNoRounded))
194-
document.body.setAttribute('debug-border', String(settings.debugBorder))
191+
document.body.setAttribute('feature-outline', String(settings.debugOutline))
192+
document.body.setAttribute('feature-no-animation', String(settings.debugNoAnimation))
193+
document.body.setAttribute('feature-no-rounded', String(settings.debugNoRounded))
194+
document.body.setAttribute('feature-border', String(settings.debugBorder))
195195
}
196196

197197
watch(

0 commit comments

Comments
 (0)