Commit bcfc681b authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: resolve TypeScript build errors (Framer Motion variants + playSound)

- Add 'as const' to transition type literals in variant objects for Framer Motion 12 compatibility
- Replace playSound('click') with playSound('tap') to match sound registry
- Use ENV.SUPABASE_URL instead of protected supabase.supabaseUrl property
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 4d37e0d3
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
import { supabase } from '../lib/supabase' import { supabase } from '../lib/supabase'
import { useAuthStore } from '../stores/authStore' import { useAuthStore } from '../stores/authStore'
import { ENV } from '../env'
export function usePresence() { export function usePresence() {
const { user } = useAuthStore() const { user } = useAuthStore()
...@@ -45,7 +46,7 @@ export function usePresence() { ...@@ -45,7 +46,7 @@ export function usePresence() {
const handleBeforeUnload = () => { const handleBeforeUnload = () => {
navigator.sendBeacon?.( navigator.sendBeacon?.(
`${supabase.supabaseUrl}/rest/v1/profiles?id=eq.${user.id}`, `${ENV.SUPABASE_URL}/rest/v1/profiles?id=eq.${user.id}`,
JSON.stringify({ is_online: false, last_seen_at: new Date().toISOString() }) JSON.stringify({ is_online: false, last_seen_at: new Date().toISOString() })
) )
} }
......
...@@ -33,7 +33,7 @@ const stagger = { ...@@ -33,7 +33,7 @@ const stagger = {
const item = { const item = {
hidden: { opacity: 0, y: 12, scale: 0.95 }, hidden: { opacity: 0, y: 12, scale: 0.95 },
show: { opacity: 1, y: 0, scale: 1, transition: { type: 'spring', stiffness: 400, damping: 22 } }, show: { opacity: 1, y: 0, scale: 1, transition: { type: 'spring' as const, stiffness: 400, damping: 22 } },
} }
export function FriendsPage() { export function FriendsPage() {
......
...@@ -27,7 +27,7 @@ const stagger = { ...@@ -27,7 +27,7 @@ const stagger = {
const fadeUp = { const fadeUp = {
hidden: { opacity: 0, y: 24 }, hidden: { opacity: 0, y: 24 },
show: { opacity: 1, y: 0, transition: { type: 'spring', stiffness: 400, damping: 24 } }, show: { opacity: 1, y: 0, transition: { type: 'spring' as const, stiffness: 400, damping: 24 } },
} }
export function HomePage() { export function HomePage() {
...@@ -112,7 +112,7 @@ export function HomePage() { ...@@ -112,7 +112,7 @@ export function HomePage() {
<motion.div variants={fadeUp} className="flex justify-center"> <motion.div variants={fadeUp} className="flex justify-center">
<motion.button <motion.button
onClick={() => { onClick={() => {
playSound('click') playSound('tap')
navigate('/play') navigate('/play')
}} }}
className="relative w-[85%] cursor-pointer" className="relative w-[85%] cursor-pointer"
...@@ -201,7 +201,7 @@ export function HomePage() { ...@@ -201,7 +201,7 @@ export function HomePage() {
style={{ transform: 'rotate(-1deg)' }} style={{ transform: 'rotate(-1deg)' }}
whileTap={{ y: 4, boxShadow: 'none' }} whileTap={{ y: 4, boxShadow: 'none' }}
onClick={() => { onClick={() => {
playSound('click') playSound('tap')
navigate('/bot-select') navigate('/bot-select')
}} }}
> >
...@@ -226,7 +226,7 @@ export function HomePage() { ...@@ -226,7 +226,7 @@ export function HomePage() {
style={{ transform: 'rotate(1deg)' }} style={{ transform: 'rotate(1deg)' }}
whileTap={{ y: 4, boxShadow: 'none' }} whileTap={{ y: 4, boxShadow: 'none' }}
onClick={() => { onClick={() => {
playSound('click') playSound('tap')
navigate('/friends') navigate('/friends')
}} }}
> >
......
...@@ -38,7 +38,7 @@ const stagger = { ...@@ -38,7 +38,7 @@ const stagger = {
const item = { const item = {
hidden: { opacity: 0, y: 12, scale: 0.95 }, hidden: { opacity: 0, y: 12, scale: 0.95 },
show: { opacity: 1, y: 0, scale: 1, transition: { type: 'spring', stiffness: 400, damping: 22 } }, show: { opacity: 1, y: 0, scale: 1, transition: { type: 'spring' as const, stiffness: 400, damping: 22 } },
} }
export function NotificationsPage() { export function NotificationsPage() {
......
...@@ -22,7 +22,7 @@ const stagger = { ...@@ -22,7 +22,7 @@ const stagger = {
const fadeUp = { const fadeUp = {
hidden: { opacity: 0, y: 24 }, hidden: { opacity: 0, y: 24 },
show: { opacity: 1, y: 0, transition: { type: 'spring', stiffness: 400, damping: 24 } }, show: { opacity: 1, y: 0, transition: { type: 'spring' as const, stiffness: 400, damping: 24 } },
} }
export function PlayPage() { export function PlayPage() {
...@@ -193,7 +193,7 @@ export function PlayPage() { ...@@ -193,7 +193,7 @@ export function PlayPage() {
whileTap={{ scale: 0.92 }} whileTap={{ scale: 0.92 }}
transition={{ type: 'spring', stiffness: 500, damping: 20 }} transition={{ type: 'spring', stiffness: 500, damping: 20 }}
onClick={() => { onClick={() => {
playSound('click') playSound('tap')
const first = Object.entries(TIME_CONTROLS).find(([, v]) => v.category === cat.key) const first = Object.entries(TIME_CONTROLS).find(([, v]) => v.category === cat.key)
if (first) setSelectedTC(first[0]) if (first) setSelectedTC(first[0])
}} }}
...@@ -236,7 +236,7 @@ export function PlayPage() { ...@@ -236,7 +236,7 @@ export function PlayPage() {
animate={isSelected ? { y: -2 } : { y: 0 }} animate={isSelected ? { y: -2 } : { y: 0 }}
transition={{ type: 'spring', stiffness: 500, damping: 20 }} transition={{ type: 'spring', stiffness: 500, damping: 20 }}
onClick={() => { onClick={() => {
playSound('click') playSound('tap')
setSelectedTC(key) setSelectedTC(key)
}} }}
> >
...@@ -271,7 +271,7 @@ export function PlayPage() { ...@@ -271,7 +271,7 @@ export function PlayPage() {
whileTap={{ y: 4 }} whileTap={{ y: 4 }}
transition={{ type: 'spring', stiffness: 600, damping: 20 }} transition={{ type: 'spring', stiffness: 600, damping: 20 }}
onClick={() => { onClick={() => {
playSound('click') playSound('tap')
navigate(`/matchmaking?tc=${selectedTC}&game=chess`) navigate(`/matchmaking?tc=${selectedTC}&game=chess`)
}} }}
> >
...@@ -305,7 +305,7 @@ export function PlayPage() { ...@@ -305,7 +305,7 @@ export function PlayPage() {
whileTap={{ y: 3 }} whileTap={{ y: 3 }}
transition={{ type: 'spring', stiffness: 600, damping: 20 }} transition={{ type: 'spring', stiffness: 600, damping: 20 }}
onClick={() => { onClick={() => {
playSound('click') playSound('tap')
navigate('/bot-select') navigate('/bot-select')
}} }}
> >
......
...@@ -14,7 +14,7 @@ const stagger = { ...@@ -14,7 +14,7 @@ const stagger = {
const item = { const item = {
hidden: { opacity: 0, y: 16, scale: 0.93 }, hidden: { opacity: 0, y: 16, scale: 0.93 },
show: { opacity: 1, y: 0, scale: 1, transition: { type: 'spring', stiffness: 380, damping: 22 } }, show: { opacity: 1, y: 0, scale: 1, transition: { type: 'spring' as const, stiffness: 380, damping: 22 } },
} }
const HEX_CLIP = 'polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)' const HEX_CLIP = 'polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment