Skip to content

Commit 276a22f

Browse files
committedMar 26, 2025·
Merge branch 'ui-optimization' into test
2 parents 2372699 + 5d1b9dc commit 276a22f

File tree

15 files changed

+263
-199
lines changed

15 files changed

+263
-199
lines changed
 

‎ui/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@codemirror/lang-markdown": "^6.2.4",
2121
"@codemirror/language-data": "^6.5.0",
22-
"@codemirror/state": "^6.4.1",
22+
"@codemirror/state": "^6.5.0",
2323
"@codemirror/view": "^6.26.1",
2424
"axios": "^1.7.7",
2525
"bootstrap": "^5.3.2",
@@ -80,9 +80,9 @@
8080
"eslint-plugin-promise": "^6.0.0",
8181
"eslint-plugin-react": "^7.33.2",
8282
"eslint-plugin-react-hooks": "^4.6.0",
83-
"husky": "^8.0.1",
83+
"husky": "^9.1.7",
8484
"js-yaml": "^4.1.0",
85-
"lint-staged": "^13.2.3",
85+
"lint-staged": "^15.5.0",
8686
"postcss": "^8.0.0",
8787
"prettier": "^3.1.0",
8888
"purgecss-webpack-plugin": "^4.1.3",

‎ui/pnpm-lock.yaml

+159-116
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ui/src/common/_variable.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
$link-hover-decoration: none;
2121
$enable-negative-margins: true;
22-
$blue: #0033FF !default;
23-
$placeholder-opacity-max: .2;
24-
$placeholder-opacity-min: .1;
22+
$blue: #0033ff !default;
23+
$placeholder-opacity-max: 0.2;
24+
$placeholder-opacity-min: 0.1;
2525
$enable-smooth-scroll: false;

‎ui/src/common/color.scss

