diff --git a/.eslintrc.js b/.eslintrc.js index 7e258ebe..30c3e1c7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -31,12 +31,6 @@ module.exports = { '@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: [ { diff --git a/README.md b/README.md index 694bda35..e20de0a2 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,6 @@ Open http://localhost:3000 to view it in the browser Runs the api tests. Please make sure you run this whenever you make any changes to the api / backend -### `yarn storybook` - -Runs a storybook (https://storybook.js.org/) - -Open http://localhost:9009 to view it in the browser - ### Contributing Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. diff --git a/client/.storybook/addons.ts b/client/.storybook/addons.ts deleted file mode 100644 index 50fdd93e..00000000 --- a/client/.storybook/addons.ts +++ /dev/null @@ -1,6 +0,0 @@ -import addons from '@storybook/addons'; -import '@storybook/addon-knobs/register'; -import '@storybook/addon-actions/register'; -import '@storybook/addon-links/register'; -import '@storybook/addon-viewport/register'; -import 'storybook-addon-styled-component-theme/dist/register'; diff --git a/client/.storybook/config.ts b/client/.storybook/config.ts deleted file mode 100644 index d64ff9c9..00000000 --- a/client/.storybook/config.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { configure, addDecorator, addParameters } from '@storybook/react'; -import { configureViewport } from '@storybook/addon-viewport'; -import { withKnobs } from '@storybook/addon-knobs'; -import options from './options'; -import StoryRouter from 'storybook-react-router'; -import { withProvider } from 'utils/storybookStore'; -import { lightTheme, darkTheme } from 'themes'; -import { ThemeProvider } from '@material-ui/core/styles'; -import { withThemesProvider } from 'storybook-addon-styled-component-theme'; - -const themes = [lightTheme, darkTheme]; - -addParameters(options); -addDecorator(withKnobs); -addDecorator(withProvider); -addDecorator(StoryRouter()); -addDecorator(withThemesProvider(themes, ThemeProvider)); - -const components = require.context('../src/components', true, /\.stories\.tsx?$/); -// const containers = require.context('../src/containers', true, /\.stories\.tsx?$/); -// const components = require.context('../src/components', true, /\.story\.js$/); -// const containers = require.context('../src/containers', true, /\.story\.js$/); - -const loadStories = () => { - components.keys().forEach(components); - // containers.keys().forEach(containers); -}; - -configure(loadStories, module); diff --git a/client/.storybook/options.ts b/client/.storybook/options.ts deleted file mode 100644 index 156ef432..00000000 --- a/client/.storybook/options.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { create } from '@storybook/theming'; - -const options = { - options: { - isFullscreen: false, - panelPosition: 'right', - isToolshown: true, - sortStoriesByKind: true, - theme: create({ - base: 'light', - fontBase: '"Roboto", sans-serif', - fontCode: 'monospace', - }), - }, -}; - -export { options as default }; diff --git a/client/.storybook/webpack.config.js b/client/.storybook/webpack.config.js deleted file mode 100644 index 1a3f7ca0..00000000 --- a/client/.storybook/webpack.config.js +++ /dev/null @@ -1,19 +0,0 @@ -var path = require('path'); -const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); - -module.exports = ({ config, mode }) => { - config.module.rules.push({ - test: /\.(ts|tsx)$/, - loader: require.resolve('babel-loader'), - options: { - presets: [['react-app', { flow: false, typescript: true }]], - }, - }); - config.resolve.plugins = [ - new TsconfigPathsPlugin({ - configFile: path.resolve(__dirname, './../tsconfig.json'), - }), - ]; - config.resolve.extensions.push('.ts', '.tsx'); - return config; -}; diff --git a/client/package.json b/client/package.json index 3a8c44d6..8b6b20be 100644 --- a/client/package.json +++ b/client/package.json @@ -38,26 +38,17 @@ "react-redux": "^7.1.3", "react-router-dom": "^5.1.2", "react-scripts": "3.2.0", - "react-swipeable-views": "^0.13.3", + "react-swipeable-views": "0.13.3", "recharts": "^1.8.5", "redux": "^4.0.4", "redux-logger": "^3.0.6", "redux-persist": "^6.0.0", "redux-thunk": "^2.3.0", "regenerator-runtime": "^0.13.3", - "storybook-react-router": "^1.0.8", "styled-components": "^4.4.1", "typeface-roboto": "^0.0.75", "use-debounce": "^3.2.0", "uuid": "^3.3.3", - "@storybook/addon-actions": "^5.2.8", - "@storybook/addon-knobs": "^5.2.6", - "@storybook/addon-links": "^5.2.6", - "@storybook/addon-viewport": "^5.2.6", - "@storybook/addons": "^5.2.6", - "@storybook/react": "^5.2.6", - "@storybook/theming": "^5.2.6", - "storybook-addon-styled-component-theme": "^1.3.0", "awesome-typescript-loader": "^5.2.1", "tsconfig-paths-webpack-plugin": "^3.2.0", "typescript": "^3.7.4", @@ -75,9 +66,7 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject", - "storybook": "start-storybook -p 9009 -s public", - "build-storybook": "build-storybook -s public" + "eject": "react-scripts eject" }, "browserslist": { "production": [ diff --git a/client/src/components/ListControls/stories/ListControls.story.tsx b/client/src/components/ListControls/stories/ListControls.story.tsx deleted file mode 100644 index cde44af0..00000000 --- a/client/src/components/ListControls/stories/ListControls.story.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import { storiesOf } from '@storybook/react'; -import ListControls from 'components/ListControls'; -import { action } from '@storybook/addon-actions'; -import { Delete, Add, FileCopy } from '@material-ui/icons'; -import Container from 'utils/Container'; - -storiesOf('Components/ListControls', module).add('Basic', () => ( - - , - }, - { - name: 'Delete Item', - onClick: action('delete-item-clicked'), - icon: , - }, - { - name: 'Copy Item', - onClick: action('copy-item-clicked'), - icon: , - disabled: true, - }, - ]} - secondaryItems={[ - { - name: 'Secondary Action 1', - onClick: action('secondary-item-1-clicked'), - }, - { - name: 'Secondary Action 2', - onClick: action('secondary-item-2-clicked'), - }, - { - name: 'Disabled Secondary', - onClick: action('disabled-secondary-item-clicked'), - disabled: true, - }, - ]} - /> - -)); diff --git a/client/src/components/ListItem/stories/ListItem.story.js b/client/src/components/ListItem/stories/ListItem.story.js deleted file mode 100644 index 282ab08c..00000000 --- a/client/src/components/ListItem/stories/ListItem.story.js +++ /dev/null @@ -1,69 +0,0 @@ -import React from 'react'; -import { storiesOf } from '@storybook/react'; -import ListItem from 'components/ListItem'; -import { text, boolean } from '@storybook/addon-knobs'; -import { loremIpsum } from 'utils/lorem'; -import { action } from '@storybook/addon-actions'; -import { Delete, Add, FileCopy } from '@material-ui/icons'; -import Container from 'utils/Container'; - -const lorem = loremIpsum.generateSentences(5); - -storiesOf('Components/ListItem', module) - .add('Basic', () => ( - - - {text('Content', lorem)} - - - )) - .add('Controls', () => ( - - , - }, - { - name: 'Delete Item', - onClick: action('delete-item-clicked'), - icon: , - }, - { - name: 'Copy Item', - onClick: action('copy-item-clicked'), - icon: , - disabled: true, - }, - ]} - secondaryItems={[ - { - name: 'Secondary Action 1', - onClick: action('secondary-item-1-clicked'), - }, - { - name: 'Secondary Action 2', - onClick: action('secondary-item-2-clicked'), - }, - { - name: 'Disabled Secondary', - onClick: action('disabled-secondary-item-clicked'), - disabled: true, - }, - ]} - > - {text('Content', lorem)} - - - )); diff --git a/client/src/store/configureStore.ts b/client/src/store/configureStore.ts index 20353ea3..16b9383c 100644 --- a/client/src/store/configureStore.ts +++ b/client/src/store/configureStore.ts @@ -32,15 +32,6 @@ if (process.env.NODE_ENV !== 'production') { middleware.push(logger); } -export const configureSampleStore = (initialState = {}) => { - const store = createStore({ - reducer: appReducer, - preloadedState: initialState, - middleware, - }); - return store; -}; - const persistConfig = { key: 'aos-statshammer-12-12-19', storage, diff --git a/client/src/utils/Container.tsx b/client/src/utils/Container.tsx deleted file mode 100644 index d0211c5c..00000000 --- a/client/src/utils/Container.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react'; -import { makeStyles, Theme } from '@material-ui/core/styles'; - -const useStyles = makeStyles((theme: Theme) => ({ - container: ({ fullHeight, variant, disablePadding }: any) => ({ - display: 'flex', - flexDirection: 'column', - background: theme.palette.background[variant], - padding: theme.spacing(disablePadding ? 0 : 2), - minHeight: fullHeight ? `Calc(100vh - ${disablePadding ? '16px' : '40px'})` : 300, - margin: '-8px', - color: theme.palette.text.primary, - }), -})); - -const Container = ({ children, fullHeight, variant, disablePadding }) => { - const classes = useStyles({ fullHeight, variant, disablePadding }); - return
{children}
; -}; - -Container.defaultProps = { - children: null, - fullHeight: true, - variant: 'default', - disablePadding: false, -}; - -export default Container; diff --git a/client/src/utils/ScrollContainer.tsx b/client/src/utils/ScrollContainer.tsx deleted file mode 100644 index f2eef542..00000000 --- a/client/src/utils/ScrollContainer.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; - -const useStyles = makeStyles(theme => ({ - scroll: { - minHeight: 2000, - overflowY: 'scroll', - background: theme.palette.background.default, - margin: '-8px', - }, -})); - -const ScrollContainer = ({ children }) => { - const classes = useStyles(); - return
{children}
; -}; - -export default ScrollContainer; diff --git a/client/src/utils/lorem.ts b/client/src/utils/lorem.ts deleted file mode 100644 index c39e0dee..00000000 --- a/client/src/utils/lorem.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { LoremIpsum as Generator } from 'lorem-ipsum'; - -export const loremIpsum = new Generator({ - sentencesPerParagraph: { - max: 8, - min: 4, - }, - wordsPerSentence: { - max: 16, - min: 4, - }, -}); diff --git a/client/src/utils/storybookStore.tsx b/client/src/utils/storybookStore.tsx deleted file mode 100644 index 7206df5f..00000000 --- a/client/src/utils/storybookStore.tsx +++ /dev/null @@ -1,211 +0,0 @@ -import React from 'react'; -import { Provider } from 'react-redux'; -import { configureSampleStore } from 'store/configureStore'; - -const units = [ - { - name: 'Unit 1', - uuid: 'unit-1', - weapon_profiles: [ - { - uuid: 'profile-1', - active: true, - num_models: 20, - attacks: 2, - to_hit: 3, - to_wound: 3, - rend: 1, - damage: 2, - modifiers: [], - }, - ], - }, - { - name: 'Unit 2', - uuid: 'unit-2', - weapon_profiles: [ - { - uuid: 'profile-2', - active: true, - num_models: 20, - attacks: 2, - to_hit: 3, - to_wound: 3, - rend: 0, - damage: 1, - modifiers: [ - { - id: 'mortal_wounds', - options: { - characteristic: 'to_hit', - on: 6, - mortal_wounds: 2, - unmodified: true, - in_addition: true, - }, - }, - ], - }, - ], - }, -]; - -const stats = { - pending: false, - error: null, - payload: [ - { - 'Unit 1': 5.93, - 'Unit 2': 16.3, - save: '1', - }, - { - 'Unit 1': 11.85, - 'Unit 2': 16.3, - save: '2', - }, - { - 'Unit 1': 17.78, - 'Unit 2': 19.26, - save: '3', - }, - { - 'Unit 1': 23.7, - 'Unit 2': 22.22, - save: '4', - }, - { - 'Unit 1': 29.63, - 'Unit 2': 25.19, - save: '5', - }, - { - 'Unit 1': 35.56, - 'Unit 2': 28.15, - save: '6', - }, - { - 'Unit 1': 35.56, - 'Unit 2': 31.11, - save: 'None', - }, - ], -}; - -const modifiers = { - pending: false, - error: null, - modifiers: [ - { - description: 'Add {bonus} for {characteristic}', - id: 'bonus', - name: 'Bonus', - options: { - bonus: { - type: 'number', - }, - characteristic: { - items: ['attacks', 'to_hit', 'to_wound', 'rend', 'damage'], - type: 'choice', - }, - }, - }, - { - description: - '{unmodified} rolls of {on} for {characteristic} result in {mortal_wounds} extra {in_addition}', - id: 'mortal_wounds', - name: 'Mortal Wounds', - options: { - characteristic: { - items: ['to_hit'], - type: 'choice', - }, - in_addition: { - type: 'boolean', - }, - mortal_wounds: { - type: 'number', - }, - on: { - type: 'number', - }, - unmodified: { - type: 'boolean', - }, - }, - }, - { - description: '{unmodified} rolls of {on} for {characteristic} result in {extra_hits} extra', - id: 'exploding', - name: 'Exploding', - options: { - characteristic: { - items: ['to_hit'], - type: 'choice', - }, - extra_hits: { - type: 'number', - }, - on: { - type: 'number', - }, - unmodified: { - type: 'boolean', - }, - }, - }, - { - description: 'Reroll rolls for {characteristic}', - id: 'reroll', - name: 'Reroll', - options: { - characteristic: { - items: ['to_hit', 'to_wound'], - type: 'choice', - }, - }, - }, - { - description: 'Reroll Failed rolls for {characteristic}', - id: 'reroll_failed', - name: 'Reroll Failed', - options: { - characteristic: { - items: ['to_hit', 'to_wound'], - type: 'choice', - }, - }, - }, - { - description: 'Reroll Ones for {characteristic}', - id: 'reroll_ones', - name: 'Reroll Ones', - options: { - characteristic: { - items: ['to_hit', 'to_wound'], - type: 'choice', - }, - }, - }, - ], -}; - -const notifications = []; - -const config = { - darkMode: false, -}; - -export const initialState = { - units, - stats, - modifiers, - notifications, - config, -}; - -export const store = configureSampleStore(initialState); - -export const withProvider = story => {story()}; - -export { store as default }; diff --git a/package.json b/package.json index c010ac6d..6d556879 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "heroku-postbuild": "cd client && yarn install && yarn install --only=dev --no-shrinkwrap && yarn run build", "test": "jest", "bumpversion": "lerna version --no-git-tag-version --no-push", - "storybook": "cd client && yarn storybook", "lint": "eslint . --ext .js,.jsx,.ts,.tsx" }, "dependencies": {