mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
feat(webui): 顶栏瘦身与配色优化
- 状态胶囊并入标题下方一行(圆点 + 状态 + 版本),横向空间宽松很多 - 顶栏背景改用页面背景色(不再是一块突兀的白色),滚动后才加容器色 - 刷新移至状态页(语义所在),重启收进「更多」菜单带文字标签, 解决刷新/重启两个图标几乎无法区分的问题
This commit is contained in:
1 parent
5c9b39a7fb
commit
60f903f58a
3 files changed
+57
-56
No files matched your search
@@ -1,10 +1,9 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { RefreshCw, Pause, Play, RotateCw } from 'lucide-vue-next'
|
||||
import { Pause, Play } from 'lucide-vue-next'
|
||||
import ActionMenu from './ActionMenu.vue'
|
||||
|
||||
const props = defineProps({
|
||||
title: { type: String, default: 'LuminPro' },
|
||||
subtitle: { type: String, default: '' },
|
||||
version: { type: String, default: '' },
|
||||
statusText: { type: String, default: '—' },
|
||||
statusClass: { type: String, default: 'stopped' },
|
||||
@@ -13,7 +12,7 @@ const props = defineProps({
|
||||
scrolled: { type: Boolean, default: false },
|
||||
})
|
||||
|
||||
const emit = defineEmits(['refresh', 'toggle-service', 'restart'])
|
||||
const emit = defineEmits(['toggle-service', 'refresh', 'restart'])
|
||||
|
||||
/** 通道徽标:版本号里带 -beta / -dev 即为对应通道 */
|
||||
const channel = computed(() => {
|
||||
@@ -22,27 +21,34 @@ const channel = computed(() => {
|
||||
if (v.includes('-dev')) return 'Dev'
|
||||
return ''
|
||||
})
|
||||
|
||||
// 刷新与重启都收进「更多」:文字标签比图标更不容易混淆
|
||||
const menuItems = [
|
||||
{ key: 'refresh', label: '刷新状态' },
|
||||
{ key: 'restart', label: '重启模块' },
|
||||
]
|
||||
|
||||
function onMenuSelect(key) {
|
||||
if (key === 'refresh') emit('refresh')
|
||||
else if (key === 'restart') emit('restart')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="app-bar" :class="{ scrolled }">
|
||||
<div class="app-bar__text">
|
||||
<h1 class="app-bar__title ts-title-lg">
|
||||
{{ title }}
|
||||
LuminPro
|
||||
<span v-if="channel" class="channel-badge">{{ channel }}</span>
|
||||
</h1>
|
||||
<span class="app-bar__subtitle ts-body-sm">{{ subtitle || version || '—' }}</span>
|
||||
<span class="app-bar__meta ts-body-sm">
|
||||
<span class="status-dot" :class="statusClass"></span>
|
||||
{{ statusText }}
|
||||
<template v-if="version"> · {{ version }}</template>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span class="status-pill" :class="statusClass">
|
||||
<span class="status-pill__dot"></span>
|
||||
{{ statusText }}
|
||||
</span>
|
||||
|
||||
<div class="app-bar__actions">
|
||||
<md-icon-button title="刷新" @click="emit('refresh')">
|
||||
<RefreshCw :size="20" />
|
||||
</md-icon-button>
|
||||
<md-icon-button
|
||||
:title="paused ? '启用' : '暂停'"
|
||||
:disabled="locked"
|
||||
@@ -51,9 +57,7 @@ const channel = computed(() => {
|
||||
<Play v-if="paused" :size="20" />
|
||||
<Pause v-else :size="20" />
|
||||
</md-icon-button>
|
||||
<md-icon-button title="重启模块" :disabled="locked" @click="emit('restart')">
|
||||
<RotateCw :size="20" />
|
||||
</md-icon-button>
|
||||
<ActionMenu :items="menuItems" :disabled="locked" title="更多操作" @select="onMenuSelect" />
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
+27
-38
@@ -24,7 +24,7 @@
|
||||
min-height: 64px;
|
||||
padding: var(--md-sys-spacing-2) var(--md-sys-spacing-1) var(--md-sys-spacing-2)
|
||||
var(--md-sys-spacing-4);
|
||||
background-color: var(--md-sys-color-surface);
|
||||
background-color: var(--md-sys-color-background);
|
||||
transition: background-color var(--md-sys-motion-duration-medium2)
|
||||
var(--md-sys-motion-easing-standard);
|
||||
}
|
||||
@@ -49,10 +49,35 @@
|
||||
gap: var(--md-sys-spacing-2);
|
||||
}
|
||||
|
||||
.app-bar__subtitle {
|
||||
.app-bar__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
flex: 0 0 auto;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.status-dot.running {
|
||||
background-color: var(--lp-color-success);
|
||||
animation: status-pulse 2.4s var(--md-sys-motion-easing-standard) infinite;
|
||||
}
|
||||
|
||||
.status-dot.paused {
|
||||
background-color: var(--lp-color-warning);
|
||||
}
|
||||
|
||||
.status-dot.stopped {
|
||||
background-color: var(--md-sys-color-error);
|
||||
animation: status-pulse 2s var(--md-sys-motion-easing-standard) infinite;
|
||||
}
|
||||
|
||||
/* 发布通道徽标(Beta / Dev) */
|
||||
.channel-badge {
|
||||
flex: 0 0 auto;
|
||||
@@ -66,42 +91,6 @@
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* 守护进程状态胶囊 */
|
||||
.status-pill {
|
||||
flex: 0 0 auto;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 10px;
|
||||
border-radius: var(--md-sys-shape-corner-full);
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: var(--md-sys-typescale-label-small-size);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.status-pill__dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.status-pill.running .status-pill__dot {
|
||||
background-color: var(--lp-color-success);
|
||||
box-shadow: 0 0 8px var(--lp-color-success-container);
|
||||
animation: status-pulse 2.4s var(--md-sys-motion-easing-standard) infinite;
|
||||
}
|
||||
|
||||
.status-pill.paused .status-pill__dot {
|
||||
background-color: var(--lp-color-warning);
|
||||
}
|
||||
|
||||
.status-pill.stopped .status-pill__dot {
|
||||
background-color: var(--md-sys-color-error);
|
||||
animation: status-pulse 2s var(--md-sys-motion-easing-standard) infinite;
|
||||
}
|
||||
|
||||
@keyframes status-pulse {
|
||||
0%,
|
||||
100% {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { inject, computed, ref } from 'vue'
|
||||
import { SunMedium, Smartphone, Activity, Clock, Moon, Layers, Gauge } from 'lucide-vue-next'
|
||||
import { SunMedium, Smartphone, Activity, Clock, Moon, Layers, Gauge, RefreshCw } from 'lucide-vue-next'
|
||||
import ConfirmDialog from '../components/ConfirmDialog.vue'
|
||||
|
||||
const status = inject('status')
|
||||
@@ -39,6 +39,11 @@ const thresholdPercent = computed(() =>
|
||||
const autoBrightness = computed(() => status.display.value?.autoBrightness ?? null)
|
||||
const nodeError = computed(() => status.brightness.value.error || '')
|
||||
|
||||
async function refresh() {
|
||||
await status.load({ display: true })
|
||||
snackbar('已刷新')
|
||||
}
|
||||
|
||||
async function applyBrightness(value) {
|
||||
try {
|
||||
await status.setBrightness(value)
|
||||
@@ -75,6 +80,9 @@ async function confirmLow() {
|
||||
<div class="section-header">
|
||||
<h2 class="section-title ts-title-md">实时状态</h2>
|
||||
<span v-if="status.error.value" class="state-badge is-unsaved">读取失败</span>
|
||||
<md-icon-button title="刷新" @click="refresh">
|
||||
<RefreshCw :size="20" />
|
||||
</md-icon-button>
|
||||
</div>
|
||||
|
||||
<div class="status-grid">
|
||||
|
||||
Reference in new issue
Block a user