Skip to content

Commit

Permalink
[1.0.0] Initial Full Release and Typescript Move (#16)
Browse files Browse the repository at this point in the history
# [1.0.0] Initial Full Release and Typescript Move

## Additions

- Added `Undo` action to delete Unit / Profile
- Added `Rerun` button to `Simulations` screen

## UI

- Changed primary colour in the `light theme` to better match the `dark theme` one
- Renamed `Advanced Stats` -> `Simulations` to better reflect that they are sample probabilities
- Added Return button and # simulations to `Simulations` Screen
- Added an info dialog to the `Simulations` screen explaining the 3 tabs
- Renamed `Single` tab -> `Discrete`
- Renamed `Tables` tab -> `Metrics`
- Added `Info` page that gives a small brief on the tools goal
- Added `Stats` and `Info` to the Bottom Navigation on Apps
- Added AppBar to PDF page
- Lighten info notification in `dark mode` for better contrast

## Fixes

- Fix table scrolling in `Simulations` screen when on mobile

## Architecture

- Moved the entire codebase from `Javascript` over to `Typescript`
  • Loading branch information
damonhook committed Jan 22, 2020
1 parent fa859a4 commit 239f6d8
Show file tree
Hide file tree
Showing 415 changed files with 8,539 additions and 8,031 deletions.
8 changes: 6 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"presets": [
"@babel/preset-env"
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
[
Expand All @@ -20,6 +22,8 @@
"camel2DashComponentName": false
},
"icons"
]
],
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
]
}
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/node_modules/**
**/build/**
**/serviceWorker.ts
88 changes: 66 additions & 22 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,76 @@
module.exports = {
extends: 'airbnb',
plugins: [
"react-hooks"
],
extends: ['airbnb', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['react', 'react-hooks', '@typescript-eslint', 'prettier'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
root: true,
rules: {
'react/jsx-props-no-spreading': ['off'],
'react/jsx-filename-extension': [1, {
extensions: ['.js', '.jsx']
}],
'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'react/jsx-wrap-multilines': ['off'],
'jsx-a11y/label-has-associated-control': ['off'],
'camelcase': ['off'],
'no-shadow': ['off'],
'function-paren-newline': ['error', 'consistent'],
'react/jsx-props-no-spreading': ['off'],
'@typescript-eslint/no-empty-interface': ['off'],
'jsx-a11y/click-events-have-key-events': ['off'],
'jsx-a11y/interactive-supports-focus': ['off'],
'react-hooks/exhaustive-deps': [2],
'react/prop-types': ['off'],
'react/jsx-fragments': ['off'],
'prettier/prettier': 'warn',
'react/static-property-placement': ['off'],
'import/prefer-default-export': ['off'],
'no-shadow': ['off'],
'class-methods-use-this': ['off'],
'react/prop-types': ['off']
'import/no-cycle': ['off'],
'lines-between-class-members': ['off'],
'import/extensions': ['off'],
'@typescript-eslint/interface-name-prefix': ['off'],
'@typescript-eslint/ban-ts-ignore': ['off'],
'@typescript-eslint/camelcase': ['off'],
'@typescript-eslint/no-explicit-any': ['off'],
'@typescript-eslint/explicit-function-return-type': ['off'],
'no-underscore-dangle': ['off'],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['.storybook/**', '**/*.stories.*', '**/*.story.*'],
},
],
},
overrides: [
{
files: ['server.ts'],
rules: {
'no-console': ['off'],
},
},
{
files: ['**/store/**'],
rules: {
'no-param-reassign': ['off'],
},
},
],
settings: {
"import/resolver": {
"node": {
"moduleDirectory": ["node_modules", "src/"]
}
}
react: { version: 'latest' },
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
typescript: {
directory: ['./tsconfig.json', './client/tsconfig.json'],
},
},
},
env: {
es6: true,
browser: true,
node: true,
mocha: true,
jest: true,
},
"env": {
"browser": true,
"node": true,
}
}
};
7 changes: 4 additions & 3 deletions .github/workflows/CI.yml → .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Node CI
on: [push, pull_request] # Run on Push and Pull Requests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -13,8 +13,9 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm install -g yarn@1.19.2
- name: yarn install, build, and test
- name: Install Dependencies
run: yarn setup
- name: Lint and Test
run: |
yarn
yarn lint
yarn test
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"bracketSpacing": true,
"jsxBracketSameLine": false,
"printWidth": 110,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"parser": "typescript"
}
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ Ensure that you have `node`, `yarn`, and `nodedeamon` installed.
Install the packages needed for the express server (backend) and the client (frontend)

```bash
yarn install;
cd client && yarn install && cd ..;
yarn setup
```

## Usage
Expand All @@ -56,4 +55,4 @@ Open http://localhost:9009 to view it in the browser

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

If you make any changes to the API. Please ensure that you have run the unit tests. In addition, if you have added extra functionality to the API (e.g: a new modifier), please add a unit test to the `api/tests/testUnits.js` file that contains this new functionality
If you make any changes to the API. Please ensure that you have run the unit tests. In addition, if you have added extra functionality to the API (e.g: a new modifier), please add a unit test to the `api/tests/test.units.ts` file that contains this new functionality
20 changes: 0 additions & 20 deletions api/constants.js

This file was deleted.

18 changes: 18 additions & 0 deletions api/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export enum Characteristic {
ATTACKS = 'attacks',
TO_HIT = 'to_hit',
TO_WOUND = 'to_wound',
REND = 'rend',
DAMAGE = 'damage',
SAVE = 'save',
}

export const getCharacteristic = (val: string): Characteristic => {
const k = Object.keys(Characteristic).find(key => Characteristic[key] === val);
if (k) {
return Characteristic[k];
}
return null;
};

export const SAVES = [2, 3, 4, 5, 6, 0];
Empty file removed api/controllers/index.js
Empty file.
18 changes: 0 additions & 18 deletions api/controllers/modifiersController.js

This file was deleted.

20 changes: 20 additions & 0 deletions api/controllers/modifiersController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { MODIFIERS } from '../models/modifiers';
import { TARGET_MODIFIERS } from '../models/targetModifiers';

/**
* Get the list of modifiers
*/
export const getModifiers = () =>
Object.keys(MODIFIERS).map(key => ({
id: key,
...MODIFIERS[key].metadata,
}));

/**
* Get the list of target modifiers
*/
export const getTargetModifiers = () =>
Object.keys(TARGET_MODIFIERS).map(key => ({
id: key,
...TARGET_MODIFIERS[key].metadata,
}));
102 changes: 0 additions & 102 deletions api/controllers/statsController.js

This file was deleted.

0 comments on commit 239f6d8

Please sign in to comment.