Skip to content

Commit c2ab064

Browse files
committed
webui: minor ui optimize
1 parent 873c8c8 commit c2ab064

5 files changed

Lines changed: 27 additions & 9 deletions

File tree

webui/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async function reboot(reason = "") {
8787
document.addEventListener('DOMContentLoaded', async () => {
8888
document.querySelectorAll('[unresolved]').forEach(el => el.removeAttribute('unresolved'));
8989
const splash = document.getElementById('splash');
90-
if (splash) setTimeout(() => splash.classList.add('show'), 50);
90+
if (splash) setTimeout(() => splash.classList.add('show'), 20);
9191

9292
setupRoute();
9393

@@ -179,8 +179,8 @@ document.addEventListener('DOMContentLoaded', async () => {
179179

180180
// splash screen
181181
if (splash) {
182-
setTimeout(() => splash.classList.add('exit'), 100);
183-
setTimeout(() => splash.remove(), 700);
182+
setTimeout(() => splash.classList.add('exit'), 50);
183+
setTimeout(() => splash.remove(), 400);
184184
}
185185
});
186186

webui/page/kpm.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ async function handleFileUpload(accept, containerId, onSelected) {
250250
}
251251

252252
async function uploadAndLoadModule() {
253+
const loadBtn = document.getElementById('load');
253254
handleFileUpload('.kpm', 'kpm-list', async (file, onProgress, signal) => {
255+
loadBtn.classList.add('hide');
254256
const tmpPath = `${modDir}/tmp/${file.name}`;
255257
try {
256258
await exec(`mkdir -p ${modDir}/tmp && rm -rf ${modDir}/tmp/*`);
@@ -294,6 +296,8 @@ async function uploadAndLoadModule() {
294296
} catch (e) {
295297
exec(`rm -rf ${modDir}/tmp`);
296298
throw e;
299+
} finally {
300+
loadBtn.classList.remove('hide');
297301
}
298302
});
299303
}

webui/page/patch.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,12 @@ function openOptionDialog(item) {
267267
}
268268

269269
async function embedKPM() {
270+
const embedBtn = document.getElementById('embed');
271+
const startBtn = document.getElementById('start');
270272
handleFileUpload('.kpm', 'kpm-embed-list', async (file, onProgress, signal) => {
273+
embedBtn.disabled = true;
274+
startBtn.disabled = true;
275+
271276
// Generate random filename
272277
const randName = Math.random().toString(36).substring(7) + '.kpm';
273278
const tmpPath = `${modDir}/tmp/${randName}`;
@@ -277,6 +282,9 @@ async function embedKPM() {
277282
} catch (e) {
278283
exec(`rm -f ${tmpPath}`);
279284
throw e;
285+
} finally {
286+
embedBtn.disabled = false;
287+
startBtn.disabled = false;
280288
}
281289

282290
const result = await exec(`kptools -l -M "${randName}"`, {

webui/styles.css

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ body {
2121
background-color: var(--md-sys-color-surface);
2222
z-index: 99;
2323
opacity: 1;
24-
transition: opacity 0.6s ease;
24+
transition: opacity 0.3s ease;
2525

2626
svg {
2727
width: min(50vw, 360px);
2828
height: auto;
2929
fill: var(--md-sys-color-on-surface);
3030
opacity: 0;
31-
transition: opacity 0.1s ease;
31+
transition: opacity 0.05s ease;
3232
}
3333
}
3434

@@ -38,7 +38,7 @@ body {
3838

3939
.splash.exit {
4040
opacity: 0;
41-
pointer-events: none;
41+
pointer-events: none;
4242
}
4343

4444
.root_layout {
@@ -180,7 +180,7 @@ body {
180180
.card {
181181
width: 100%;
182182
border-radius: 20px;
183-
background-color: var(--md-sys-color-surface-container);
183+
background-color: var(--md-sys-color-tonal-surface);
184184
padding: 20px;
185185
box-sizing: border-box;
186186
user-select: none;
@@ -248,6 +248,7 @@ body {
248248
}
249249

250250
.info [slot="detail"] {
251+
font-size: 0.95em;
251252
color: var(--md-sys-color-outline);
252253
}
253254

@@ -297,7 +298,7 @@ body {
297298
}
298299

299300
.module-card-actions {
300-
padding-top: 16px;
301+
padding-top: 8px;
301302
display: flex;
302303
gap: 12px;
303304
justify-content: flex-end;
@@ -338,9 +339,12 @@ md-fab {
338339
transition: all 0.2s ease;
339340
}
340341

341-
md-fab.hide {
342+
md-fab.hide,
343+
md-filled-button.hide,
344+
md-outlined-button.hide {
342345
transform: scale(0);
343346
opacity: 0;
347+
pointer-events: none;
344348
}
345349

346350
md-outlined-select,

webui/theme.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
--md-sys-color-inverse-primary: var(--inversePrimary, #D0BCFF);
3838
--md-sys-color-surface-bright: var(--surfaceBright, #FEF7FF);
3939
--md-sys-color-surface-dim: var(--surfaceDim, #DED8E1);
40+
--md-sys-color-tonal-surface: var(--tonalSurface, #F3EDF7);
4041
--md-sys-color-surface-container: var(--surfaceContainer, #F3EDF7);
4142
--md-sys-color-surface-container-lowest: var(--surfaceContainerLowest, #FFFFFF);
4243
--md-sys-color-surface-container-low: var(--surfaceContainerLow, #F7F2FA);
@@ -76,6 +77,7 @@
7677
--md-sys-color-inverse-primary: var(--inversePrimary, #6750A4);
7778
--md-sys-color-surface-bright: var(--surfaceBright, #3B383E);
7879
--md-sys-color-surface-dim: var(--surfaceDim, #141218);
80+
--md-sys-color-tonal-surface: var(--tonalSurface, #211F26);
7981
--md-sys-color-surface-container: var(--surfaceContainer, #211F26);
8082
--md-sys-color-surface-container-lowest: var(--surfaceContainerLowest, #0F0D13);
8183
--md-sys-color-surface-container-low: var(--surfaceContainerLow, #1D1B20);

0 commit comments

Comments
 (0)