Skip to content

Commit 1f704d0

Browse files
committed
playable game can replace image
1 parent a52ed26 commit 1f704d0

3 files changed

Lines changed: 57 additions & 45 deletions

File tree

client/src/components/ui/GameEmbed.tsx

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,30 @@ export function GameEmbed({ embedID, gameWidth, gameHeight }: GameEmbedProps) {
1717
const [isPlaying, setIsPlaying] = useState(false);
1818

1919
return (
20-
<div>
21-
<section
22-
className={
23-
"flex items-center justify-center border-[26px] border-accent p-2 [clip-path:polygon(20px_20px,calc(100%-20px)_20px,100%_32px,100%_30%,calc(100%-20px)_45%,calc(100%-20px)_calc(100%-8px),80%_calc(100%-8px),75%_calc(100%-20px),20px_calc(100%-20px),0%_60%,0%_30%,20px_25%)]"
24-
}
25-
style={{ width: gameWidth, height: gameHeight }}
26-
>
27-
{!isPlaying ? (
28-
<button
29-
onClick={() => setIsPlaying(!isPlaying)}
30-
className="rounded-sm bg-accent px-7 py-3"
31-
aria-label="Play"
32-
>
33-
<div>Play</div>
34-
</button>
35-
) : (
36-
<div>
37-
<iframe
38-
src={`https://itch.io/embed-upload/${embedID}?color=110e1a`}
39-
width={gameWidth}
40-
height={gameHeight}
41-
className="min-w-80 border-[26px] border-accent [clip-path:polygon(20px_20px,calc(100%-20px)_20px,100%_32px,100%_30%,calc(100%-20px)_45%,calc(100%-20px)_calc(100%-8px),80%_calc(100%-8px),75%_calc(100%-20px),20px_calc(100%-20px),0%_60%,0%_30%,20px_25%)]"
42-
></iframe>
43-
</div>
44-
)}
45-
</section>
20+
<div
21+
className={
22+
"flex items-center justify-center border-[26px] border-accent bg-background p-2 [clip-path:polygon(20px_20px,calc(100%-20px)_20px,100%_32px,100%_30%,calc(100%-20px)_45%,calc(100%-20px)_calc(100%-8px),80%_calc(100%-8px),75%_calc(100%-20px),20px_calc(100%-20px),0%_60%,0%_30%,20px_25%)]"
23+
}
24+
style={{ width: gameWidth, height: gameHeight }}
25+
>
26+
{!isPlaying ? (
27+
<button
28+
onClick={() => setIsPlaying(!isPlaying)}
29+
className="rounded-sm bg-accent px-7 py-3"
30+
aria-label="Play"
31+
>
32+
<div>Play</div>
33+
</button>
34+
) : (
35+
<div>
36+
<iframe
37+
src={`https://itch.io/embed-upload/${embedID}?color=110e1a`}
38+
width={gameWidth}
39+
height={gameHeight}
40+
className="min-w-80 border-[26px] border-accent [clip-path:polygon(20px_20px,calc(100%-20px)_20px,100%_32px,100%_30%,calc(100%-20px)_45%,calc(100%-20px)_calc(100%-8px),80%_calc(100%-8px),75%_calc(100%-20px),20px_calc(100%-20px),0%_60%,0%_30%,20px_25%)]"
41+
></iframe>
42+
</div>
43+
)}
4644
</div>
4745
);
4846
}

client/src/pages/games/[id].tsx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,26 @@ export default function IndividualGamePage() {
8686
return (
8787
<div className="min-h-screen bg-background font-sans text-foreground">
8888
<main>
89-
<section className="w-full bg-popover">
89+
<section className="w-full items-center justify-center bg-popover">
9090
<div className="mx-auto max-w-7xl p-0 sm:p-8">
91-
<Image
92-
src={gameCover}
93-
alt="Game Cover"
94-
width={800}
95-
height={800}
96-
className="max-h-[60vh] w-full object-cover sm:mx-auto sm:h-auto sm:max-h-[60vh] sm:rounded-2xl sm:object-contain"
97-
priority
98-
/>
91+
{gameEmbedID != "0" ? (
92+
<div className="flex justify-center">
93+
<GameEmbed
94+
embedID={gameEmbedID}
95+
gameWidth={gameWidth}
96+
gameHeight={gameHeight}
97+
/>
98+
</div>
99+
) : (
100+
<Image
101+
src={gameCover}
102+
alt="Game Cover"
103+
width={800}
104+
height={800}
105+
className="max-h-[60vh] w-full object-cover sm:mx-auto sm:h-auto sm:max-h-[60vh] sm:rounded-2xl sm:object-contain"
106+
priority
107+
/>
108+
)}
99109
</div>
100110
</section>
101111

@@ -162,16 +172,7 @@ export default function IndividualGamePage() {
162172
</section>
163173

164174
<section className="mt-8 flex w-full flex-col items-center gap-6">
165-
{gameEmbedID != "0" && (
166-
<div>
167-
<GameEmbed
168-
embedID={gameEmbedID}
169-
gameWidth={gameWidth}
170-
gameHeight={gameHeight}
171-
/>
172-
<ItchEmbed embedID={game.itchEmbedID} name={gameTitle} />
173-
</div>
174-
)}
175+
<ItchEmbed embedID={game.itchEmbedID} name={gameTitle} />
175176

176177
<h2 className="font-jersey10 text-5xl text-primary">ARTWORK</h2>
177178

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Generated by Django 5.1.15 on 2026-02-05 06:34
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("game_dev", "0010_game_itchgameembedid_game_itchgameheight_and_more"),
10+
("game_dev", "0010_merge_20260131_1118"),
11+
]
12+
13+
operations = []

0 commit comments

Comments
 (0)