Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: update useMobileViewPort to useBreakpoint

Francesco Sansalvadore251f0439a649
diff --git a/apps/www/components/LaunchWeek/LW7BgGraphic.tsx b/apps/www/components/LaunchWeek/LW7BgGraphic.tsx
index f5b29f01eb6..90d802628ad 100644
--- a/apps/www/components/LaunchWeek/LW7BgGraphic.tsx
+++ b/apps/www/components/LaunchWeek/LW7BgGraphic.tsx
@@ -1,11 +1,11 @@
import { motion, useScroll, useTransform } from 'framer-motion'
import Image from 'next/image'
-import { useMobileViewport } from '../../hooks/useMobileViewport'
+import { useBreakpoint } from '../../hooks/useBreakpoint'
import styles from './lw7-bg-graphic.module.css'
export default function LW7BgGraphic() {
const { scrollYProgress } = useScroll()
- const isMobile = useMobileViewport(768)
+ const isMobile = useBreakpoint(768)
const graphicsY = useTransform(
scrollYProgress,
diff --git a/apps/www/components/LaunchWeek/LaunchSection/LaunchWeekLogoHeader.tsx b/apps/www/components/LaunchWeek/LaunchSection/LaunchWeekLogoHeader.tsx
index 99880d97369..12167c5fd93 100644
--- a/apps/www/components/LaunchWeek/LaunchSection/LaunchWeekLogoHeader.tsx
+++ b/apps/www/components/LaunchWeek/LaunchSection/LaunchWeekLogoHeader.tsx
@@ -1,10 +1,10 @@
import classNames from 'classnames'
import Image from 'next/image'
import { motion } from 'framer-motion'
-import { useMobileViewport } from '../../../hooks/useMobileViewport'
+import { useBreakpoint } from '../../../hooks/useBreakpoint'
export function LaunchWeekLogoHeader() {
- const isMobile = useMobileViewport(640)
+ const isMobile = useBreakpoint(640)
return (
<div className="flex flex-col gap-1 md:gap-2 items-center my-4 lg:pt-8 justify-start">
diff --git a/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWall.tsx b/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWall.tsx
index 113c4d20d6f..c1a29e8fa73 100644
--- a/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWall.tsx
+++ b/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWall.tsx
@@ -1,7 +1,7 @@
import Link from 'next/link'
import React from 'react'
import { Button } from 'ui'
-import { useMobileViewport } from '../../../hooks/useMobileViewport'
+import { useBreakpoint } from '../../../hooks/useBreakpoint'
import { UserData } from '../Ticket/hooks/use-conf-data'
import { TicketBrickWallSlider } from './TicketBrickWallSlider'
@@ -12,7 +12,7 @@ interface Props {
}
export default function TicketBrickWall({ users }: Props) {
- const isMobile = useMobileViewport(768)
+ const isMobile = useBreakpoint(768)
return (
<div className="relative pb-20 pt-28 md:pt-40">
<div className="mx-auto bg-[#1C1C1C]">
diff --git a/apps/www/components/LaunchWeek/Releases/LW7/Day5.tsx b/apps/www/components/LaunchWeek/Releases/LW7/Day5.tsx
index dacb1848d88..804938678a6 100644
--- a/apps/www/components/LaunchWeek/Releases/LW7/Day5.tsx
+++ b/apps/www/components/LaunchWeek/Releases/LW7/Day5.tsx
@@ -1,7 +1,7 @@
import React from 'react'
import Image from 'next/image'
import { motion } from 'framer-motion'
-import { useMobileViewport } from '~/hooks/useMobileViewport'
+import { useBreakpoint } from '~/hooks/useBreakpoint'
import {
ArrowTopRightSvg,
CartTitle,
@@ -12,7 +12,7 @@ import {
} from './components'
import { WeekDayProps } from '~/components/LaunchWeek/lw7_days'
-import { opacityVariant4, scaleOpacityVariant, scaleOpacityVariant2 } from './LW7Releases'
+import { opacityVariant4, scaleOpacityVariant2 } from './LW7Releases'
import styles from './day5.module.css'
import Link from 'next/link'
@@ -44,9 +44,9 @@ const getDay5omt02Motion = (index: number) => {
}
const Day5 = ({ day }: { day: WeekDayProps }) => {
- const isMobile = useMobileViewport(767)
- const isTablet = useMobileViewport(1023)
- const isDesktop = useMobileViewport(1279)
+ const isMobile = useBreakpoint(767)
+ const isTablet = useBreakpoint(1023)
+ const isDesktop = useBreakpoint(1279)
return (
<>
diff --git a/apps/www/components/LaunchWeek/Releases/LW7/LW7Releases.tsx b/apps/www/components/LaunchWeek/Releases/LW7/LW7Releases.tsx
index 1816c34cb56..835b5ece06e 100644
--- a/apps/www/components/LaunchWeek/Releases/LW7/LW7Releases.tsx
+++ b/apps/www/components/LaunchWeek/Releases/LW7/LW7Releases.tsx
@@ -15,7 +15,7 @@ import {
StyledArticleBadge,
} from './components'
-import { useMobileViewport } from '../../../../hooks/useMobileViewport'
+import { useBreakpoint } from '../../../../hooks/useBreakpoint'
import { motion } from 'framer-motion'
import Day5 from './Day5'
@@ -144,7 +144,7 @@ const getDay4Motion = (index: number) => {
export default function LW7Releases() {
const [preRelease, day1, day2, day3, day4, day5] = days
- const isTablet = useMobileViewport(1023)
+ const isTablet = useBreakpoint(1023)
const showAll = false
const publishedSections =
days
diff --git a/apps/www/components/LaunchWeek/Ticket/ActualTicket.tsx b/apps/www/components/LaunchWeek/Ticket/ActualTicket.tsx
index 0dd73115d35..7cc769d58c6 100644
--- a/apps/www/components/LaunchWeek/Ticket/ActualTicket.tsx
+++ b/apps/www/components/LaunchWeek/Ticket/ActualTicket.tsx
@@ -10,7 +10,7 @@ import { UserData } from './hooks/use-conf-data'
import ReferralIndicator from '../ReferralIndicator'
import useWinningChances from './hooks/useWinningChances'
import { SITE_URL } from '~/lib/constants'
-import { useMobileViewport } from '../../../hooks/useMobileViewport'
+import { useBreakpoint } from '../../../hooks/useBreakpoint'
type TicketGenerationState = 'default' | 'loading'
@@ -33,7 +33,7 @@ export default function Ticket({
bgImageId,
referrals,
}: Props) {
- const isMobile = useMobileViewport(1023)
+ const isMobile = useBreakpoint(1023)
const [ticketGenerationState, setTicketGenerationState] =
useState<TicketGenerationState>('default')
const divRef = useRef<HTMLDivElement>(null)
diff --git a/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx b/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx
index 98dd1f204e3..094301a5cef 100644
--- a/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx
+++ b/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx
@@ -1,7 +1,7 @@
import { motion } from 'framer-motion'
import Image from 'next/image'
import Link from 'next/link'
-import { useMobileViewport } from '../../../hooks/useMobileViewport'
+import { useBreakpoint } from '../../../hooks/useBreakpoint'
import { UserData } from './hooks/use-conf-data'
interface Props {
@@ -18,8 +18,8 @@ export default function TicketsGrid({ loadedUsers, isLoading, pageCount, offset
`${STORAGE_URL}/tickets/gallery/${
isGold ? 'golden' : 'regular'
}/${BUCKET_FOLDER_VERSION}/${username}.png`
- const isMobile = useMobileViewport(768)
- const isTablet = useMobileViewport(1024)
+ const isMobile = useBreakpoint(768)
+ const isTablet = useBreakpoint(1024)
return (
<div
diff --git a/apps/www/hooks/useMobileViewport.tsx b/apps/www/hooks/useBreakpoint.tsx
similarity index 87%
rename from apps/www/hooks/useMobileViewport.tsx
rename to apps/www/hooks/useBreakpoint.tsx
index 772831edcd5..e02f35f5c70 100644
--- a/apps/www/hooks/useMobileViewport.tsx
+++ b/apps/www/hooks/useBreakpoint.tsx
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
import { useWindowSize } from 'react-use'
import { isBrowser } from '~/lib/helpers'
-export function useMobileViewport(breakpoint = 768) {
+export function useBreakpoint(breakpoint = 768) {
if (!isBrowser) return
const [isMobile, setIsMobile] = useState(false)
const { width } = useWindowSize()