refactor: 使用 Naive UI 重构后台布局与黑白双主题
This commit is contained in:
1 parent
55516537bf
commit
db8c176b55
51 files changed
+3277
-2442
No files matched your search
@@ -1,14 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { NTag } from 'naive-ui'
|
||||
import { statusLabels } from '../../lib/format'
|
||||
import type { ProjectStatus } from '../../features/projects/types'
|
||||
|
||||
/** 状态同时提供文字和颜色,避免只依赖色觉。 */
|
||||
defineProps<{ status: string; label?: string }>()
|
||||
/** 状态使用 Naive 标签,同时保留文本,避免仅依赖颜色区分。 */
|
||||
const props = defineProps<{ status: string; label?: string }>()
|
||||
const type = computed(() =>
|
||||
['failed', 'blocked', 'cancelled'].includes(props.status)
|
||||
? 'error'
|
||||
: ['completed', 'ready'].includes(props.status)
|
||||
? 'success'
|
||||
: ['running', 'generating', 'pending', 'unlocked', 'candidate_pending'].includes(props.status)
|
||||
? 'warning'
|
||||
: 'default'
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="status-badge" :data-status="status">
|
||||
<span class="status-dot" aria-hidden="true"></span
|
||||
>{{ label || statusLabels[status as ProjectStatus] || status }}
|
||||
</span>
|
||||
<NTag :type="type" size="small" :bordered="false" :data-status="status">{{
|
||||
label || statusLabels[status as ProjectStatus] || status
|
||||
}}</NTag>
|
||||
</template>
|
||||
Reference in new issue
Block a user