Skip to content
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

feat(examples) interoperable tictactoe frontend #182

Merged
merged 3 commits into from
Oct 16, 2024
Merged

Conversation

hamdiallam
Copy link
Contributor

@hamdiallam hamdiallam commented Oct 1, 2024

  1. run supersim
  2. deploy using script under /contracts/scripts/tictactoe/Deploy to each L2 chain
  3. run frontend

TODO:

  • Code Cleanup
  • Readme

Copy link

cloudflare-workers-and-pages bot commented Oct 1, 2024

Deploying supersim with  Cloudflare Pages  Cloudflare Pages

Latest commit: b21eea3
Status: ✅  Deploy successful!
Preview URL: https://d8513b9e.supersim.pages.dev
Branch Preview URL: https://example-tictactoe.supersim.pages.dev

View logs

Copy link
Contributor Author

hamdiallam commented Oct 1, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @hamdiallam and the rest of your teammates on Graphite Graphite

@hamdiallam hamdiallam changed the title ui start feat(examples) tictactoe ui Oct 1, 2024
@hamdiallam hamdiallam force-pushed the example.tictactoe branch 2 times, most recently from 0e74032 to 9058b4a Compare October 4, 2024 05:09
@hamdiallam hamdiallam changed the title feat(examples) tictactoe ui feat(examples) tictactoe frontend game Oct 4, 2024
@hamdiallam hamdiallam changed the title feat(examples) tictactoe frontend game feat(examples) interoperable tictactoe frontend Oct 15, 2024
@hamdiallam hamdiallam marked this pull request as ready for review October 15, 2024 16:59
@hamdiallam hamdiallam requested a review from a team as a code owner October 15, 2024 16:59
@hamdiallam hamdiallam force-pushed the example.tictactoe branch 2 times, most recently from 2fda160 to 44317a8 Compare October 15, 2024 17:01
@@ -0,0 +1 @@
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/board.tsx","./src/components/connectwallet.tsx","./src/components/gamelists.tsx","./src/components/newgame.tsx","./src/components/square.tsx","./src/constants/chains.ts","./src/constants/tictactoe.ts","./src/hooks/useacceptgame.ts","./src/hooks/usegames.ts","./src/hooks/usemakemove.ts","./src/hooks/usenewgame.ts","./src/hooks/useplayergames.ts","./src/types/game.ts"],"errors":true,"version":"5.6.2"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

games: Game[]
}

const AvailableGames: React.FC<AvailableGamesProps> = ({ games }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can also write the above like below to help with how verbose it can get and not have to deal with React changing it's types like it does sometimes. wouldn't actually change anything on this PR just adding a comment for learning

const AvailableGames = ({ games  }: AvailableGamesProps)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh nice didn't know that

examples/tictactoe/src/components/Game.tsx Outdated Show resolved Hide resolved
Comment on lines 87 to 99
const cellBackgroundColor = (row: number, col: number) => {
if (!gameEndingMoves) { return '#F2F3F8' }

const move = game.moves[row][col]

// winning cell
if (move == 1 && gameEndingMoves.some(move => move[0] === row && move[1] === col)) { return '#D6FFDA' }

// losing cell
if (move == 2 && gameEndingMoves.some(move => move[0] === row && move[1] === col)) { return '#FFD6D6' }

return '#F2F3F8'
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to do this type of logic with classnames

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, this will be apart of the cleanup

@nitaliano
Copy link
Contributor

nitaliano commented Oct 15, 2024

For the styles i think we can move this over to tailwind once it gets merged in will make the styling and logic around it much cleaner

Base automatically changed from interop.tictactoe to main October 16, 2024 16:28
@hamdiallam hamdiallam merged commit 54e452c into main Oct 16, 2024
5 checks passed
@hamdiallam hamdiallam deleted the example.tictactoe branch October 16, 2024 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants