import { useWindowSize } from './useWindowSize'
import { FLAGS, useFeatureIsOn } from '@komi-app/flags-sdk'
import { useMemo } from 'react'

export const useMobileView = () => {
  const { width } = useWindowSize()
  const enableLegacyMobile = useFeatureIsOn(FLAGS.ENABLE_LEGACY_MOBILE)

  return useMemo(() => {
    return enableLegacyMobile ? width && width < 1040 : false
  }, [width, enableLegacyMobile])
}

export default useMobileView
