Skip to content

Commit

Permalink
ref: improve workflows for dice gameplay
Browse files Browse the repository at this point in the history
  • Loading branch information
RasenGUY committed Nov 28, 2023
1 parent 4d474af commit cac3f89
Show file tree
Hide file tree
Showing 36 changed files with 530 additions and 263 deletions.
37 changes: 30 additions & 7 deletions deployed-addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,48 @@
"80001": {
"contracts": {
"WegaERC20Escrow": {
"address": "0x0000000000000000000000000000000000000000"
"address": "0xCEBc6b24362cA2F4fA625d340BeF8Af4F91DB5bB",
"legacyAddresses": [],
"deploymentBlock": "263113a",
"implementation": "0x0993a07880aD59E02e72E745dC5b623409Ad24af"
},
"WegaERC20Dummy": {
"address": "0x0000000000000000000000000000000000000000"
"address": "0x802361100a4772847DBc29BC59F76FD1F186E002",
"legacyAddresses": [],
"deploymentBlock": "263112e"
},
"WegaGameController": {
"address": "0x0000000000000000000000000000000000000000"
"address": "0xe4da6EE02D91b7C03DB000B9295A815D6BEeC4ca",
"legacyAddresses": [
"0x760D87Ce891F301d19F608044D42356De2D50D14",
"0x740e1416aE865E2bff8f95aa5776F5Fa0a3706e7",
"0x02D7EF0f678BCd9323f2FA88e7197528D113f24a",
"0x0000000000000000000000000000000000000000"
],
"deploymentBlock": "272c37b",
"implementation": "0x21A8Eda1B590268410e520B70635467720B41418"
},
"WegaRandomizerController": {
"address": "0x0000000000000000000000000000000000000000"
"address": "0xcd44090c1BC8DC05298540488ca6FA058d27Ac70",
"legacyAddresses": [],
"implementation": "0x24F9E5E74976661E3784E258986Ee9ee6AAe8132"
},
"WegaDiceGame": {
"address": "0x0000000000000000000000000000000000000000"
"address": "0x5581147651B29D44d4eD95099F1a53aAE052f797",
"legacyAddresses": [],
"deploymentBlock": "263116f",
"implementation": "0x4f2Fe30D48961581d65C0a486AE5e83A9b8356b0"
},
"WegaCoinFlipGame": {
"address": "0x0000000000000000000000000000000000000000"
"address": "0x24133b29067AC3858B4F58112bCAC243941538c8",
"legacyAddresses": [],
"deploymentBlock": "2631158",
"implementation": "0x0C438E3C3B7b629044573e7cc3B0FBe55DB1b8b6"
},
"FeeManager": {
"address": "0x0000000000000000000000000000000000000000"
"address": "0xe2cDC641b8AF26a208402a3e218EE022E954Afd0",
"legacyAddresses": [],
"implementation": "0x30D1C9b043014820cC878ea023bd9Ae53238B395"
},
"WegaRandomizer": {
"address": "0x0000000000000000000000000000000000000000"
Expand Down
194 changes: 193 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
},
"scripts": {
"dev": "export GSAP_TOKEN=$(grep 'GSAP_TOKEN=' .env | cut -d'=' -f2) && vite --mode",
"app": "export GSAP_TOKEN=$(grep 'GSAP_TOKEN=' .env | cut -d'=' -f2) && vite --mode",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
Expand Down Expand Up @@ -81,7 +81,8 @@
"tailwindcss-cli": "^0.1.2",
"twin.macro": "^3.4.0",
"typescript": "^5.1.6",
"vite": "^4.4.5"
"vite": "^4.4.5",
"vite-plugin-mkcert": "^1.17.1"
},
"browserslist": {
"production": [
Expand Down
23 changes: 23 additions & 0 deletions src/common/modals/BounceFromTop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { useRef, useLayoutEffect } from "react"
import { gsap } from "gsap"
import "twin.macro"

interface IBounceFromTop {
children: React.ReactNode | React.ReactNode[]
}
const BounceFromTop: React.FC<IBounceFromTop> = ({ children }) => {
const wrapperRef = useRef<any>(null)
useLayoutEffect(() => {
const context = gsap.context(() => {
gsap.from(wrapperRef.current, { y: "100%", ease: "elastic.out(1.2, 0.4)" })
}, wrapperRef)

return () => context.revert();
}, [])
return (
<div tw="w-[max-content] h-[max-content]" ref={wrapperRef}>
{children}
</div>
)
}
export default BounceFromTop
20 changes: 4 additions & 16 deletions src/common/modals/GlobalModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ModalContainer } from './types';
import { GameWinnerDeclarationModal } from './GameWinnerDeclarationModal';
import { GameLoserDeclarationModal } from './GameLoserDeclarationModal';
import { ClaimModal } from './ClaimModal';
import BounceFromTop from './BounceFromTop';

export const MODAL_TYPES = {
WINNER_DECLARATION_WINNER_MODAL: 'WINNER_DECLARATION_WINNER_MODAL',
Expand Down Expand Up @@ -44,8 +45,7 @@ type GlobalModalProps = {
}

// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
const GlobalModal: React.FC<GlobalModalProps> = () => {

const GlobalModal: React.FC<GlobalModalProps> = ({ children }) => {
const [store, setStore] = useState<ContextType['store']>({
modalType: undefined,
modalProps: undefined,
Expand Down Expand Up @@ -114,7 +114,7 @@ const GlobalModal: React.FC<GlobalModalProps> = () => {
if (!modalType || !ModalComponent) {
return null
}
return <ModalComponent {...modalProps} />
return <BounceFromTop><ModalComponent {...modalProps} /></BounceFromTop>
}
return (
<GlobalModalContext.Provider value={{
Expand All @@ -139,19 +139,7 @@ const GlobalModal: React.FC<GlobalModalProps> = () => {
}
</ModalContainer>
}
{/* {
typeof (responseModalStore.responseType) === 'number' && // FOUND THE GODDAMN BUG
<ResponseModalContainer onClick={
responseModalStore.persist ?
() => null :
hideResponseModal
}
>
{
renderResponseModalComponent(rType as ResponseTypes)
}
</ResponseModalContainer>
} */}
{children}
</GlobalModalContext.Provider>
)
}
Expand Down
1 change: 0 additions & 1 deletion src/common/modals/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export const ModalContainer = styled.div`
right: 0;
width: 100vw;
height: 100vh;
background-color: rgba(45, 45, 45, 0.5);
z-index: 10000;
display: flex;
align-items: center;
Expand Down
Loading

0 comments on commit cac3f89

Please sign in to comment.