feat: 退群监控增加重新发送功能

This commit is contained in:
Wxw-Gu
2026-09-09 17:58:14 +08:00
parent 0bad419150
commit c759bcd30e
5 changed files with 46 additions and 3 deletions
@@ -85,10 +85,14 @@ const sendCapabilityTone = (capability: PersonalWechatSendCapability | null): st
function EventNotificationStatus({
event,
onOpenSendSettings
onOpenSendSettings,
onResend,
resending
}: {
event: GroupExitMonitorState['events'][number]
onOpenSendSettings?: () => void
onResend?: () => void
resending?: boolean
}): React.ReactElement {
const status = event.notificationStatus || event.notification?.status || 'not_requested'
const details =
@@ -120,6 +124,11 @@ function EventNotificationStatus({
去设置
</Button>
) : null}
{status !== 'sent' && status !== 'pending' && onResend ? (
<Button variant="link" size="sm" onClick={onResend} disabled={resending}>
{resending ? '发送中...' : '重新发送'}
</Button>
) : null}
</div>
)
}
@@ -455,6 +464,7 @@ export function GroupExitMonitorWorkspace({
const [templateError, setTemplateError] = React.useState('')
const [selectedRoomId, setSelectedRoomId] = React.useState('all')
const [view, setView] = React.useState<'events' | 'manage'>('events')
const [resendingEventId, setResendingEventId] = React.useState<string | null>(null)
const [manageKeyword, setManageKeyword] = React.useState('')
const [manageFilter, setManageFilter] = React.useState<GroupSelectionFilter>('all')
const [selectedManageRoomIds, setSelectedManageRoomIds] = React.useState<Set<string>>(
@@ -594,6 +604,19 @@ export function GroupExitMonitorWorkspace({
}
}
const resendEvent = async (eventId: string): Promise<void> => {
if (resendingEventId || typeof window.api.resendGroupExitMonitorEvent !== 'function') return
setResendingEventId(eventId)
setError('')
try {
setState(await window.api.resendGroupExitMonitorEvent(eventId))
} catch (reason) {
setError(reason instanceof Error ? reason.message : String(reason))
} finally {
setResendingEventId(null)
}
}
const saveGroups = async (): Promise<void> => {
const api = window.api
if (saving || !dbReady || typeof api.setGroupExitMonitorGroups !== 'function') return
@@ -857,6 +880,8 @@ export function GroupExitMonitorWorkspace({
<EventNotificationStatus
event={event}
onOpenSendSettings={onOpenSendSettings}
onResend={() => void resendEvent(event.id)}
resending={resendingEventId === event.id}
/>
<dl className="exit-monitor-event-details">
<div>