diff --git a/app/globals.css b/app/globals.css index 326dd6e..18fc27a 100644 --- a/app/globals.css +++ b/app/globals.css @@ -4,6 +4,7 @@ body { font-family: Arial, Helvetica, sans-serif; + overscroll-behavior: contain; } @layer utilities { diff --git a/components/dashboard/ChatDetail.tsx b/components/dashboard/ChatDetail.tsx index fb2b926..962271c 100644 --- a/components/dashboard/ChatDetail.tsx +++ b/components/dashboard/ChatDetail.tsx @@ -347,7 +347,7 @@ export default function ChatDetail({ chatId }: { chatId: string }) { // If near bottom, scroll to new messages if (isNearBottom()) { - setTimeout(scrollToBottom, 50); + setTimeout(scrollToBottomHandler, 50); } // Set timeout to mark new messages as read @@ -447,7 +447,7 @@ export default function ChatDetail({ chatId }: { chatId: string }) { setMessages(prev => [...prev, tempMessage]); // Scroll to bottom to show the new message - setTimeout(scrollToBottom, 50); + setTimeout(scrollToBottomHandler, 50); try { setSending(true); @@ -844,5 +844,5 @@ export default function ChatDetail({ chatId }: { chatId: string }) { /> ); -} +} diff --git a/components/dashboard/ChatTable.tsx b/components/dashboard/ChatTable.tsx index 162edf8..ebfa8aa 100644 --- a/components/dashboard/ChatTable.tsx +++ b/components/dashboard/ChatTable.tsx @@ -354,7 +354,7 @@ export default function ChatTable() {
{chat.telegramUsername ? ( - @{chat.telegramUsername} + @{chat.telegramUsername} ) : ( Customer {chat.buyerId.slice(0, 6)}... )} diff --git a/lib/hooks/use-chromebook-scroll.tsx b/lib/hooks/use-chromebook-scroll.tsx index fb050a6..19aa28e 100644 --- a/lib/hooks/use-chromebook-scroll.tsx +++ b/lib/hooks/use-chromebook-scroll.tsx @@ -11,13 +11,15 @@ export function useChromebookScroll() { if (!container) return; // Enhanced scrolling for Chromebooks + container.style.overscrollBehavior = 'contain'; + const handleTouchStart = (e: TouchEvent) => { // Prevent default touch behavior that might interfere with scrolling if (e.touches.length === 1) { // Single touch - allow normal scrolling return; } - + // Multi-touch - prevent zoom gestures if (e.touches.length > 1) { e.preventDefault(); @@ -30,7 +32,7 @@ export function useChromebookScroll() { // Single touch scrolling - allow default behavior return; } - + // Multi-touch - prevent zoom if (e.touches.length > 1) { e.preventDefault(); @@ -41,7 +43,7 @@ export function useChromebookScroll() { // Enhanced wheel scrolling for Chromebook trackpads const delta = e.deltaY; const container = e.currentTarget as HTMLElement; - + // Smooth scrolling for Chromebook trackpads if (Math.abs(delta) > 0) { container.scrollBy({ @@ -71,15 +73,32 @@ export function useChromebookScroll() { * Hook for smooth scrolling to bottom (useful for chat interfaces) */ export function useSmoothScrollToBottom() { - const scrollToBottom = (container: HTMLElement) => { - container.scrollTo({ - top: container.scrollHeight, - behavior: 'smooth' - }); + const scrollToBottom = (container: HTMLElement | null | undefined) => { + if (!container || typeof container !== 'object') return; + + try { + if ('scrollTo' in container && typeof container.scrollTo === 'function') { + container.scrollTo({ + top: container.scrollHeight, + behavior: 'smooth' + }); + } else { + container.scrollTop = container.scrollHeight; + } + } catch (err) { + console.error('Error in scrollToBottom:', err); + // Fallback to direct property assignment if scrollTo fails + try { + container.scrollTop = container.scrollHeight; + } catch (e) { } + } }; - const scrollToBottomInstant = (container: HTMLElement) => { - container.scrollTop = container.scrollHeight; + const scrollToBottomInstant = (container: HTMLElement | null | undefined) => { + if (!container || typeof container !== 'object') return; + try { + container.scrollTop = container.scrollHeight; + } catch (e) { } }; return { scrollToBottom, scrollToBottomInstant }; diff --git a/public/git-info.json b/public/git-info.json index 35e6543..3abbbc0 100644 --- a/public/git-info.json +++ b/public/git-info.json @@ -1,4 +1,4 @@ { - "commitHash": "f0b89d6", - "buildTime": "2026-01-13T10:09:36.925Z" + "commitHash": "5e8ba7b", + "buildTime": "2026-01-14T05:59:07.483Z" } \ No newline at end of file