mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-03 06:47:03 +00:00
* feat(web): archive a session from its row on hover Archiving a session took a right-click or long-press, a menu item and a confirmation. On pointer devices, hovering a connected session's row now swaps its time/progress cluster for an archive button, the way chat apps tidy their history. Keyboard focus reveals it too; touch devices keep the long-press menu. Archiving stops the session's agent, so the button only skips the confirmation for an idle session: it archives at once and shows a toast with Reopen. A session that is replying, waiting on approval or running background tasks still opens the existing confirmation. Failures are reported in a toast. Toasts gain an optional inline action for this, and the archive icon moves into the shared icon set. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): keep the hover archive spinner until archiving settles The hub can report a session inactive while the archive request is still confirming cleanup. The row's archive button rendered only for active sessions, so its spinner vanished early and a slow or failing cleanup looked finished. Keep the button, and the hidden time cluster, while the request is pending. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): keep archive progress across session list regrouping The hover archive spinner lived in row state. With in-progress pinning on, a session that turns inactive mid-archive moves out of the Active section and remounts, which reset that state and hid the spinner while cleanup was still being confirmed. Read the pending state from the shared archive mutation key instead, as the session header and delete dialog already do. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: HAPI <noreply@hapi.run> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { useNavigate } from '@tanstack/react-router'
|
|
import { PRESERVE_SESSION_SIDEBAR_SCROLL } from '@/lib/sessionNavigation'
|
|
import { Toast } from '@/components/ui/Toast'
|
|
import { useToast } from '@/lib/toast-context'
|
|
|
|
export function ToastContainer() {
|
|
const navigate = useNavigate()
|
|
const { toasts, removeToast } = useToast()
|
|
|
|
if (toasts.length === 0) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className="pointer-events-none fixed inset-x-0 top-[calc(env(safe-area-inset-top)+1rem)] z-50 flex flex-col items-center gap-2 px-3"
|
|
aria-live="polite"
|
|
>
|
|
{toasts.map((toast) => (
|
|
<Toast
|
|
key={toast.id}
|
|
title={toast.title}
|
|
body={toast.body}
|
|
action={toast.action ? {
|
|
label: toast.action.label,
|
|
onClick: () => {
|
|
removeToast(toast.id)
|
|
toast.action?.onClick()
|
|
}
|
|
} : undefined}
|
|
className="cursor-pointer"
|
|
onClick={() => {
|
|
removeToast(toast.id)
|
|
if (toast.sessionId) {
|
|
void navigate({
|
|
to: '/sessions/$sessionId',
|
|
params: { sessionId: toast.sessionId },
|
|
...PRESERVE_SESSION_SIDEBAR_SCROLL,
|
|
})
|
|
return
|
|
}
|
|
if (toast.url) {
|
|
void navigate({ to: toast.url })
|
|
}
|
|
}}
|
|
onClose={() => removeToast(toast.id)}
|
|
/>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|