fix: hide todo list/status when all todos complete, fix notifications (#124)
This commit is contained in:
@@ -121,7 +121,7 @@ export const StatusRow: React.FC<StatusRowProps> = ({
|
|||||||
return { completed, total };
|
return { completed, total };
|
||||||
}, [todos]);
|
}, [todos]);
|
||||||
|
|
||||||
const hasTodos = visibleTodos.length > 0;
|
const hasActiveTodos = visibleTodos.some((t) => t.status === "in_progress" || t.status === "pending");
|
||||||
// Original logic from ChatInput
|
// Original logic from ChatInput
|
||||||
const shouldRenderPlaceholder = !showAbortStatus && (wasAborted || !abortActive);
|
const shouldRenderPlaceholder = !showAbortStatus && (wasAborted || !abortActive);
|
||||||
|
|
||||||
@@ -133,8 +133,8 @@ export const StatusRow: React.FC<StatusRowProps> = ({
|
|||||||
// - isComplete (showing "Done" result)
|
// - isComplete (showing "Done" result)
|
||||||
// - wasAborted (showing "Aborted" result)
|
// - wasAborted (showing "Aborted" result)
|
||||||
// - placeholderShowingResult (placeholder still displaying result)
|
// - placeholderShowingResult (placeholder still displaying result)
|
||||||
// - hasTodos or showAbortStatus
|
// - hasActiveTodos or showAbortStatus
|
||||||
const hasContent = isWorking || isComplete || wasAborted || placeholderShowingResult || hasTodos || showAbortStatus;
|
const hasContent = isWorking || isComplete || wasAborted || placeholderShowingResult || hasActiveTodos || showAbortStatus;
|
||||||
|
|
||||||
// Close popover when clicking outside
|
// Close popover when clicking outside
|
||||||
const popoverRef = React.useRef<HTMLDivElement>(null);
|
const popoverRef = React.useRef<HTMLDivElement>(null);
|
||||||
@@ -171,7 +171,7 @@ export const StatusRow: React.FC<StatusRowProps> = ({
|
|||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
// Todo trigger button
|
// Todo trigger button
|
||||||
const todoTrigger = hasTodos ? (
|
const todoTrigger = hasActiveTodos ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={toggleExpanded}
|
onClick={toggleExpanded}
|
||||||
@@ -229,7 +229,7 @@ export const StatusRow: React.FC<StatusRowProps> = ({
|
|||||||
{todoTrigger}
|
{todoTrigger}
|
||||||
|
|
||||||
{/* Popover dropdown */}
|
{/* Popover dropdown */}
|
||||||
{isExpanded && hasTodos && (
|
{isExpanded && hasActiveTodos && (
|
||||||
<div
|
<div
|
||||||
style={{ maxWidth: "calc(100cqw - 4ch)" }}
|
style={{ maxWidth: "calc(100cqw - 4ch)" }}
|
||||||
className={cn(
|
className={cn(
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useUIStore } from '@/stores/useUIStore';
|
import { useUIStore } from '@/stores/useUIStore';
|
||||||
import { isWebRuntime } from '@/lib/desktop';
|
import { isWebRuntime } from '@/lib/desktop';
|
||||||
import { getRegisteredRuntimeAPIs } from '@/contexts/runtimeAPIRegistry';
|
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
|
|
||||||
export const NotificationSettings: React.FC = () => {
|
export const NotificationSettings: React.FC = () => {
|
||||||
|
|||||||
@@ -1048,7 +1048,8 @@ export const useEventStream = () => {
|
|||||||
|
|
||||||
completeStreamingMessage(sessionId, messageId);
|
completeStreamingMessage(sessionId, messageId);
|
||||||
|
|
||||||
if (isWebRuntime() && nativeNotificationsEnabled) {
|
// Only notify when entire message is finished (finish === 'stop')
|
||||||
|
if (finish === 'stop' && isWebRuntime() && nativeNotificationsEnabled) {
|
||||||
const notifiedMessages = notifiedMessagesRef.current;
|
const notifiedMessages = notifiedMessagesRef.current;
|
||||||
|
|
||||||
if (!notifiedMessages.has(messageId)) {
|
if (!notifiedMessages.has(messageId)) {
|
||||||
@@ -1288,6 +1289,7 @@ export const useEventStream = () => {
|
|||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
currentSessionId,
|
currentSessionId,
|
||||||
|
nativeNotificationsEnabled,
|
||||||
addStreamingPart,
|
addStreamingPart,
|
||||||
completeStreamingMessage,
|
completeStreamingMessage,
|
||||||
updateMessageInfo,
|
updateMessageInfo,
|
||||||
@@ -1711,6 +1713,7 @@ export const useEventStream = () => {
|
|||||||
cooldownTimers.forEach((timer) => clearTimeout(timer));
|
cooldownTimers.forEach((timer) => clearTimeout(timer));
|
||||||
cooldownTimers.clear();
|
cooldownTimers.clear();
|
||||||
messageCache.clear();
|
messageCache.clear();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- Intentionally accessing current ref value at cleanup time
|
||||||
notifiedMessagesRef.current.clear();
|
notifiedMessagesRef.current.clear();
|
||||||
|
|
||||||
pendingResumeRef.current = false;
|
pendingResumeRef.current = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user