-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/transaction
- Loading branch information
Showing
5 changed files
with
119 additions
and
20 deletions.
There are no files selected for viewing
72 changes: 62 additions & 10 deletions
72
packages/nextjs/app/coinflip/_components/CoinflipPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,72 @@ | ||
"use client"; | ||
|
||
import React from 'react' | ||
import React, { useState } from 'react' | ||
import { useAccountConnection } from '~~/hooks/starkcade/useAccountConnection'; | ||
import { ConflipConnectPage } from './ConflipConnectPage'; | ||
import { ConflipPlayPage } from './ConflipPlayPage'; | ||
import { QuestionMarkCircleIcon } from '@heroicons/react/24/solid'; | ||
import GenericModal from '~~/components/scaffold-stark/CustomConnectButton/GenericModal'; | ||
import { tips } from '~~/utils/Constants'; | ||
import Modal from '~~/components/ui/Modal'; | ||
|
||
|
||
|
||
|
||
export const CoinflipPage = () => { | ||
|
||
const { account } = useAccountConnection(); | ||
return ( | ||
<> | ||
{ | ||
account ? <ConflipPlayPage /> : < ConflipConnectPage /> | ||
} | ||
|
||
</> | ||
); | ||
const { account } = useAccountConnection(); | ||
const [isModalOpen, setModalOpen] = useState(false); | ||
|
||
const openModal = () => setModalOpen(true); | ||
const closeModal = () => setModalOpen(false); | ||
|
||
|
||
|
||
return ( | ||
<> | ||
{ | ||
account ? <ConflipPlayPage /> : < ConflipConnectPage /> | ||
} | ||
|
||
|
||
<div | ||
className='fixed justify-end bottom-0 mx-4 my-4 right-0 cursor-pointer' | ||
title="Game rules and instructions" | ||
onClick={openModal} | ||
> | ||
<QuestionMarkCircleIcon className="w-10 h-10 hover:scale-105 transition-transform" /> | ||
</div> | ||
|
||
|
||
<Modal isOpen={isModalOpen} onClose={closeModal}> | ||
<div className="flex flex-col gap-4"> | ||
<h3 className="text-xl font-bold border-b pb-2 text-center"> | ||
Game Rules and Instructions | ||
</h3> | ||
|
||
<ul className="flex flex-col gap-3 pl-6 text-gray-400"> | ||
{tips.map((tip, index) => ( | ||
<li | ||
className="list-decimal list-inside text-sm leading-relaxed hover:text-teal-700 hover:font-medium transition-colors duration-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-teal-500" | ||
key={index} | ||
> | ||
{tip} | ||
</li> | ||
))} | ||
</ul> | ||
|
||
|
||
<h4 className="text-lg font-bold text-center mt-4 text-green-600"> | ||
Have fun playing. Cheers! | ||
</h4> | ||
</div> | ||
</Modal> | ||
|
||
|
||
|
||
|
||
|
||
|
||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const Modal = ({ isOpen, onClose, children }: { | ||
isOpen: boolean, | ||
onClose: ()=> void, | ||
children: React.ReactNode | ||
}) => { | ||
if (!isOpen) return null; | ||
|
||
return ( | ||
<div | ||
className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50" | ||
onClick={onClose} | ||
> | ||
<div | ||
className="modal-box modal-border bg-modal rounded-[8px] border flex flex-col gap-3 justify-around relative " | ||
onClick={(e) => e.stopPropagation()} | ||
> | ||
<button | ||
onClick={onClose} | ||
className="absolute top-4 right-4 text-gray-500 hover:text-gray-800" | ||
> | ||
✕ | ||
</button> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Modal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters