mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 01:53:21 +08:00
feat(ui): compact bot connection metadata
This commit is contained in:
parent
59ed364856
commit
2803bbcbab
22 changed files with 632 additions and 556 deletions
48
plugin-src/client/channel-card-meta.js
Normal file
48
plugin-src/client/channel-card-meta.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import * as React from 'react';
|
||||
|
||||
import { h } from './i18n.js';
|
||||
|
||||
export function ChannelListHeading({ className = '', id, title, connectionLabel }) {
|
||||
const helpId = React.useId();
|
||||
return h('div', { className: `${className} dim-listHeading`.trim() },
|
||||
h('div', { className: 'dim-listTitle' },
|
||||
h('h3', id ? { id } : null, title),
|
||||
h('span', { className: 'dim-channelHelp' },
|
||||
h('button', {
|
||||
type: 'button',
|
||||
className: 'dim-channelHelpButton',
|
||||
'aria-label': '查看消息通道说明',
|
||||
'aria-describedby': helpId,
|
||||
}, h('span', { 'aria-hidden': 'true' }, '?')),
|
||||
h('span', {
|
||||
id: helpId,
|
||||
className: 'dim-channelTooltip',
|
||||
role: 'tooltip',
|
||||
},
|
||||
h('span', null, '消息通道'),
|
||||
h('strong', null, connectionLabel)))));
|
||||
}
|
||||
|
||||
export function BotStatusMeta({
|
||||
className = '',
|
||||
dotClassName = '',
|
||||
tone,
|
||||
stateLabel,
|
||||
lastCheckedAt,
|
||||
formatCheckedTime,
|
||||
healthState,
|
||||
}) {
|
||||
return h('div', { className: 'dim-botHealthGroup' },
|
||||
h('div', {
|
||||
className: `${className} dim-botHealth`.trim(),
|
||||
...(healthState ? { 'data-health': healthState } : {}),
|
||||
},
|
||||
h('span', {
|
||||
className: `${dotClassName} dim-healthDot`.trim(),
|
||||
'data-tone': tone,
|
||||
}),
|
||||
h('span', null, stateLabel)),
|
||||
h('div', { className: 'dim-lastChecked' },
|
||||
h('span', null, '最近检查'),
|
||||
h('span', null, formatCheckedTime(lastCheckedAt))));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue