mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Refactor SSE event handling and consolidate notification contexts
This commit is contained in:
1 parent
9851ec06e0
commit
f7fd3176d4
30 files changed
+2226
-988
No files matched your search
@@ -3,6 +3,7 @@ import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { Trash2, Clock } from "lucide-react";
|
||||
import { formatDistanceToNow } from "date-fns";
|
||||
import type { Session } from "@/api/types";
|
||||
import { useSessionStatusForSession } from "@/stores/sessionStatusStore";
|
||||
|
||||
interface SessionCardProps {
|
||||
session: Session;
|
||||
@@ -21,6 +22,9 @@ export const SessionCard = ({
|
||||
onToggleSelection,
|
||||
onDelete,
|
||||
}: SessionCardProps) => {
|
||||
const sessionStatus = useSessionStatusForSession(session.id);
|
||||
const isSessionBusy = sessionStatus.type === 'busy' || sessionStatus.type === 'retry' || sessionStatus.type === 'compact';
|
||||
|
||||
return (
|
||||
<Card
|
||||
className={`p-3 cursor-pointer transition-all ${
|
||||
@@ -45,9 +49,17 @@ export const SessionCard = ({
|
||||
className="w-5 h-5 flex-shrink-0 mt-0.5"
|
||||
/>
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="text-base font-semibold text-orange-600 dark:text-orange-400 truncate">
|
||||
{session.title || "Untitled Session"}
|
||||
</h3>
|
||||
<div className="flex items-center gap-2">
|
||||
<h3 className="text-base font-semibold text-orange-600 dark:text-orange-400 truncate">
|
||||
{session.title || "Untitled Session"}
|
||||
</h3>
|
||||
{isSessionBusy && (
|
||||
<span className="relative flex h-2.5 w-2.5 flex-shrink-0">
|
||||
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"></span>
|
||||
<span className="relative inline-flex rounded-full h-2.5 w-2.5 bg-green-500"></span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-3 mt-1 text-xs text-muted-foreground">
|
||||
<span className="flex items-center gap-1">
|
||||
<Clock className="w-3 h-3" />
|
||||
|
||||
Reference in new issue
Block a user