-
Notifications
You must be signed in to change notification settings - Fork 0
/
hearts-modal.tsx
70 lines (60 loc) · 2.29 KB
/
hearts-modal.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"use client"
import Image from "next/image"
import { useRouter } from "next/navigation"
import { useEffect, useState } from "react"
import { Dialog, DialogHeader, DialogTitle, DialogContent, DialogDescription, DialogFooter } from "../ui/dialog"
import { Button } from "../ui/button"
import { useHeartsModal } from "@/store/use-hearts-modal"
export const HeartsModal = () => {
const router = useRouter()
const [isClient, setIsClient] = useState(false)
const { isOpen, close } = useHeartsModal()
useEffect(() => {
setIsClient(true)
}, [])
if(!isClient)
{
return null
}
const onClick = () => {
close()
router.push("/store")
}
return (
<Dialog open={isOpen} onOpenChange={close}>
<DialogContent className="max-w-md">
<DialogHeader>
<div className="flex items-center w-full justify-center mb-5">
<Image src={"/mascot_bad.svg"} height={80} width={80} alt="mascot_sad"/>
</div>
<DialogTitle className="text-center font-bold text-2xl">
You ran out of hearts!
</DialogTitle>
<DialogDescription className="text-center text-base">
Get Pro for unlimited hearts, or purchase them in the store.
</DialogDescription>
</DialogHeader>
<DialogFooter className="mb-4">
<div className="flex flex-col gap-y-4 w-full">
<Button
variant={"primary"}
className="w-full"
size={"lg"}
onClick={onClick}
>
Get unlimited hearts
</Button>
<Button
variant={"primaryOutline"}
className="w-full"
size={"lg"}
onClick={close}
>
No thanks
</Button>
</div>
</DialogFooter>
</DialogContent>
</Dialog>
)
}