Skip to content

Commit

Permalink
feat: add querySounds verification on page mount before show intera…
Browse files Browse the repository at this point in the history
…ction-modal
  • Loading branch information
mateusfg7 committed Nov 15, 2023
1 parent 5ee974d commit e01418c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
'use client'

import React from 'react'
import React, { useEffect } from 'react'

import useQueryState from '@/shared/query/query-state'

import { Header } from '@/components/header'
import { SoundButton } from '@/components/sound'
import { ClearButton } from '@/components/clear-button'
import { Footer } from '@/components/footer'
import { useThemeStore } from '@/stores/theme-store'
import { SaveComboButton } from '@/components/save-combo-button'
import { InteractionModal } from '@/components/interaction-modal'

import { sounds } from '@/sounds'

import { container } from './styles'
import { useUserInteractionStore } from '@/stores/user-interaction-store'

export default function Home() {
const background = useThemeStore(set => set.theme)
const setUserHasInteracted = useUserInteractionStore(
state => state.setUserHasInteracted
)

const [querySounds] = useQueryState('sounds')

useEffect(() => {
if (!querySounds.length) setUserHasInteracted(true)
}, [])

return (
<div className={container({ background })}>
Expand All @@ -31,6 +45,7 @@ export default function Home() {
</div>
</div>
<Footer />
<InteractionModal />
</div>
</div>
)
Expand Down

0 comments on commit e01418c

Please sign in to comment.