mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
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:
7 files changed
+218
-7
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user