GithubHelp home page GithubHelp logo

iamlogand / republic-of-rome-online Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 22.39 MB

An online adaptation of The Republic of Rome, a strategy board game

Home Page: https://www.roronline.com/

License: MIT License

Python 43.43% CSS 1.15% JavaScript 0.27% TypeScript 54.75% HTML 0.03% Dockerfile 0.16% Shell 0.22%
board-game browser-game diplomacy game history multiplayer online-adaptation republic-of-rome strategy-game

republic-of-rome-online's People

Contributors

dependabot[bot] avatar iamlogand avatar sebastianhirsch avatar tlscotarius avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

flyarong

republic-of-rome-online's Issues

Remove content from the README

The README file is too verbose and contains information that doesn't belong there. To fix this, make it more concise and move the details about setting up a local development environment to the wiki.

Make account button width dynamic

The account button in the top bar has a fixed width, which makes no sense considering that account names can be anywhere from 1-50 characters long.

Related to #56

Stop using Trajan font everywhere

Trajan is on-theme, but using it everywhere is a bit much. In most places, use a more readable/normal sans serif font like Gill Sans. Trajan should still be used for certain things, like names and larger text.

Implement `text-overflow: ellipsis`

To solve the problem of dealing with overflowing text content in the UI, I already made a function that shortens strings and appends an ellipsis. Try replacing this with the text-overflow: ellipsis CSS property.

Also implement this on the topbar account button because usernames can be up to 150 characters long.

Related to #50

Make "owner" required

Not much of a bug but rather an oversight that should be corrected.

The game entity's owner property is currently optional at the model-level. It should be set to required instead, because there is no logical reason for a game to exist without an user to take ownership of it from the moment they create it.

Switch from Create React App to Next.js

Create React App is no longer recommended by React. Switch to Next.js.

This should be as simple as creating a new Next.js app, then copying the source files and dependencies over.

EDIT: It wasn't!

Dynamically sized Senator Inspector

Make the Senator Inspector able to support varying content dimensions determined after the content has been rendered, rather than before, without spilling over the edge of the page. This change will give the Senator Inspector the freedom to contain more dynamic content.

This can probably be done by converting the existing SenatorInspector component into two components: container and content. Once the content component is initially renderred it can access it's own dimensions through getBoundingClientRect(). The content component can then pass it's dimensions to the container component by setting the container's state, using state setters passed as props. Once these states are changed, the container will redetermine where to position itself using the updated state values. Ideally this will not create an infinite rerender loop because the content component will not actually change at any point since the initial render so React will not rerender it.

Allow game hosts to change the game's description

The API already supports this, so the only changes needed are in the frontend.

Tasks:

  • Add a page at "/games/123/edit" titled "Edit game".
  • Add an edit button to the game lobby.
  • Add the current description to the edit game page.
  • Add a form with a new description field, complete with a submit button. The field should submit a PATCH request because only one field on the Game model is being updated.

Move token getters and setters to React Contexts

It's annoying having to pass token (and username) getters and setters down the component tree to every component that needs to access the API. Implement React Contexts to simplify access to these getters and setters since they are used so ubiquitously.

Move sign in to dedicated page

Using the modal for the sign in looks good, but making every page handle it's potential presence is annoying, so it's not worth it.

The redirect sign in page could still take the user back to the page they tried to access on successful submission, perhaps using some high level state that saves the last URL.

Add game participants

Part of #43

Introduce game participants - users who have joined a game.

API changes:

  • Create a GameParticipant model, which will represent many-to-many relationships between Game and User instances.
  • Update the Game create method to also create an instance of GameParticipant, making game owners participants by default upon game creation.
  • Update the Game read collection method to include a list of participating usernames in the response.

UI changes:

  • Add a participant count column to the game list page.
  • Add a mouseover text box showing a list of participant usernames.

This approach allows separation of responsibilty at the model level for describing participation and ownership. This could be useful in a future version if the owner is given more advanced ownership-related operations, such as: not participating in their own game, leaving their own game, or transferring ownership to another user.

Add forecasted "people revolt" chance

As well as showing the unrest level, we should show the forecasted chance (%) of the senate being overthrown when the people revolt. This would help communicate to the players when there is a significant danger of players being defeated.

Move the backend into a Docker container

Move the Python backend application into a Docker container. This will greatly increase parity of the development and production environments. Another benefit is that infrastructure configurations would be moved out of AWS and into the codebase, which makes future infrastructure changes easier to make (because AWS sucks).

Use a blue/green deployment strategy.

Steps

  • Create a decoupled clone of the existing blue environment's coupled DB.
  • In a new git branch, make necessary code changes to migrate the backend and it's configurations to Docker, whilst using the existing local DB. Ensure that the app works locally when running in Docker Desktop.
  • Create a new Docker production environment in AWS with no coupled DB. This is the green environment.
  • Edit the GitHub backend deployment workflow to target the green environment, with configurations that correspond to the decoupled clone of the production environment.
  • Deploy to the green environment.
  • That previous step will probably fail, so make incremental fixes until the green environment is operational.
  • Configure the domain in Route53 to point at the green environment.
  • Update the Wiki

Anticipated challenges

  • SSL/TLS, because it relies on the domain being "roronline.com" to test whether it's working. It's impossible to ensure that SSL works with the green environment without actually testing it by pointing the domain at it. It will almost certainly not work right away, and will require fixes. In the meantime, the website will be down. However, this doesn't actually matter at all because there are 0 users.

Handle expired refresh tokens gracefully

Currently, when a user's refresh token expires, they are signed out and sent to the home page, right back to square one, with no indication of what happened.

Instead, when this happens, the user should be informed that their session has expired.

Account registration including email verification

Currently existing users can sign in, but new users can't register. The only way to create a new account is through the Django admin console.

Make the user registration page functional. This will involve procuring an email server for email verification.

Add games list page

Users should be able to view a list of games.

Tasks:

  • Update the game serializer and view so the API exposes more game attributes
  • Add a list page to the UI to display this information

Make API more conventional

The User collection resource is currently located at /user/, which is unconventional because the singular "user" is being used. This should be changed to "users".

The same issue exists for token resources.

It would be worth learning more about REST naming conventions and fixing anything that looks unconventional.

Unit test for an API call

Add a unit test to the backend using Django’s test-execution framework and REST framework's test classes.

Add a join waitlist form

Add a join waitlist form to the home page.

Steps:

  • Add a new Django model for waitlist submissions
    • Model should have two fields: email address and submission date
  • Add a Django REST Framework (DRF) API serializer and viewset for creating instances of this model
  • Add a form to the UI that consumes this API method
    • Form should have one field: email address

Senator portrait outline in inspector

The senator portrait shown within the senator inspector shouldn't have a dark border, because it's not a clickable button. This border should be removed when it's in the inspector.

Use websockets on the game page

It would be useful if users could see live changes to the participant list whilst they are on the game page without having to refresh the page. Implement web sockets to meet this requirement.

Add game dashboard

Part of #43

  • API changes
    • Update the Game collection resource GET method to include game IDs in the response.
    • Add a Game singleton resource.
  • UI changes
    • Add a game "Dashboard" page where users can see info about any one game. This page will use a new URI pattern that includes the game ID. This page will consume the new API Game singleton resource.
    • Add buttons to the game list that use IDs to navigate to relevant dashboard pages.

Can't create a new game

Symptom

Trying to create a new game doesn't work anymore. With the Chrome dev tools console open, I can see that it's caused by a 500 internal server error in the console. This error is thrown with every click of the "Create" button.

image

Cause

It looks like this bug was introduced in #115 when host was accidentally renamed to owner in the Serializer during a merge conflict resolution - see the change here. For context, "owner" was the original name, but it was changed to "host" a couple of weeks ago.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.