Skip to content
This repository was archived by the owner on Dec 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
921e1f0
Delete everything
adzialocha Aug 23, 2022
00c4176
Set up Rollup project
adzialocha Aug 23, 2022
93f0626
Correct .nvmrc format
adzialocha Aug 23, 2022
cfb55ab
Add a README.md
adzialocha Aug 23, 2022
aef56a0
Update dependencies
adzialocha Aug 23, 2022
411c619
Rename too ZooAdventures component
adzialocha Aug 23, 2022
30e9aff
Add nodemon to watch for changes
adzialocha Aug 23, 2022
5346e77
Install graphql-request dependencies
adzialocha Aug 23, 2022
891f522
Add CommonJS to build library
adzialocha Aug 23, 2022
41f9806
Initial script to build schema and first board
adzialocha Aug 23, 2022
a1dc4f5
Initialise key pair and pass over configuration
adzialocha Aug 23, 2022
0913969
Display game board
adzialocha Aug 23, 2022
6fc83c5
Update field when clicking
adzialocha Aug 23, 2022
f9b3531
Add linter for react hooks
adzialocha Aug 23, 2022
79f3509
Define animal emoji based on public key
adzialocha Aug 23, 2022
400a53e
A little bit of styling
adzialocha Aug 23, 2022
50b4568
Do not show hover when already set
adzialocha Aug 23, 2022
0050b46
Do not send request when field is already set
adzialocha Aug 23, 2022
5e1f28e
Frequently update game board
adzialocha Aug 23, 2022
ca7dd33
Block player if they just made a move
adzialocha Aug 23, 2022
363e576
Split up in multiple files
adzialocha Aug 23, 2022
b0395d9
Move React components into separate files
adzialocha Aug 23, 2022
003ac79
Add some comments, improve logic for blocking player
adzialocha Aug 23, 2022
e426504
Add some doc strings
adzialocha Aug 23, 2022
09c3d39
WIP detect winner
adzialocha Aug 23, 2022
97cac6a
Add some doc strings
adzialocha Aug 24, 2022
9af8c7d
Calculate win combinations once, represent them as strings
adzialocha Aug 24, 2022
da8a28b
Get current winners of board
adzialocha Aug 24, 2022
605fe60
Show winner on board
adzialocha Aug 24, 2022
dc4260f
Fix checking winning positions
adzialocha Aug 24, 2022
ddd8961
Update comment
adzialocha Aug 24, 2022
e86ae85
Show messages to the user
adzialocha Aug 24, 2022
caf50bd
Style Message component, move animal info to the bottom
adzialocha Aug 24, 2022
67d593b
Remove emojis which are not animals
adzialocha Aug 24, 2022
92caf0e
Change message on the bottom
adzialocha Aug 24, 2022
cee7e0b
Change winSize to 3, check for sane configs
adzialocha Aug 24, 2022
925924a
Upload screenshot
adzialocha Aug 24, 2022
93be9f9
Update README.md
adzialocha Aug 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .editorconfig

This file was deleted.

2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib
demo-dist
49 changes: 0 additions & 49 deletions .eslintrc.js

This file was deleted.

46 changes: 46 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"react": {
"version": "detect"
}
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"plugins": [
"@typescript-eslint",
"prettier",
"react-hooks"
],
"rules": {
"comma-dangle": [
"error",
"always-multiline"
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/no-unescaped-entities": [
"error",
{
"forbid": [
">",
"}"
]
}
],
"prettier/prettier": 1,
"react/prop-types": 0,
"no-debugger": "warn",
"@typescript-eslint/ban-ts-comment": "warn"
}
}
109 changes: 3 additions & 106 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,106 +1,3 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

.vscode
demo-dist
lib
node_modules
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.13.1
v18.7.0
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

65 changes: 52 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,72 @@
# beep-boop

[p2panda](https://github.com/p2panda/handbook) demo chat client running as a statically hosted web or native [Tauri](https://tauri.studio/) desktop application. See it live [here](https://p2panda.org/demo/). ⬅️
Play with the other animals in the zoo.

## Requirements
<img src="screenshot.png" width="350" />

* Node.js
* Rust
This is a React component you can embed in your website. It will connect to a [p2panda](https://github.com/p2panda/handbook) node and allow you to collaboratively play the game in the p2panda network.

## Installation

```bash
npm i zoo-adventures
```

## Usage

```js
import ZooAdventures from 'zoo-adventures';

const App = () => {
return (
<ZooAdventures />
);
}
```

To configure the component you can pass in the following arguments:


* `boardSize: number` Dimensions of the board, set to 4 when it is a 4x4 board (defaults to `4`)
* `winSize: number` Required number of pieces in horizontal, vertical, diagonal row to win (defaults to `3`)
* `documentId: string` All players play on the same board, this is the document id of it (defaults to `0020c301d659...`)
* `endpoint: string` URL of the p2panda node (defaults to `http://localhost:2020/graphql`)
* `schemaId: string` ID of the game board schema, make sure the board size matches the fields (defaults to `zoo_adventures_002094037...`)
* `updateIntervalMs: number` Interval to fetch latest board game state from node in milliseconds (defaults to `2000`)

## Development

### Setup

```bash
# Install Node dependencies
# Install NodeJS dependencies
npm install
```

### Register schema

The used schema for this game is already deployed in the p2panda network. If you want to to deploy it on your [local node](https://github.com/p2panda/aquadoggo), you can run:

# Run development server (via http://localhost:4000)
npm run start
```bash
node register-schema.js
```

It will deploy the schema and create the game board document on your node hosted at `http://localhost:2020`.

# Start native application in development mode (make sure the development
# server runs simultaneously)
npm run tauri:start
### Component

```bash
# Check linter errors
npm run lint

# Build static files for web hosting
# Build library and demo
npm run build

# Build native desktop application
npm run tauri:build
# Watch for changes and automatically run `build`
npm run watch

# Start server to host demo (needs building first)
npm run serve
```

## License
Expand Down
13 changes: 0 additions & 13 deletions babel.config.json

This file was deleted.

Loading