Skip to content

Commit

Permalink
refactor(connect/card): move welcomeBackMessages to component
Browse files Browse the repository at this point in the history
  • Loading branch information
Iqro-dev committed Sep 19, 2023
1 parent eab379e commit a1b34aa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
19 changes: 13 additions & 6 deletions src/components/connect/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,27 @@ import { useEffect, useState } from 'react'

import { ConnectButton } from './button'

import { welcomeBack } from '.'

import { spotifyLogo } from '@assets/images'
import { useProfileQuery } from '@api/hooks'
import { getImage } from '@utils/get-image'

export function ConnectCard() {
const router = useRouter()
const { data } = useProfileQuery()
const [welcomeBackState, setWelcomeBackState] = useState('')
const welcomeBackMessages = [
'Back so soon?',
'We missed you!',
'Glad to see you!',
'Your artists are waiting...',
]

const [welcomeBackMessage, setWelcomeBackMessage] = useState('')

useEffect(() => {
setWelcomeBackState(
welcomeBack[Math.floor(Math.random() * welcomeBack.length)]
setWelcomeBackMessage(
welcomeBackMessages[
Math.floor(Math.random() * welcomeBackMessages.length)
]
)
}, [])

Expand Down Expand Up @@ -57,7 +64,7 @@ export function ConnectCard() {

{data?.displayName ? (
<>
<span className="text-2xl">{welcomeBackState}</span>
<span className="text-2xl">{welcomeBackMessage}</span>
<p className="m-0">
Press the button below to open your profile
</p>
Expand Down
1 change: 0 additions & 1 deletion src/components/connect/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './button'
export * from './card'
export * from './welcome-back'
6 changes: 0 additions & 6 deletions src/components/connect/welcome-back.ts

This file was deleted.

0 comments on commit a1b34aa

Please sign in to comment.