mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-14 02:03:18 +08:00
feat: add stable proactive delivery
This commit is contained in:
parent
410cb822d7
commit
31792d7bc8
88 changed files with 6427 additions and 488 deletions
|
|
@ -2,6 +2,50 @@ import * as React from 'react';
|
|||
|
||||
import { h, isEnglish } from './i18n.js';
|
||||
|
||||
export const BotSettingsContext = React.createContext(Object.freeze({
|
||||
openBotSettings() {},
|
||||
}));
|
||||
|
||||
function SettingsGlyph() {
|
||||
return h('svg', {
|
||||
viewBox: '0 0 24 24',
|
||||
width: 16,
|
||||
height: 16,
|
||||
fill: 'none',
|
||||
stroke: 'currentColor',
|
||||
strokeWidth: 1.8,
|
||||
strokeLinecap: 'round',
|
||||
strokeLinejoin: 'round',
|
||||
'aria-hidden': 'true',
|
||||
},
|
||||
h('circle', { cx: 12, cy: 12, r: 3 }),
|
||||
h('path', { d: 'M19.4 15a1.7 1.7 0 0 0 .34 1.88l.06.06-2.83 2.83-.06-.06a1.7 1.7 0 0 0-1.88-.34 1.7 1.7 0 0 0-1.03 1.55V21h-4v-.08A1.7 1.7 0 0 0 8.97 19.4a1.7 1.7 0 0 0-1.88.34l-.06.06-2.83-2.83.06-.06A1.7 1.7 0 0 0 4.6 15a1.7 1.7 0 0 0-1.52-1.03H3v-4h.08A1.7 1.7 0 0 0 4.6 8.97a1.7 1.7 0 0 0-.34-1.88l-.06-.06L7.03 4.2l.06.06a1.7 1.7 0 0 0 1.88.34A1.7 1.7 0 0 0 10 3.08V3h4v.08a1.7 1.7 0 0 0 1.03 1.52 1.7 1.7 0 0 0 1.88-.34l.06-.06 2.83 2.83-.06.06a1.7 1.7 0 0 0-.34 1.88A1.7 1.7 0 0 0 20.92 10H21v4h-.08A1.7 1.7 0 0 0 19.4 15Z' }));
|
||||
}
|
||||
|
||||
export function BotSettingsButton({ channel, botId, botName, connected }) {
|
||||
const { openBotSettings } = React.useContext(BotSettingsContext);
|
||||
const tooltipId = React.useId();
|
||||
return h('span', { className: 'dim-botSettingsAction' },
|
||||
h('button', {
|
||||
type: 'button',
|
||||
className: 'dim-botSettingsButton',
|
||||
'data-delivery-channel': channel,
|
||||
'aria-label': '机器人设置',
|
||||
'aria-describedby': tooltipId,
|
||||
onClick: () => openBotSettings?.({
|
||||
channel,
|
||||
botId,
|
||||
botName,
|
||||
connected: Boolean(connected),
|
||||
}),
|
||||
}, h(SettingsGlyph)),
|
||||
h('span', {
|
||||
id: tooltipId,
|
||||
className: 'dim-botSettingsTooltip',
|
||||
role: 'tooltip',
|
||||
}, '机器人设置'));
|
||||
}
|
||||
|
||||
function messageErrorTime(value) {
|
||||
try {
|
||||
return new Intl.DateTimeFormat(isEnglish() ? 'en-US' : 'zh-CN', {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue