chore: sync repo with deployed state — clean up old specs/plans, desktop tweaks

This commit is contained in:
Jannis Braun
2026-03-24 04:33:23 +01:00
parent 46c3838193
commit cc30080ba8
6 changed files with 111 additions and 16 deletions
@@ -55,6 +55,8 @@ export function MessageList({ channelId, jumpToMessageId, onJumpComplete }: Mess
const contentRef = useRef<HTMLDivElement>(null);
const [isNearBottom, setIsNearBottom] = useState(true);
const isNearBottomRef = useRef(true);
const [isAtBottom, setIsAtBottom] = useState(true);
const isAtBottomRef = useRef(true);
const [isLoadingMore, setIsLoadingMore] = useState(false);
const showInitialSkeleton = useDelayedLoading(isLoading && messages.length === 0);
const showPaginationSkeleton = useDelayedLoading(isLoadingMore);
@@ -110,11 +112,13 @@ export function MessageList({ channelId, jumpToMessageId, onJumpComplete }: Mess
prevMessagesLength.current = 0;
// If we have a saved position for the incoming channel, don't mark as near-bottom
// If we have a saved position for the incoming channel, don't mark as near/at-bottom
// — this prevents the ResizeObserver from snapping to bottom before the restore rAF fires
const willRestore = useChatStore.getState().scrollPositions.has(channelId);
setIsNearBottom(!willRestore);
isNearBottomRef.current = !willRestore;
setIsAtBottom(!willRestore);
isAtBottomRef.current = !willRestore;
}, [channelId, saveScrollPosition]);
// Handle scrolling: initial load restores position or snaps to bottom,
@@ -139,17 +143,20 @@ export function MessageList({ channelId, jumpToMessageId, onJumpComplete }: Mess
const near = dist < 5000;
setIsNearBottom(near);
isNearBottomRef.current = near;
const atBot = dist < 150;
setIsAtBottom(atBot);
isAtBottomRef.current = atBot;
return;
}
}
// No saved anchor or message not in cache — snap to bottom
container.scrollTop = container.scrollHeight;
});
} else if (messages.length > prev && isNearBottom) {
// New messages arrived while near bottom — smooth scroll
} else if (messages.length > prev && isAtBottom) {
// New messages arrived while at bottom — smooth scroll
bottomRef.current?.scrollIntoView({ behavior: 'smooth' });
}
}, [messages.length, isNearBottom, channelId]);
}, [messages.length, isAtBottom, channelId]);
// Auto-scroll when content height grows (embeds/images loading) while near bottom
const hasMessages = messages.length > 0;
@@ -227,8 +234,13 @@ export function MessageList({ channelId, jumpToMessageId, onJumpComplete }: Mess
const container = containerRef.current;
if (!container) return;
// Check if near bottom
// Check scroll position relative to bottom
const distanceFromBottom = container.scrollHeight - container.scrollTop - container.clientHeight;
// "at bottom" = within 150px — used for auto-scrolling on new messages
const atBottom = distanceFromBottom < 150;
setIsAtBottom(atBottom);
isAtBottomRef.current = atBottom;
// "near bottom" = within 5000px — used for "Jump to Present" button visibility
const nearBottom = distanceFromBottom < 5000;
setIsNearBottom(nearBottom);
isNearBottomRef.current = nearBottom;
@@ -68,9 +68,9 @@ export function UpdateToast() {
<div className="fixed bottom-6 left-6 z-[300] animate-slide-up">
<div className="glass-pill rounded-xl px-4 py-3 flex items-center gap-3 max-w-[380px]">
<div className="flex-1 min-w-0">
<p className="text-sm font-medium text-txt-primary">Update available</p>
<p className="text-sm font-medium text-txt-primary">Update failed</p>
<p className="text-xs text-txt-secondary truncate">
Auto-install failed download manually
Auto-update failed download manually
</p>
</div>
<a