Code Monkey home page Code Monkey logo

elmaonline-web's Introduction

Elmaonline site web frontend

React based frontend for the elmaonline site. The backend is found in the elmaonline-site repo.

  • test.elma.online New features will be tested here first, this site uses a secondary copy of the database, so you can mess up as much as you want here, and nothing you do here will be saved on the real site.

  • elma.online This site will be using the live database.

  • storybook.elma.online UI library of the components that exists in the code

Branches

  • dev
    • The primary branch to use while developing. Make all changes to this branch, preferably as pull requests. Test server uses this branch.
  • master
    • This branch reflects the version currently deployed on elma.online, only people actually deploying will be pulling code to this.

Get started

  1. Install if needed nodejs and yarn
  2. Clone this repo
  3. Run yarn in terminal to install depedencies
  4. Run yarn start in terminal to start development server
  • You can connect to the test server backend or run elmaonline-site locally, use config.js to change this.

  • Run yarn build in terminal to make a production build.

  • Run yarn storybook in terminal to run the storybook site

Tech stack

If you don't know react it's worth checking out the official tutorial. Rest of the stack should be pretty easy to learn. If you are new to any of them, check out these quick introductions to the most important ones: easy-peasy, styled-components, reach-router and formal-web.

Folder structure

.
โ”œโ”€โ”€ /                      # Various configuration files
โ”œโ”€โ”€ /public                # The .html file and favicons
โ”œโ”€โ”€ /src                   # This is where your code will be
    โ”œโ”€โ”€ /components        # Smaller reusable components
    โ”œโ”€โ”€ /constants         # Constants used in components
    โ”œโ”€โ”€ /features          # Bigger reusable components with stores
    โ”œโ”€โ”€ /images            # Images files
    โ”œโ”€โ”€ /pages             # Top level pages
    โ”œโ”€โ”€ /stories           # Style guide for components
    โ”œโ”€โ”€ /utils             # Pure js reusable functions
    โ”œโ”€โ”€ /api.js            # API endpoints
    โ”œโ”€โ”€ /app.js            # Where code is wrapped with router/store etc.
    โ”œโ”€โ”€ /config.js         # Environment variables
    โ”œโ”€โ”€ /easypeasy.js      # Store, update when adding new store.js files
    โ”œโ”€โ”€ /globalStyle.js    # Global css
    โ”œโ”€โ”€ /index.js          # Entry point
    โ”œโ”€โ”€ /theme.js          # Theme objects
    โ”œโ”€โ”€ /router.js         # Add new pages here
โ”œโ”€โ”€ /templates             # Templates for generating new files

Developing on the project

Use the generator to add new pages, features and components Run yarn g in terminal and follow the prompts

  • Most styling should happen in components which should be mostly style and as little state as possible, no easypeasy, at most some react useState. For padding, margin and colors make sure you use variables from the theme and not static values.
  • Features will be built up of components to create the UI and maintain some state in easy-peasy and/or call the api. Optimally you should be able to use layout components like Grid, Row, Column, Paper, Header etc. to built up basic layouts and not rely on creating new css when making a feature.
  • Pages will be built mostly of features and some layout components to comprise a full screen.

Use yarn commit or follow guidelines when committing code to maintain consistent commit messages.

Pages

  • Run yarn g page in terminal
  • Type name of page in CamelCase
  • Add import in src/router.js
  • Add the component inside <Router> in src/router.js with a path param
  • Add store import at the top of src/easypeasy.js
  • Add store inside export default { in src/easypeasy.js

Feature

  • Run yarn g feature in terminal
  • Type name of component in CamelCase
  • Import in relevant pages
  • Add store import at the top of src/easypeasy.js
  • Add store inside export default { in src/easypeasy.js

component

  • Run yarn g component in terminal
  • Type name of component in CamelCase
  • Import in relevant screens/features

Setting up editor

The project is configured to use eslint and prettier to ensure good coding practices. Make sure you install relevant plugins for your editor.

Visual Studio Code:

Test database

The config is set up to use a test database. Bear in mind the following:

  • Test database is a copy of live from end june 2020
  • time, battle and allfinished tables only have a subset of live (last year or two) to keep size down
  • Passwords, emails and private comments have been stripped

Communication

Feel free to create issues/discussions here on github in order to discuss things related to the project. Unless it's specifically related to only frontend, issues and discussions should be made in the elmaonline-site repo. You can also join the elma discord #developers channel to chat.

When working on a feature make sure you assign yourself to the related issue so we avoid multiple people doing the same work.

For major chances on big ticket features such as replays, battles, profile, levels (and code architecture) make sure you join the discussion first, there most likely is one already, and reach some kind of consensus. Of course some experimentation to aid the discussion is fine.

elmaonline-web's People

Contributors

athi223 avatar ddawned avatar dependabot[bot] avatar hexjelly avatar ismometsavirta avatar j-masci avatar makitalo avatar metsavir avatar sunehs avatar ville-j avatar

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.