Skip to content

Commit 6caec89

Browse files
committed
wip: Add some transitions
1 parent dcacee9 commit 6caec89

File tree

11 files changed

+885
-808
lines changed

11 files changed

+885
-808
lines changed

apps/web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@
1111
"start": "next start"
1212
},
1313
"dependencies": {
14-
"tailwind-merge": "^2.5.2",
1514
"@aptos-labs/wallet-adapter-ant-design": "^3.0.13",
1615
"@aptos-labs/wallet-adapter-react": "^3.6.2",
1716
"@jeton/ts-sdk": "*",
1817
"@jeton/ui": "*",
1918
"@jeton/zk-deck": "*",
2019
"@legendapp/state": "^3.0.0-alpha.29",
2120
"clsx": "^2.1.1",
21+
"framer-motion": "^11.6.0",
2222
"graphql": "^16.9.0",
2323
"graphql-request": "^7.1.0",
2424
"nes.css": "^2.2.1",
2525
"next": "^14.2.8",
2626
"react": "^18.3.1",
2727
"react-dom": "^18.3.1",
28+
"tailwind-merge": "^2.5.2",
2829
"tsx": "^4.19.1"
2930
},
3031
"devDependencies": {

apps/web/src/app/@modal/(.)create/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ function LabelInput({
122122
required = true,
123123
}: LabelInputProps) {
124124
return (
125-
<div className="flex flex-col gap-1">
126-
<label className="text-[#eec2af]" htmlFor={name}>
125+
<div className="nes-field">
126+
<label className="text-[#eec2af] name_field" htmlFor={name}>
127127
{label}:
128128
</label>
129129
<input
130-
className="bg-[#b87d5b] text-white border-2 border-[#3a3526] p-2"
130+
className="bg-[#b87d5b] nes-input text-white p-2 accent-amber-500"
131131
type={type}
132132
value={value}
133133
name={name}

apps/web/src/app/@modal/(.)join/join/page.tsx

Whitespace-only changes.

apps/web/src/app/@modal/(.)join/page.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export default function GameJoinModal() {
2020
fetchTables();
2121
}, []);
2222

23+
if (!pathname.includes("join")) {
24+
return null;
25+
}
26+
2327
// Modal choose violence and did not close on navigating
2428
if (!pathname.includes("join")) {
2529
return null;
@@ -31,7 +35,7 @@ export default function GameJoinModal() {
3135
{gameTables.length > 0 ? (
3236
<ul className="text-white border flex flex-col p-2 bg-[#b87d5b]">
3337
{gameTables.map((table) => (
34-
<li key={table.id} className="mb-4">
38+
<li key={table.id} className="mb-4 relative">
3539
<div>Table ID: {table.id}</div>
3640
<div>Small Blind: {table.smallBlind}</div>
3741
<div>Number of Raises: {table.numberOfRaises}</div>
@@ -42,7 +46,10 @@ export default function GameJoinModal() {
4246
Buy-In: {table.minBuyIn} - {table.maxBuyIn}
4347
</div>
4448
<div>Chip Unit: {table.chipUnit}</div>
45-
<Link className="bg-blue-500 px-2 py-1 self-end" href={`/games/${table.id}`}>
49+
<Link
50+
className="nes-btn is-primary px-2 py-1 text-xs absolute bottom-1 right-1"
51+
href={`/games/${table.id}`}
52+
>
4653
join
4754
</Link>
4855
</li>

apps/web/src/app/@modal/(.)setup/page.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

apps/web/src/app/games/[id]/state/actions/gameActions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const initGame = async (
4545
});
4646
state$.game.set(game);
4747
setGameEventListeners();
48+
// TODO: should we get 'entryGameState' from user?
4849
const entryGameState = await game.checkIn(1000);
4950
state$.gameState.players.set(entryGameState.players.map((p) => p));
5051
state$.gameState.status.set(entryGameState.status);

apps/web/src/app/games/page.tsx

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import { WalletSelector } from "@aptos-labs/wallet-adapter-ant-design";
44
import { useWallet } from "@aptos-labs/wallet-adapter-react";
55
import buttonBackground from "@src/assets/images/button.png";
6-
import background from "@src/assets/images/main-menu-background.png";
76
import Image from "next/image";
87
import Link from "next/link";
98
import { useState } from "react";
@@ -32,15 +31,20 @@ export default function Home() {
3231
return (
3332
<div className="relative overflow-hidden items-center flex min-h-screen">
3433
<Image
34+
quality={10}
3535
width={80}
3636
height={80}
37-
className="w-40 aspect-square absolute bottom-5 right-5"
37+
className="w-24 aspect-square absolute bottom-5 right-5 duration-500 animate-grow-in"
3838
src="/images/logo.png"
39+
draggable={false}
3940
style={{ imageRendering: "pixelated" }}
4041
alt="Logo"
42+
priority
4143
/>
42-
<div className="text-center bg-paarl-600 flex animate-slide-in h-[50dvh] flex-col items-center rounded-r-3xl px-8 py-8 bg-opacity-90 relative overflow-hidden z-50 justify-center max-w-md">
43-
<div className="flex flex-col gap-5 relative z-20">
44+
<div
45+
className={`text-center flex animate-slide-in flex-col items-center rounded-r-3xl px-8 py-8 bg-opacity-90 duration-500 relative overflow-hidden z-50 justify-center max-w-md bg-[url("/images/wood-pattern-light.png")] bg-repeat bg-center bg-[length:200px_200px] border-8 shadow border-[#b87d5b]`}
46+
>
47+
<div className="flex flex-col gap-5 relative z-20 duration-500">
4448
{connected ? (
4549
options.map((btn) => (
4650
<Link
@@ -53,7 +57,7 @@ export default function Home() {
5357
</Link>
5458
))
5559
) : (
56-
<p className="text-red-100 text-xl">
60+
<p className="text-white text-xl">
5761
Please connect your wallet to create or join a game.
5862
</p>
5963
)}
@@ -66,7 +70,7 @@ export default function Home() {
6670
</div>
6771

6872
<button
69-
className={`relative w-72 mx-auto h-14 p-4 flex justify-center items-center z-10 hover:brightness-110 shadow-2xl active:scale-95 rounded-lg duration-150 nes-btn is-warning !bg-amber-500 ${
73+
className={`relative w-72 mx-auto h-14 p-4 flex justify-center items-center z-10 hover:brightness-110 shadow-2xl active:scale-95 rounded-lg duration-150 nes-btn ${
7074
isLoading ? "opacity-50 cursor-not-allowed" : ""
7175
}`}
7276
onClick={() => setOpenModal(true)}
@@ -80,7 +84,7 @@ export default function Home() {
8084

8185
{connected && (
8286
<button
83-
className="relative w-72 h-14 p-4 flex justify-center items-center z-10 hover:brightness-110 shadow-2xl active:scale-95 rounded-lg duration-150 nes-btn is-warning !bg-amber-500"
87+
className="relative w-72 h-14 p-4 mt-20 flex whitespace-nowrap text-sm justify-center items-center z-10 hover:brightness-110 shadow-2xl active:scale-95 rounded-lg duration-150 nes-btn is-error"
8488
onClick={disconnect}
8589
style={{ backgroundImage: buttonBackground.src }}
8690
>
@@ -89,15 +93,6 @@ export default function Home() {
8993
)}
9094
</div>
9195
</div>
92-
<Image
93-
className="w-full h-full object-cover absolute top-0 left-0 -z-40"
94-
src={background}
95-
alt="background"
96-
priority
97-
style={{
98-
imageRendering: "pixelated",
99-
}}
100-
/>
10196
</div>
10297
);
10398
}

apps/web/src/app/layout.tsx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
"use client";
2+
3+
import background from "@src/assets/images/main-menu-background.png";
14
import type { Metadata } from "next";
25
import { Press_Start_2P } from "next/font/google";
6+
import Image from "next/image";
37
import Script from "next/script";
48

59
import "./globals.css";
610
import "@aptos-labs/wallet-adapter-ant-design/dist/index.css";
711

812
import "@jeton/ui/styles.css";
13+
import { LayoutTransition } from "@src/components/LayoutTransition";
914
import { WalletProvider } from "@src/components/WalletProvider";
1015

1116
const pressStart2P = Press_Start_2P({
@@ -15,11 +20,11 @@ const pressStart2P = Press_Start_2P({
1520
subsets: ["latin"],
1621
});
1722

18-
export const metadata: Metadata = {
19-
title: "Jeton DAO",
20-
description:
21-
"Decentralized poker protocol enabling trustless, transparent, and community-governed gameplay",
22-
};
23+
// export const metadata: Metadata = {
24+
// title: "Jeton DAO",
25+
// description:
26+
// "Decentralized poker protocol enabling trustless, transparent, and community-governed gameplay",
27+
// };
2328

2429
export default function RootLayout({
2530
children,
@@ -32,7 +37,20 @@ export default function RootLayout({
3237
<html lang="en">
3338
<body className={pressStart2P.className}>
3439
<WalletProvider>
35-
{children}
40+
<LayoutTransition initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>
41+
{children}
42+
</LayoutTransition>
43+
44+
<Image
45+
quality={20}
46+
className="w-full h-full object-cover absolute top-0 left-0 -z-40"
47+
src={background}
48+
alt="background"
49+
priority
50+
style={{
51+
imageRendering: "pixelated",
52+
}}
53+
/>
3654
<div>{modal}</div>
3755
</WalletProvider>
3856
<Script src="/register-service-worker.js" />

0 commit comments

Comments
 (0)