Merge pull request #429 from chriswritescode-dev/feature/mobile-friendly-replies

feat(chat): tailor replies for mobile and text-to-speech
This commit is contained in:
Chris Scott authored and GitHub committed 2026-10-15 16:45:28 -04:00
commit ccdf75d803
7 files changed
+218 -7

No files matched your search

+9 -2
View File
@@ -1,12 +1,19 @@
import { useState, useEffect, useCallback, useRef, type CSSProperties } from 'react'
import { useSwipeNavigation } from '@/contexts/SwipeNavigationContext'
/** Returns whether the viewport is narrower than 768 pixels, or false without a browser window. */
export function isMobileViewport(): boolean {
return typeof window !== 'undefined' ? window.innerWidth < 768 : false
}
/** Tracks whether the current viewport is mobile, updating the value on window resize. */
export function useMobile() {
const [isMobile, setIsMobile] = useState(() => (typeof window !== 'undefined' ? window.innerWidth < 768 : false))
const [isMobile, setIsMobile] = useState(isMobileViewport)
useEffect(() => {
/** Refreshes the mobile state from the current viewport width. */
const checkMobile = () => {
setIsMobile(window.innerWidth < 768)
setIsMobile(isMobileViewport())
}
checkMobile()