Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/css/dash.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/css/tiles-b2.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/status/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ export const FEED_IDS = Object.freeze(['dualsense', 'encoder', 'host'])
/** The extension components: NVIDIA runtimes the person imports from a file they obtained themselves, each with the one DLL name it takes. */
export const EXTENSION_COMPONENTS = Object.freeze({ dlssnr: { dll: 'nvngx_dlssnr.dll', other: 'nvngx_truehdr.dll' }, rtxhdr: { dll: 'nvngx_truehdr.dll', other: 'nvngx_dlssnr.dll' } })
export const COMPONENT_ICONS = Object.freeze({ vdd: 'desktop_windows', usb: 'usb', vigem: 'gamepad', mic: 'mic', mouse: 'mouse', vulkan: 'hdr_on', dlssnr: 'wand_stars', rtxhdr: 'light_mode', sparxie: 'touch_app', dualsense: 'sports_esports', encoder: 'movie', host: 'cast_connected' })
// The component page and overview use the same icon and tone for each state.
const COMPONENT_STATE_APPEARANCE = {
ok: { tone: 'ok', icon: 'check_circle' },
warn: { tone: 'warn', icon: 'warning' },
error: { tone: 'error', icon: 'error' },
missing: { tone: 'neutral', icon: 'download' },
unknown: { tone: 'neutral', icon: 'help' },
}
export const componentStateAppearance = (state) => Object.hasOwn(COMPONENT_STATE_APPEARANCE, state) ? COMPONENT_STATE_APPEARANCE[state] : COMPONENT_STATE_APPEARANCE.unknown
const RANK = { ok: 0, skip: 0, warn: 1, error: 2 }

const str = (v) => (v === null || v === undefined ? '' : String(v).trim())
Expand Down
8 changes: 2 additions & 6 deletions src/vue/MComponentStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MIcon from './MIcon.vue'
import MChip from './MChip.vue'
import MButton from './MButton.vue'
import MRing from './MRing.vue'
import { COMPONENT_ICONS, EXTENSION_COMPONENTS } from '../status/model.js'
import { COMPONENT_ICONS, EXTENSION_COMPONENTS, componentStateAppearance } from '../status/model.js'
import { fillText } from './guideTexts.js'
import { stampClock } from '../stamp/index.js'

