generated from codersforcauses/django-nextjs-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Issue 77 incorporate playable games into individual game pages #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TobbleCobble
wants to merge
14
commits into
main
Choose a base branch
from
issue-77-Incorporate_playable_games_into_individual_game_pages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bdc5a16
basic implementation of embedded game
TobbleCobble 2b64722
Merge remote-tracking branch 'origin' into issue-63-Investigate_playa…
TobbleCobble 4c5183b
basic game embed for game pages
TobbleCobble 0f422bc
Merge branch 'issue-63-Investigate_playable_games' into issue-77-Inco…
TobbleCobble 87eeae6
added gameEmbed data to backend
TobbleCobble a52ed26
Merge branch 'main' into issue-77-Incorporate_playable_games_into_ind…
TobbleCobble 1f704d0
playable game can replace image
TobbleCobble b0bb208
game embed button styling
TobbleCobble f03c36f
uses game image as background for game embed
TobbleCobble 7f2c47b
Merge branch 'main' into issue-77-Incorporate_playable_games_into_ind…
TobbleCobble 2676f5d
refactored retroBorder into global.css
TobbleCobble da87061
fixing globals.css
TobbleCobble 5f5efee
Merge branch 'main' into issue-77-Incorporate_playable_games_into_ind…
TobbleCobble 4c870a6
merging db changes
TobbleCobble File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,61 @@ | ||
| // notes: | ||
| // - width and height don't match itch.io, making games look smaller | ||
| // - you can just embed from itch.io, but only the developer can get the embed link as far as i can tell | ||
| // - would need to save embed link, width and height to db | ||
| // - this method is reliant on itch.io staying up and not changing anything | ||
| // - would want a play button so it doesn't autoload (especially for bigger more intense games) | ||
| import Image from "next/image"; | ||
| import React, { useState } from "react"; | ||
|
|
||
| import { Button } from "./button"; | ||
|
|
||
| type GameEmbedProps = { | ||
| embedID: string; | ||
| gameWidth: number; | ||
| gameHeight: number; | ||
| gameImage: string; | ||
| }; | ||
|
|
||
| export function GameEmbed({ | ||
| embedID, | ||
| gameWidth, | ||
| gameHeight, | ||
| gameImage, | ||
| }: GameEmbedProps) { | ||
| const [isPlaying, setIsPlaying] = useState(false); | ||
|
|
||
| return ( | ||
| <div | ||
| className={`retroBorder flex items-center justify-center bg-background`} | ||
| style={{ width: gameWidth + 26 * 2, height: gameHeight + 26 * 2 }} | ||
| > | ||
| {!isPlaying ? ( | ||
| <div> | ||
| <Image | ||
| src={gameImage} | ||
| alt="Game Cover" | ||
| width={gameWidth} | ||
| height={gameHeight} | ||
| className="absolute left-[50%] top-[50%] translate-x-[-50%] translate-y-[calc(-50%-26px)] blur-sm" | ||
| style={{ width: "auto", height: gameHeight - 26 }} | ||
| /> | ||
| <Button | ||
| onClick={() => setIsPlaying(!isPlaying)} | ||
| size={"lg"} | ||
| className="absolute left-[50%] top-[50%] translate-x-[-50%] translate-y-[calc(-50%-52px)] text-3xl" | ||
| > | ||
| Play | ||
| </Button> | ||
| </div> | ||
| ) : ( | ||
| <div> | ||
| <iframe | ||
| src={`https://itch.io/embed-upload/${embedID}?color=110e1a`} | ||
| width={gameWidth} | ||
| height={gameHeight} | ||
| ></iframe> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
33 changes: 33 additions & 0 deletions
33
server/game_dev/migrations/0010_game_itchgameembedid_game_itchgameheight_and_more.py
This file contains hidden or 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,33 @@ | ||
| # Generated by Django 5.1.15 on 2026-02-04 07:39 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("game_dev", "0009_merge_20260131_1044"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="game", | ||
| name="itchGameEmbedID", | ||
| field=models.PositiveBigIntegerField( | ||
| blank=True, | ||
| default=0, | ||
| help_text="If a game has a web demo stored on itch.io, please enter the embed ID", | ||
| null=True, | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="game", | ||
| name="itchGameHeight", | ||
| field=models.PositiveBigIntegerField(default=0), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="game", | ||
| name="itchGameWidth", | ||
| field=models.PositiveBigIntegerField(default=0), | ||
| ), | ||
| ] |
This file contains hidden or 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,13 @@ | ||
| # Generated by Django 5.1.15 on 2026-02-05 06:34 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("game_dev", "0010_game_itchgameembedid_game_itchgameheight_and_more"), | ||
| ("game_dev", "0010_merge_20260131_1118"), | ||
| ] | ||
|
|
||
| operations = [] |
This file contains hidden or 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,13 @@ | ||
| # Generated by Django 5.1.15 on 2026-02-14 03:12 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("game_dev", "0011_alter_gameshowcase_game"), | ||
| ("game_dev", "0011_merge_20260205_1434"), | ||
| ] | ||
|
|
||
| operations = [] |
23 changes: 23 additions & 0 deletions
23
server/game_dev/migrations/0013_alter_game_itchgameembedid.py
This file contains hidden or 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,23 @@ | ||
| # Generated by Django 5.1.15 on 2026-02-14 03:31 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("game_dev", "0012_merge_20260214_1112"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="game", | ||
| name="itchGameEmbedID", | ||
| field=models.PositiveBigIntegerField( | ||
| blank=True, | ||
| default=None, | ||
| help_text="If a game has a web demo stored on itch.io, please enter the embed ID", | ||
| null=True, | ||
| ), | ||
| ), | ||
| ] |
This file contains hidden or 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,13 @@ | ||
| # Generated by Django 5.1.15 on 2026-02-14 06:20 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("game_dev", "0013_alter_game_itchgameembedid"), | ||
| ("game_dev", "0013_merge_20260214_1347"), | ||
| ] | ||
|
|
||
| operations = [] |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that we can supply a game embed but not a gameWidth, height or image? If this is possible, is there a case to catch this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could have a default case, but size of embed is dependent on game and different engines have different defaults.