Skip to content

Commit

Permalink
feat() add rules
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Nov 29, 2023
1 parent d46a63e commit 64c4a7c
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 9 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ['main']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload dist repository
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Bungee&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cipher Bomb</title>
</head>
Expand Down
Binary file added public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

4 changes: 2 additions & 2 deletions src/abi/cipherbomb.json

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { isAddress } from 'ethers';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { RouterProvider, createBrowserRouter, redirect } from 'react-router-dom';
import { RouterProvider, createHashRouter, redirect } from 'react-router-dom';

import App from './App';
import { Game, JoinGame } from './modules/game';
import { Home } from './modules/home';
import { Home, Rules } from './modules/home';

import './index.css';

const router = createBrowserRouter([
const router = createHashRouter([
{
path: '/',
element: (
Expand All @@ -18,6 +18,14 @@ const router = createBrowserRouter([
</React.StrictMode>
),
},
{
path: 'rules',
element: (
<React.StrictMode>
<App>{(account, provider) => <Rules account={account} provider={provider} />}</App>
</React.StrictMode>
),
},
{
path: 'join',
element: (
Expand All @@ -30,7 +38,7 @@ const router = createBrowserRouter([
path: 'game/:contractAddress',
loader: ({ params }) => {
if (!params.contractAddress || !isAddress(params.contractAddress)) {
return redirect('/') as Response;
return redirect('/');
}
return null;
},
Expand Down
2 changes: 1 addition & 1 deletion src/modules/game/components/WaitingRoom/WaitingRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const WaitingRoom = ({ contract, account, players, currentName = '' }: Wa
};

const joinGame = async () => {
const startTx = await contract.start();
const startTx = await contract.join();
setGameLoading(true);
await startTx.wait();
setGameLoading(false);
Expand Down
5 changes: 5 additions & 0 deletions src/modules/home/components/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export const Home = ({ account, provider }: HomeProps) => {
Join a room
</Link>
</div>
<div>
<Link to="/rules" className={classNames('Home__link', { 'Home__link--disabled': createLoading })}>
Rules
</Link>
</div>
</div>
</div>
);
Expand Down
45 changes: 45 additions & 0 deletions src/modules/home/components/Rules/Rules.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { BrowserProvider } from 'ethers';

import { Back, Subtitle, Title } from '../../../common-ui';

type RulesProps = {
account: string;
provider: BrowserProvider;
};

export const Rules = (_: RulesProps) => {
return (
<div>
<Back />
<Title>Story</Title>
<p>
In the shadows of the digital realm, a formidable hacker known as Natalya Encryptova has assembled a team called
the Red Cipher to concoct a nefarious plan and unleash chaos upon the world. Natalya has infiltrated the core
servers of a highly secure data center, planting a malevolent program that will encrypt all available data and
demand a ransom for its release. As the countdown to encryption begins, a group of elite hackers, led by
CrunchCracker and known as the Decryptors, races against time to prevent the impending catastrophe.
</p>
<p>
The game begins with players secretly discovering whether they belong to the Decryptors or the Red Cipher, and
they must navigate the intricate web of alliances and deceptions within the hacker community. As the turns
unfold, players choose a vulnerability in the encryption algorithm to exploit, attempting to detonate or defuse
the bomb according to which team you belong. The Decryptors wins if they defuse the bomb, while the Red Cipher
wins if they detonate the bomb.
</p>
<Title>Rules</Title>
<Subtitle>Role</Subtitle>
<p>
The Decryptors members are represented by the Role cards with a blue background. The objective of these members
is defusing the bomb.
</p>
<p>
Members of the Red Cipher are represented by the role cards with a red background. The purpose of these members
is to detonate the bomb.
</p>
<Subtitle>Card</Subtitle>
<p>Terminal: no effect</p>
<p>Vulnerability: founding a vulnerability brings you close to victory if you are part of the Decryptors.</p>
<p>Bomb: triggering the bomb encrypts the digital world and hands victory to the Red Cipher</p>
</div>
);
};
1 change: 1 addition & 0 deletions src/modules/home/components/Rules/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Rules';
1 change: 1 addition & 0 deletions src/modules/home/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './components/Home';
export * from './components/Rules';

0 comments on commit 64c4a7c

Please sign in to comment.