Expand All @@ -18,10 +18,6 @@ const rows = computed(() => props.status.rows.value.filter((r) => r.id !== 'spar
// the page's "updated" stamp: the latest check of any card; clicking it checks them all
const latest = computed(() => Math.max(0, ...rows.value.map((r) => Number(r.result?.at) || 0)))
const busy = computed(() => rows.value.some((r) => r.checking))
// a component that is not installed is a state, not a fault: the chip stays neutral so it does
// not read as a warning, and the hint under the name says it is optional
const TONE = { ok: 'ok', warn: 'warn', error: 'error', missing: 'neutral', unknown: 'neutral' }
const STATE_ICON = { ok: 'check_circle', warn: 'warning', error: 'error', missing: 'download', unknown: 'help' }
const RESULT_ICON = { ok: 'check_circle', warn: 'warning', error: 'error' }
const KINDS = [['install', 'download'], ['import', 'upload_file'], ['update', 'system_update_alt'], ['repair', 'build'], ['open', 'open_in_new'], ['remove', 'delete']]
const EXT = EXTENSION_COMPONENTS
Expand Down Expand Up @@ -64,7 +60,7 @@ onBeforeUnmount(() => props.status.stop())
<p v-else-if="row.state === 'missing'" class="m-comp__hint">{{ T.missingHint }}</p>
<p v-if="row.progress" class="m-comp__progress" data-progress="1">{{ row.progress.stage }}<b>{{ row.progress.percent }}%</b></p>
<div class="m-comp__meta">
<MChip :tone="TONE[row.state]" :icon="STATE_ICON[row.state]">{{ T.states[row.state] }}</MChip>
<MChip v-bind="componentStateAppearance(row.state)">{{ T.states[row.state] }}</MChip>
<span v-if="!hasUpdatePath(row)" class="m-comp__nopath" :title="pathNote(row)"><MIcon name="info" />{{ pathNote(row) }}</span>
<span v-if="row.result" class="m-comp__time">{{ timeOf(row.result) }}</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/vue/MDashCardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const small = () => { if (generic('s')) { const v = smallOf(props.card, props.te
<template>
<MDashStack v-if="card.kind === 'stack'" :card="card" :details="details" :texts="texts" :preview="preview" @act="(a) => emit('act', a)" @rotate="(e) => emit('rotate', e)" @hover="(e) => emit('hover', e)" @suggest="(e) => emit('suggest', e)" @say="(t) => emit('say', t)" @flags="(e) => emit('flags', e)" />
<component :is="design" v-else-if="design" v-bind="rootAttrs" :card="card" :texts="texts" :details="details" :variant="variantOf(card.id)" :chevron="more()" :preview="preview" :empty="emptyView" @act="(a) => act(a.type, a.value)" />
<MDashSmall v-bind="rootAttrs" v-else-if="small()" :small="small()" :group="card.group" :chevron="more()" :square="square()" @click="act('detail')" @act="(a) => act(a.type, a.value)" />
<MDashSmall v-bind="rootAttrs" v-else-if="small()" :class="{ 'm-dsmall--component': card.kind === 'component' }" :small="small()" :group="card.group" :chevron="more()" :square="square()" @click="act('detail')" @act="(a) => act(a.type, a.value)" />
<div v-bind="rootAttrs" v-else-if="generic('l')" class="m-dlarge" :class="{ 'has-side': !!inlineDetail }">
<div class="m-dlarge__main"><MDashCardView :card="{ ...card, size: 'm' }" :details="details" :texts="texts" :preview="preview" @act="(a) => emit('act', a)" /></div>
<aside v-if="inlineDetail" class="m-dlarge__side"><MDashSections :detail="inlineDetail" :uid="card.id" :texts="texts" inline /></aside>
Expand Down
6 changes: 2 additions & 4 deletions src/vue/MDashComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { computed } from 'vue'
import MIcon from './MIcon.vue'
import MChip from './MChip.vue'
import { COMPONENT_ICONS } from '../status/model.js'
import { COMPONENT_ICONS, componentStateAppearance } from '../status/model.js'
import { registeredComponentStatus } from '../status/controller.js'
import { statusTexts } from '../status/texts.js'

Expand All @@ -12,8 +12,6 @@ const props = defineProps({ id: { type: String, required: true } })
const status = registeredComponentStatus()
const T = computed(() => (status ? status.text() : statusTexts('en')))
const row = computed(() => status?.row(props.id) || { state: 'unknown', version: '', note: '', checks: [], result: null, checking: false })
const TONE = { ok: 'ok', warn: 'warn', error: 'error', missing: 'warn', unknown: 'neutral' }
const ICON = { ok: 'check_circle', warn: 'warning', error: 'error', missing: 'warning', unknown: 'help' }
const sub = computed(() => row.value.version || row.value.note || (row.value.state === 'unknown' ? T.value.unknownNote : ''))
const problems = computed(() => row.value.checks.filter((c) => c.result === 'error' || c.result === 'warn').length)
</script>
Expand All @@ -26,7 +24,7 @@ const problems = computed(() => row.value.checks.filter((c) => c.result === 'err
<button v-if="status?.openPage" type="button" class="m-dcard__more" :aria-label="T.title" :data-tip="T.title" @click="status.openPage()"><MIcon name="chevron_right" /></button>
</header>
<div class="m-dcard__body m-dcomp__body">
<MChip :tone="TONE[row.state]" :icon="ICON[row.state]">{{ T.states[row.state] }}</MChip>
<MChip v-bind="componentStateAppearance(row.state)">{{ T.states[row.state] }}</MChip>
<p class="m-dcomp__sub">{{ sub }}</p>
<p v-if="problems" class="m-dcomp__sub">{{ T.checks[row.checks.find((c) => c.result === 'error' || c.result === 'warn').id] || '' }}</p>
<button v-if="status" type="button" class="m-dpill m-dcomp__check" :disabled="row.checking" @click="status.check(id)"><MIcon name="monitor_heart" />{{ row.checking ? T.checking : T.check }}</button>
Expand Down
5 changes: 3 additions & 2 deletions src/vue/homeSmall.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions src/vue/tiles/TileComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ export const tileIds = ['comp:*']
</script>

<script setup>
// 组件状态 (虚拟显示器驱动, USB 转发, ViGEmBus, 虚拟麦克风, 虚拟鼠标, Vulkan HDR 层, DLSS 降噪, RTX HDR) in the calibrated calm language (round 31; REFERENCES.md "comp_*":
// Home Assistant's entity rows, One UI's Device care, Pixel Battery's trailing status). A component that is fine is not news: its plate is quiet; only a problem fills it
// with the error container. 方形: the component icon in the header, the state in the plate and the version under it; 中 adds the failing check and the check button.
// 方形 shows the component icon, state and version. 中 adds the failing check and the check button.
// It reads the component status the window registered (status/controller.js), like the card it replaces; without one the state is 未知.
import { computed } from 'vue'
import MIcon from '../MIcon.vue'
import { COMPONENT_ICONS } from '../../status/model.js'
import { COMPONENT_ICONS, componentStateAppearance } from '../../status/model.js'
import { registeredComponentStatus } from '../../status/controller.js'
import { statusTexts } from '../../status/texts.js'
import { designProps } from './tileData.js'
Expand All @@ -21,7 +19,7 @@ const size = computed(() => (props.card.size === 'm' ? 'm' : 's'))
const status = registeredComponentStatus()
const T = computed(() => (status ? status.text() : statusTexts('en')))
const row = computed(() => status?.row(cid.value) || { state: 'unknown', version: '', note: '', checks: [], checking: false })
const bad = computed(() => ['error', 'missing', 'warn'].includes(row.value.state))
const appearance = computed(() => componentStateAppearance(row.value.state))
const problem = computed(() => row.value.checks.find((c) => c.result === 'error' || c.result === 'warn'))
const sub = computed(() => (problem.value ? T.value.checks[problem.value.id] || '' : row.value.version ? `v${row.value.version}` : row.value.note || (row.value.state === 'unknown' ? T.value.unknownNote : '')))
// the short name on a square ('USB 转发', not 'Foundation USB 转发')
Expand All @@ -32,10 +30,10 @@ const name = computed(() => { const n = String(T.value.names?.[cid.value] || pro
</script>

<template>
<section class="m-tile m-cal m-b2 m-b2comp" :class="[`is-${size}`, { 'is-bad': bad }]" :data-state="row.state" :data-size="size" data-accent="primary">
<section class="m-tile m-cal m-b2 m-b2comp" :class="`is-${size}`" :data-state="row.state" :data-size="size" data-accent="primary">
<header class="m-calm__head"><MIcon :name="COMPONENT_ICONS[cid]" /><span class="m-calm__title">{{ name }}</span><button v-if="status?.openPage" type="button" class="m-calm__more" :aria-label="T.title" @click.stop="status.openPage()"><MIcon name="chevron_right" /></button></header>
<div :class="size === 'm' ? 'm-b2comp__body' : ''" :style="size === 's' ? 'display: contents' : ''">
<div class="m-b2plate" :class="bad ? 'is-warn' : 'is-quiet'"><span class="m-b2__state"><MIcon :name="bad ? 'error' : 'check_circle'" /><b :title="T.states[row.state]">{{ T.states[row.state] }}</b></span></div>
<div class="m-b2plate is-quiet" :data-tone="appearance.tone"><span class="m-b2__state"><MIcon :name="appearance.icon" /><b :title="T.states[row.state]">{{ T.states[row.state] }}</b></span></div>
<div v-if="size === 'm'" class="m-b2comp__side"><span class="m-b2__line">{{ sub }}</span><button v-if="status" type="button" class="m-b2__btn is-tonal" style="align-self: flex-start" :disabled="row.checking" @click.stop="status.check(cid)"><MIcon name="monitor_heart" />{{ row.checking ? T.checking : T.check }}</button></div>
<span v-else class="m-b2__cap" style="margin-top: 6px">{{ sub }}</span>
</div>
Expand Down
Loading