+36-37
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
21-
2220
:root {
2321
--an-side-nav-link: rgba(0, 0, 0, 0.65);
2422
--an-toolbar-divider: rgba(0, 0, 0, 0.1);
@@ -29,46 +27,45 @@
2927
--an-212529: #212529;
3028
--an-gray-300: var(--bs-gray-300);
3129
--an-white: #fff;
32-
--an-inbox-warning:#fff3cd80;
30+
--an-inbox-warning: #fff3cd80;
3331
--an-f5: #f5f5f5;
34-
--an-answer-item-border-top: rgba(0, 0, 0, .125);
32+
--an-answer-item-border-top: rgba(0, 0, 0, 0.125);
3533
--an-answer-inbox-nav-border-top: var(--bs-border-color);
36-
--an-comment-item-border-bottom: var(--bs-colors-gray-200, #E9ECEF);
34+
--an-comment-item-border-bottom: var(--bs-colors-gray-200, #e9ecef);
3735
--an-editor-toolbar-hover: #f8f9fa;
3836
--ans-editor-toolbar-focus: #dae0e5;
3937
--an-editor-placeholder-color: #6c757d;
40-
--an-side-nav-link-hover-color: rgba(0, 0, 0, .85);
38+
--an-side-nav-link-hover-color: rgba(0, 0, 0, 0.85);
4139
--an-invite-answer-item-active: #e9ecef;
4240
--an-alert-exist-color: #055160;
4341
}
4442

43+
[data-bs-theme='dark'] {
44+
--an-side-nav-link: rgba(255, 255, 255, 0.65);
45+
--an-toolbar-divider: rgba(255, 255, 255, 0.3);
46+
--an-ced4da: var(--bs-border-color);
47+
--an-e9ecef: #161b22;
48+
--an-pre: #161b22;
49+
--an-6c757d: var(--bs-body-color);
50+
--an-212529: var(--bs-body-color);
51+
--an-gray-300: #161b22;
52+
--an-white: #000;
53+
--an-inbox-warning: #38363180;
54+
--an-f5: var(--bs-body-bg);
55+
--an-answer-item-border-top: var(--bs-border-color);
56+
--an-answer-inbox-nav-border-top: var(--bs-border-color);
57+
--an-comment-item-border-bottom: var(--bs-border-color);
58+
--an-editor-toolbar-hover: var(--bs-tertiary-bg);
59+
--ans-editor-toolbar-focus: var(--bs-tertiary-bg);
60+
--an-editor-placeholder-color: var(--bs-body-color);
61+
--an-side-nav-link-hover-color: var(--bs-body-color);
62+
--an-invite-answer-item-active: var(--bs-tertiary-bg);
63+
--an-alert-exist-color: #60cee4;
64+
}
4565

46-
[data-bs-theme="dark"] {
47-
--an-side-nav-link: rgba(255, 255, 255, 0.65);
48-
--an-toolbar-divider: rgba(255, 255, 255, 0.3);
49-
--an-ced4da: var(--bs-border-color);
50-
--an-e9ecef: #161b22;
51-
--an-pre: #161b22;
52-
--an-6c757d: var(--bs-body-color);
53-
--an-212529: var(--bs-body-color);
54-
--an-gray-300: #161b22;
55-
--an-white: #000;
56-
--an-inbox-warning:#38363180;
57-
--an-f5: var(--bs-body-bg);
58-
--an-answer-item-border-top: var(--bs-border-color);
59-
--an-answer-inbox-nav-border-top: var(--bs-border-color);
60-
--an-comment-item-border-bottom: var(--bs-border-color);
61-
--an-editor-toolbar-hover: var(--bs-tertiary-bg);
62-
--ans-editor-toolbar-focus: var(--bs-tertiary-bg);
63-
--an-editor-placeholder-color: var(--bs-body-color);
64-
--an-side-nav-link-hover-color: var(--bs-body-color);
65-
--an-invite-answer-item-active: var(--bs-tertiary-bg);
66-
--an-alert-exist-color: #60cee4;
67-
}
68-
69-
[data-bs-theme="dark"] {
66+
[data-bs-theme='dark'] {
7067
.link-dark {
71-
color: rgba(var(--bs-emphasis-color-rgb),0.8)!important;
68+
color: rgba(var(--bs-emphasis-color-rgb), 0.8) !important;
7269
}
7370
/** CodeMirror **/
7471

@@ -81,18 +78,20 @@
8178
border-left-color: var(--bs-body-color);
8279
}
8380
.ͼ2.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground {
84-
background-color: #3E4451;
81+
background-color: #3e4451;
8582
}
86-
/** link color **/
83+
/** link color **/
8784
.ͼc {
8885
color: rgb(60, 138, 233);
8986
}
9087
.ͼ5 {
9188
color: var(--bs-body-color);
9289
}
9390

94-
.ͼ2 .cm-selectionBackground {background: #3E4451;}
95-
/** CodeMirror end **/
91+
.ͼ2 .cm-selectionBackground {
92+
background: #3e4451;
93+
}
94+
/** CodeMirror end **/
9695

9796
.bg-light {
9897
background-color: rgba(0, 0, 0, 0.5) !important;
@@ -103,7 +102,8 @@
103102
}
104103
/** side nav **/
105104
#sideNav {
106-
.nav-link:hover, .nav-link.active {
105+
.nav-link:hover,
106+
.nav-link.active {
107107
background-color: #2b3035 !important;
108108
}
109109
}
@@ -136,5 +136,4 @@
136136
.view-level3 {
137137
color: $orange-100;
138138
}
139-
140139
}

‎ui/src/components/AccordionNav/index.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
.collapse-indicator {
21-
transition: all .2s ease;
21+
transition: all 0.2s ease;
2222
}
2323

2424
.expanding .collapse-indicator {

‎ui/src/components/Header/index.scss

+11-12
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
@import 'bootstrap/scss/functions';
2121
@import 'bootstrap/scss/variables';
2222
#header {
23-
transform: translate3d(0,0,0);
23+
transform: translate3d(0, 0, 0);
2424
--bs-navbar-padding-y: 0.75rem;
2525
background: var(--bs-primary);
26-
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15), 0 0.125rem 0.25rem rgb(0 0 0 / 8%);
26+
box-shadow:
27+
inset 0 -1px 0 rgba(0, 0, 0, 0.15),
28+
0 0.125rem 0.25rem rgb(0 0 0 / 8%);
2729
.logo {
2830
max-height: 2rem;
2931
}
@@ -45,7 +47,7 @@
4547
}
4648

4749
.lg-none {
48-
display: none!important;
50+
display: none !important;
4951
}
5052

5153
.hr {
@@ -58,8 +60,8 @@
5860
padding-left: 42px;
5961
box-shadow: none;
6062
color: #fff;
61-
background-color: rgba(255, 255, 255, .2);
62-
border: $border-width $border-style rgba(255, 255, 255, .2);
63+
background-color: rgba(255, 255, 255, 0.2);
64+
border: $border-width $border-style rgba(255, 255, 255, 0.2);
6365
&:focus {
6466
border: $border-width $border-style $border-color;
6567
}
@@ -82,7 +84,7 @@
8284
padding-left: 42px;
8385
box-shadow: none;
8486
color: var(--bs-body-color);
85-
background-color: rgba(255, 255, 255, .2);
87+
background-color: rgba(255, 255, 255, 0.2);
8688
border: $border-width $border-style #dee2e6;
8789
&:focus {
8890
border: $border-width $border-style $border-color;
@@ -97,7 +99,7 @@
9799
}
98100

99101
.maxw-400 {
100-
max-width: 400px;;
102+
max-width: 400px;
101103
}
102104

103105
.search-wrap {
@@ -109,21 +111,18 @@
109111
}
110112
}
111113

112-
113114
@media (max-width: 991.9px) {
114115
#header {
115116
.nav-grow {
116-
flex-grow: 1!important;
117+
flex-grow: 1 !important;
117118
}
118119

119120
.lg-none {
120-
display: flex!important;
121+
display: flex !important;
121122
}
122123

123124
.maxw-400 {
124125
max-width: 100%;
125126
}
126127
}
127-
128128
}
129-

‎ui/src/components/InitialLoadingPlaceholder/index.scss

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
// Same as spin in `public/index.html`
2121

2222
@keyframes _initial-loading-spin {
23-
to { transform: rotate(360deg) }
23+
to {
24+
transform: rotate(360deg);
25+
}
2426
}
2527

2628
.InitialLoadingPlaceholder {
@@ -44,10 +46,10 @@
4446
display: inline-block;
4547
width: 2rem;
4648
height: 2rem;
47-
vertical-align: -.125em;
48-
border: .25rem solid currentColor;
49+
vertical-align: -0.125em;
50+
border: 0.25rem solid currentColor;
4951
border-right-color: transparent;
50-
color: rgba(108, 117, 125, .75);
52+
color: rgba(108, 117, 125, 0.75);
5153
border-radius: 50%;
5254
animation: 0.75s linear infinite _initial-loading-spin;
5355
}

‎ui/src/components/QueryGroup/index.scss

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
display: none;
2525
}
2626

27-
2827
@media screen and (max-width: 768px) {
2928
.md-show {
3029
display: none !important;

‎ui/src/components/SchemaForm/README.md

+29-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ A React component capable of building HTML forms out of a [JSON schema](https://
99
```tsx
1010
import React, { useState } from 'react';
1111

12-
import { SchemaForm, initFormData, JSONSchema, UISchema, FormKit } from '@/components';
12+
import {
13+
SchemaForm,
14+
initFormData,
15+
JSONSchema,
16+
UISchema,
17+
FormKit,
18+
} from '@/components';
1319

1420
const schema: JSONSchema = {
1521
title: 'General',
@@ -48,11 +54,11 @@ const uiSchema: UISchema = {
4854

4955
const Form = () => {
5056
const [formData, setFormData] = useState(initFormData(schema));
51-
57+
5258
const formRef = useRef<{
5359
validator: () => Promise<boolean>;
5460
}>(null);
55-
61+
5662
const refreshConfig: FormKit['refreshConfig'] = async () => {
5763
// refreshFormConfig();
5864
};
@@ -103,9 +109,9 @@ interface FormProps {
103109
## Form Ref
104110

105111
```ts
106-
export interface FormRef {
107-
validator: () => Promise<boolean>;
108-
}
112+
export interface FormRef {
113+
validator: () => Promise<boolean>;
114+
}
109115
```
110116

111117
When you need to validate a form and get the result outside the form, you can create a `FormRef` with `useRef` and pass it to the form using the `ref` property.
@@ -115,6 +121,7 @@ This allows you to validate the form and get the result outside the form using `
115121
---
116122

117123
## Types Definition
124+
118125
### JSONSchema
119126

120127
```ts
@@ -137,6 +144,7 @@ export interface JSONSchema {
137144
```
138145

139146
### UISchema
147+
140148
```ts
141149
export interface UISchema {
142150
[key: string]: {
@@ -147,6 +155,7 @@ export interface UISchema {
147155
```
148156

149157
### UIWidget
158+
150159
```ts
151160
export type UIWidget =
152161
| 'textarea'
@@ -164,6 +173,7 @@ export type UIWidget =
164173
---
165174

166175
### UIOptions
176+
167177
```ts
168178
export type UIOptions =
169179
| InputOptions
@@ -178,6 +188,7 @@ export type UIOptions =
178188
```
179189

180190
#### BaseUIOptions
191+
181192
```ts
182193
export interface BaseUIOptions {
183194
empty?: string;
@@ -197,6 +208,7 @@ export interface BaseUIOptions {
197208
```
198209

199210
#### InputOptions
211+
200212
```ts
201213
export interface InputOptions extends BaseUIOptions {
202214
placeholder?: string;
@@ -219,11 +231,13 @@ export interface InputOptions extends BaseUIOptions {
219231
```
220232

221233
#### SelectOptions
234+
222235
```ts
223236
export interface SelectOptions extends UIOptions {}
224237
```
225238

226239
#### UploadOptions
240+
227241
```ts
228242
export interface UploadOptions extends BaseUIOptions {
229243
acceptType?: string;
@@ -232,30 +246,35 @@ export interface UploadOptions extends BaseUIOptions {
232246
```
233247

234248
#### SwitchOptions
249+
235250
```ts
236251
export interface SwitchOptions extends BaseUIOptions {
237252
label?: string;
238253
}
239254
```
240255

241256
#### TimezoneOptions
257+
242258
```ts
243259
export interface TimezoneOptions extends UIOptions {
244260
placeholder?: string;
245261
}
246262
```
247263

248264
#### CheckboxOptions
265+
249266
```ts
250267
export interface CheckboxOptions extends UIOptions {}
251268
```
252269

253270
#### RadioOptions
271+
254272
```ts
255273
export interface RadioOptions extends UIOptions {}
256274
```
257275

258276
#### TextareaOptions
277+
259278
```ts
260279
export interface TextareaOptions extends UIOptions {
261280
placeholder?: string;
@@ -264,6 +283,7 @@ export interface TextareaOptions extends UIOptions {
264283
```
265284

266285
#### ButtonOptions
286+
267287
```ts
268288
export interface ButtonOptions extends BaseUIOptions {
269289
text: string;
@@ -275,6 +295,7 @@ export interface ButtonOptions extends BaseUIOptions {
275295
```
276296

277297
#### UIAction
298+
278299
```ts
279300
export interface UIAction {
280301
url: string;
@@ -291,6 +312,7 @@ export interface UIAction {
291312
```
292313

293314
#### FormKit
315+
294316
```ts
295317
export interface FormKit {
296318
refreshConfig(): void;
@@ -300,6 +322,7 @@ export interface FormKit {
300322
---
301323

302324
### FormData
325+
303326
```ts
304327
export interface FormValue<T = any> {
305328
value: T;
@@ -350,7 +373,6 @@ For backend generating modal form you can return json like this.
350373
}
351374
```
352375

353-
354376
## reference
355377

356378
- [json schema](https://json-schema.org/understanding-json-schema/index.html)

‎ui/src/components/TagSelector/index.scss

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
overflow: hidden;
7171
max-width: calc(100% - 40px);
7272
}
73-
7473
}
7574

7675
.tag-selector-wrap--focus {

‎ui/src/index.scss

+10-9
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ a {
4848
}
4949
// If the image does not have a `src` attribute, it must break and may not trigger the `onerror` event.
5050
// With or without the `alt` attribute, it is visually hidden directly.
51-
img[src=""] {
51+
img[src=''] {
5252
visibility: hidden !important;
5353
}
5454

@@ -270,7 +270,10 @@ img[src=""] {
270270
word-break: initial;
271271
}
272272
}
273-
ol ol,ol ul,ul ol,ul ul {
273+
ol ol,
274+
ol ul,
275+
ul ol,
276+
ul ul {
274277
margin-bottom: 1rem;
275278
}
276279
}
@@ -329,8 +332,8 @@ img[src=""] {
329332
animation: bg-fade-out 2s ease 0.3s;
330333
}
331334

332-
333-
.btnSvg, .btnSvg:hover {
335+
.btnSvg,
336+
.btnSvg:hover {
334337
display: inline-block;
335338
font-size: 16px;
336339
width: 16px;
@@ -348,17 +351,15 @@ img[src=""] {
348351
}
349352

350353
.bronze {
351-
color: #CD7F32;
354+
color: #cd7f32;
352355
}
353356
.silver {
354-
color: #C0C0C0;
357+
color: #c0c0c0;
355358
}
356359
.gold {
357-
color: #FFD700;
360+
color: #ffd700;
358361
}
359362

360-
361-
362363
.view-level1 {
363364
color: $orange-600;
364365
}

‎ui/src/pages/Questions/Detail/components/InviteToAnswer/index.scss

-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@
2727
border-top: 0;
2828
border-bottom-left-radius: var(--bs-border-radius);
2929
border-bottom-right-radius: var(--bs-border-radius);
30-
3130
}
3231
}

‎ui/src/pages/Questions/Detail/index.scss

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
background-color: var(--bs-gray-100);
2828
}
2929

30-
&:active, &.active {
30+
&:active,
31+
&.active {
3132
background-color: var(--bs-gray-200);
3233
}
3334
}
@@ -47,7 +48,7 @@
4748
z-index: 80;
4849
display: block;
4950
cursor: default;
50-
content: " ";
51+
content: ' ';
5152
}
5253

5354
@media screen and (max-width: 768px) {

‎ui/src/pages/Users/Notifications/components/Achievements/index.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
width: 60px;
2424
flex: none;
2525
}
26-
}
26+
}

‎ui/src/pages/Users/Notifications/index.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919

2020
.inbox-nav {
2121
border-top: 1px solid var(--an-answer-item-border-top);
22-
padding: .5rem 0;
22+
padding: 0.5rem 0;
2323
}

0 commit comments

Comments
 (0)
Please sign in to comment.