π§Ή Project Cleanup and Bundling (#69)
* β¨ Reconfigure ESLint & Prettier - Simpler config with less exceptions - Use json over js - Rely on Prettier to avoid getting stuck in limbo - Less ignores Remove Duplicate Eslint * π₯ Simplify GitIgnore One gitignore to rule them all. π₯ Remove duplicated gitignore entries * β¨ Add api-client project * π§ΉYarn and dependency cleanup * π₯ Remove husky from inner project * π§Ή Cleanup following ESLint and Prettier * π. Split TSConfigs * π¦ Update versions and package descriptions * π». Update Scripts * βͺοΈ Move environment files to web projects * π³ Update docker files * π Ensure clean always passes yes * π Enable build for archived api project * π Change order on build instead of parallel * π₯ Remove old test * β Quick update to ensure tests go through * Add Lerna Debug to gitignore * π§. Update target to esnext * π. Merge in previous route work after prettier changes * π§ Tweak vs code settings * β Fix test after merges
52
.eslintrc.js
|
@ -1,52 +0,0 @@
|
|||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
extends: [
|
||||
'airbnb-typescript',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:jsx-a11y/recommended',
|
||||
'plugin:jest/recommended',
|
||||
'prettier',
|
||||
],
|
||||
plugins: ['react-hooks', 'formatjs'],
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'module',
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
rules: {
|
||||
'react/jsx-props-no-spreading': 'off',
|
||||
'class-methods-use-this': 'off',
|
||||
'react/jsx-indent': 'off',
|
||||
'react/jsx-indent-props': 'off',
|
||||
'react/jsx-wrap-multilines': 'off',
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
'react/prop-types': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
curly: 'error',
|
||||
'@typescript-eslint/no-unused-vars': 'warn',
|
||||
'react/jsx-one-expression-per-line': 0,
|
||||
'import/no-extraneous-dependencies': 'off',
|
||||
'formatjs/no-offset': 'error',
|
||||
'formatjs/enforce-id': 'error',
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.stories.tsx'],
|
||||
rules: {
|
||||
'react/jsx-props-no-spreading': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
ignorePatterns: ['node_modules/'],
|
||||
};
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"airbnb",
|
||||
"airbnb-typescript",
|
||||
"prettier",
|
||||
"plugin:react-hooks/recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:jsx-a11y/recommended",
|
||||
"plugin:jest/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
},
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module",
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"plugins": ["@typescript-eslint", "react-hooks", "prettier"],
|
||||
"rules": {
|
||||
"prettier/prettier": "error",
|
||||
"react/jsx-filename-extension": ["error", { "extensions": [".jsx", ".tsx"] }],
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"react/prop-types": "off"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/*.stories.tsx"],
|
||||
"rules": {
|
||||
"react/jsx-props-no-spreading": "off"
|
||||
}
|
||||
}
|
||||
],
|
||||
"ignorePatterns": ["dist", "build", "node_modules"]
|
||||
}
|
|
@ -1,10 +1,30 @@
|
|||
# ignore all build folders
|
||||
**/build/
|
||||
**/node_modules/
|
||||
**/storybook-static/
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# build
|
||||
build
|
||||
storybook-static
|
||||
dist
|
||||
tsconfig.tsbuildinfo
|
||||
|
||||
# dependencies
|
||||
node_modules
|
||||
.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
coverage
|
||||
|
||||
# ignore mac file
|
||||
.DS_store
|
||||
|
||||
**/dist
|
||||
**/tsconfig.tsbuildinfo
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# Ignore artifacts:
|
||||
build
|
||||
coverage
|
16
.prettierrc
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"trailingComma": "es5",
|
||||
"singleQuote": true,
|
||||
"printWidth": 100,
|
||||
"tabWidth": 4,
|
||||
"xmlSelfClosingSpace": false,
|
||||
"xmlWhitespaceSensitivity": "ignore",
|
||||
"overrides": [
|
||||
{
|
||||
"files": ".prettierrc",
|
||||
"options": {
|
||||
"parser": "json"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"printWidth": 100,
|
||||
"trailingComma": "es5",
|
||||
"tabWidth": 4,
|
||||
"singleQuote": true
|
||||
}
|
|
@ -1,5 +1,11 @@
|
|||
{
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"javascript.format.enable": false
|
||||
"javascript.format.enable": false,
|
||||
"eslint.workingDirectories": [
|
||||
{ "directory": "packages/admin-app", "changeProcessCWD": true },
|
||||
{ "directory": "packages/api-client", "changeProcessCWD": true },
|
||||
{ "directory": "packages/library", "changeProcessCWD": true },
|
||||
{ "directory": "packages/result-app", "changeProcessCWD": true }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -11,5 +11,6 @@ RUN lerna bootstrap
|
|||
|
||||
RUN lerna run build
|
||||
|
||||
EXPOSE 3000
|
||||
EXPOSE 3001
|
||||
EXPOSE 3002
|
||||
CMD ["lerna", "run", "start"]
|
||||
|
|
35
Makefile
|
@ -1,29 +1,32 @@
|
|||
.PHONY: install build start storybook test
|
||||
.PHONY: install build start test lint storybook build-storybook docker-dev-app docker-dev-storybook docker-dev-all
|
||||
|
||||
install:
|
||||
sudo npm install --global lerna
|
||||
lerna bootstrap
|
||||
yarn install
|
||||
yarn bootstrap
|
||||
|
||||
build:
|
||||
lerna run build
|
||||
|
||||
lint:
|
||||
lerna run lint
|
||||
yarn build
|
||||
|
||||
start:
|
||||
lerna run start
|
||||
yarn start
|
||||
|
||||
storybook:
|
||||
lerna run storybook
|
||||
|
||||
build-storybook:
|
||||
lerna run build-storybook
|
||||
start-with-storybook:
|
||||
yarn start-with-storybook
|
||||
|
||||
test:
|
||||
lerna run test
|
||||
yarn test
|
||||
|
||||
lint:
|
||||
yarn lint
|
||||
|
||||
storybook:
|
||||
yarn storybook
|
||||
|
||||
build-storybook:
|
||||
yarn build-storybook
|
||||
|
||||
|
||||
|
||||
local:
|
||||
lerna run local
|
||||
|
||||
# Docker
|
||||
docker-dev-app:
|
||||
|
|
|
@ -1,17 +1,30 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
app:
|
||||
admin-app:
|
||||
build:
|
||||
dockerfile: ./Dockerfile
|
||||
context: .
|
||||
ports:
|
||||
- 3000:3000
|
||||
- 3001:3001
|
||||
volumes:
|
||||
- '.:/app'
|
||||
- '/app/node_modules'
|
||||
# https://github.com/facebook/create-react-app/issues/8688
|
||||
stdin_open: true
|
||||
command: 'serve -l 3000 packages/admin-app/build'
|
||||
command: 'serve -l 3001 packages/admin-app/build'
|
||||
|
||||
result-app:
|
||||
build:
|
||||
dockerfile: ./Dockerfile
|
||||
context: .
|
||||
ports:
|
||||
- 3002:3002
|
||||
volumes:
|
||||
- '.:/app'
|
||||
- '/app/node_modules'
|
||||
# https://github.com/facebook/create-react-app/issues/8688
|
||||
stdin_open: true
|
||||
command: 'serve -l 3002 packages/result-app/build'
|
||||
|
||||
storybook:
|
||||
build:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"packages": ["packages/*"],
|
||||
"version": "0.1.0",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true
|
||||
"packages": ["packages/*"],
|
||||
"version": "1.0.0",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true
|
||||
}
|
||||
|
|
58
package.json
|
@ -4,36 +4,34 @@
|
|||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "0.1.0",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.13.15",
|
||||
"@prettier/plugin-xml": "^0.13.1",
|
||||
"@testing-library/dom": "^7.30.3",
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
"@testing-library/react": "^11.1.0",
|
||||
"@testing-library/user-event": "^12.1.10",
|
||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
||||
"@typescript-eslint/parser": "^4.22.0",
|
||||
"babel-loader": "8.1.0",
|
||||
"eslint": "^7.24.0",
|
||||
"eslint-config-airbnb-typescript": "^12.3.1",
|
||||
"eslint-config-prettier": "^8.2.0",
|
||||
"eslint-plugin-formatjs": "^2.14.10",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-jest": "^24.3.5",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-react": "^7.23.2",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"husky": "^6.0.0",
|
||||
"import-sort-style-module": "^6.0.0",
|
||||
"jest": "26.6.0",
|
||||
"lerna": "^4.0.0",
|
||||
"prettier": "2.2.1",
|
||||
"prettier-plugin-import-sort": "^0.0.6",
|
||||
"pretty-quick": "^3.1.0",
|
||||
"typescript": "^4.3.5",
|
||||
"webpack": "4.44.2"
|
||||
"scripts": {
|
||||
"start": "yarn run lerna run start --parallel",
|
||||
"start-with-storybook": "yarn storybook && yarn start",
|
||||
"build": "yarn run lerna run build --stream",
|
||||
"test": "yarn run lerna run test --parallel",
|
||||
"lint": "yarn run lerna run lint --parallel",
|
||||
"lint:fix": "yarn run lerna run lint:fix --parallel",
|
||||
"bundle": "yarn run lerna run bundle --parallel",
|
||||
"clean": "yarn run lerna clean --yes",
|
||||
"bootstrap": "yarn clean && lerna bootstrap",
|
||||
"storybook": "yarn run lerna run storybook"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@prettier/plugin-xml": "^1.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.32.0",
|
||||
"@typescript-eslint/parser": "^4.32.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb": "^18.2.1",
|
||||
"eslint-config-airbnb-typescript": "^14.0.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-react": "^7.26.0",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"lerna": "^4.0.0",
|
||||
"prettier": "^2.4.1"
|
||||
},
|
||||
"version": "1.0.0",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = {
|
||||
extends: ["../../.eslintrc.js"],
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../.eslintrc.json"
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
|
@ -1,6 +1,10 @@
|
|||
{
|
||||
"name": "@electionguard-ui/admin-app",
|
||||
"version": "0.1.0",
|
||||
"description": "Admin application for administrating electionguard",
|
||||
"author": "electionguard",
|
||||
"license": "MIT",
|
||||
"repository": "microsoft/electionguard-ui",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
|
@ -10,6 +14,7 @@
|
|||
"@types/node": "^12.0.0",
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"babel-loader": "8.1.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-scripts": "4.0.3",
|
||||
|
@ -17,16 +22,13 @@
|
|||
"web-vitals": "^1.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"start": "PORT=3001 react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
"lint": "yarn eslint",
|
||||
"lint:fix": "yarn eslint --fix && yarn prettier --write",
|
||||
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx",
|
||||
"prettier": "prettier --check '{src,public}/**/*.{js,jsx,ts,tsx,css,html,svg}'"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="description" content="Web site created using create-react-app" />
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
@ -24,12 +21,12 @@
|
|||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
|
@ -38,6 +35,5 @@
|
|||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
--></body>
|
||||
</html>
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';
|
|||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
||||
|
|
|
@ -1,27 +1,22 @@
|
|||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
|
@ -1,14 +1,13 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
ΠΠΎ Π¨ΠΈΡΠΈΠ½Π°: | ΠΡΡΠΎΡΠ°: | Π Π°Π·ΠΌΠ΅Ρ: 2.6 KiB |
|
@ -2,15 +2,15 @@ import { ReportHandler } from 'web-vitals';
|
|||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
||||
|
|
|
@ -1,7 +1,21 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx"
|
||||
"module": "esnext",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"moduleResolution": "node",
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"target": "esnext"
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../.eslintrc.json"
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "@electionguard-ui/api-client",
|
||||
"version": "1.0.0",
|
||||
"description": "API client for electionguard-api-python",
|
||||
"author": "electionguard",
|
||||
"license": "MIT",
|
||||
"repository": "microsoft/electionguard-ui",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.modern.js",
|
||||
"source": "src/index.ts",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn run bundle",
|
||||
"start": "yarn run bundle watch --no-compress",
|
||||
"test": "react-scripts test",
|
||||
"bundle": "microbundle --jsx 'React.createElement' --jsxImportSource react --globals react/jsx-runtime=jsx --format modern,cjs",
|
||||
"lint": "yarn eslint",
|
||||
"lint:fix": "yarn eslint --fix && yarn prettier --write",
|
||||
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx",
|
||||
"prettier": "prettier --check '{src,public}/**/*.{js,jsx,ts,tsx,css,html,svg}'"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.5.0",
|
||||
"@testing-library/user-event": "^7.2.1",
|
||||
"@types/jest": "^25.1.4",
|
||||
"@types/node": "^12.12.38",
|
||||
"@types/react": "^16.9.27",
|
||||
"@types/react-dom": "^16.9.7",
|
||||
"microbundle": "^0.13.3",
|
||||
"babel-loader": "8.1.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-scripts": "4.0.3",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"env": {
|
||||
"jest": true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import { filterByTerm } from '.';
|
||||
|
||||
describe('Filter function', () => {
|
||||
test('it should filter by a search term (link)', () => {
|
||||
const input = [
|
||||
{ id: 1, url: 'https://www.url1.dev' },
|
||||
{ id: 2, url: 'https://www.url2.dev' },
|
||||
{ id: 3, url: 'https://www.link3.dev' },
|
||||
];
|
||||
|
||||
const output = [{ id: 3, url: 'https://www.link3.dev' }];
|
||||
|
||||
expect(filterByTerm(input, 'link')).toEqual(output);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
export interface UrlHolder {
|
||||
url: string;
|
||||
}
|
||||
|
||||
export const filterByTerm = (inputArr: UrlHolder[], searchTerm: string): UrlHolder[] =>
|
||||
inputArr.filter((arrayElement) => arrayElement.url.match(searchTerm));
|
|
@ -0,0 +1 @@
|
|||
/// <reference types="react-scripts" />
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"lib": ["dom", "esnext"],
|
||||
"moduleResolution": "node",
|
||||
"jsx": "react",
|
||||
"allowJs": true,
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"outDir": "dist",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs"
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = {
|
||||
extends: ["../../.eslintrc.js"],
|
||||
};
|
|
@ -1,2 +0,0 @@
|
|||
node_modules/
|
||||
build/
|
|
@ -1,12 +1,15 @@
|
|||
{
|
||||
"name": "@electionguard-ui/api",
|
||||
"version": "0.2.0",
|
||||
"description": "Archived Api Client Project",
|
||||
"author": "electionguard",
|
||||
"license": "MIT",
|
||||
"repository": "microsoft/electionguard-ui",
|
||||
"version": "1.0.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"/dist"
|
||||
],
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "tsc -b",
|
||||
"build-local": "yarn build"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"rootDir": "./src",
|
||||
|
@ -9,7 +8,19 @@
|
|||
"sourceMap": true,
|
||||
"composite": false,
|
||||
"jsx": "react",
|
||||
"noEmit": false
|
||||
"noEmit": false,
|
||||
"target": "es2017",
|
||||
"module": "esnext",
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "**/__tests__/*"]
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = {
|
||||
extends: ["../../.eslintrc.js"],
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": ["../../.eslintrc.json"]
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
|
@ -1,9 +1,14 @@
|
|||
{
|
||||
"name": "@electionguard-ui/library",
|
||||
"version": "0.0.0",
|
||||
"description": "Component Library of specialized electionguard ui",
|
||||
"author": "electionguard",
|
||||
"license": "MIT",
|
||||
"repository": "microsoft/electionguard-ui",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.13.15",
|
||||
"@electionguard-ui/api": "0.2.0",
|
||||
"@electionguard-ui/api": "1.0.0",
|
||||
"@formatjs/intl": "^1.14.2",
|
||||
"@material-ui/core": "^4.11.3",
|
||||
"@material-ui/data-grid": "^4.0.0-alpha.29",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
|
@ -15,57 +20,39 @@
|
|||
"@storybook/node-logger": "^6.2.7",
|
||||
"@storybook/preset-create-react-app": "^3.1.7",
|
||||
"@storybook/react": "^6.2.7",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.5.0",
|
||||
"@testing-library/user-event": "^7.2.1",
|
||||
"@types/jest": "^26.0.15",
|
||||
"@types/node": "^12.0.0",
|
||||
"@types/react": "^17.0.2",
|
||||
"@types/react-dom": "^17.0.2",
|
||||
"@types/react-intl": "^3.0.0",
|
||||
"@types/react-router-dom": "^5.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
||||
"@typescript-eslint/parser": "^4.22.0",
|
||||
"babel-loader": "8.1.0",
|
||||
"clsx": "^1.1.1",
|
||||
"eslint-plugin-formatjs": "^2.14.10",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-react": "^7.23.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-intl": "^5.17.4",
|
||||
"react-query": "^3.23.0",
|
||||
"react-router": "^5.2.1",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-scripts": "4.0.3",
|
||||
"typescript": "^4.3.5",
|
||||
"web-vitals": "^1.0.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"trim": "^0.0.3"
|
||||
},
|
||||
"scripts": {
|
||||
"local": "react-scripts start",
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject",
|
||||
"lint": "eslint ./src --ext .js,.jsx,.ts,.tsx && prettier --check '{src,public}/**/*.{js,jsx,ts,tsx,css,html,svg}'",
|
||||
"build": "yarn run bundle",
|
||||
"start": "yarn run bundle watch --no-compress",
|
||||
"test": "react-scripts test --passWithNoTests",
|
||||
"bundle": "microbundle --jsx 'React.createElement' --jsxImportSource react --globals react/jsx-runtime=jsx --format modern,cjs --external .*/images/.*",
|
||||
"lint": "yarn eslint && yarn prettier",
|
||||
"lint:fix": "yarn eslint --fix && yarn prettier --write",
|
||||
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx",
|
||||
"prettier": "prettier --check '{src,public}/**/*.{js,jsx,ts,tsx,css,html,svg}'",
|
||||
"storybook": "start-storybook -p 6006 -s ./public",
|
||||
"build-storybook": "build-storybook -s public"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"**/*.stories.*"
|
||||
],
|
||||
"rules": {
|
||||
"import/no-anonymous-default-export": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
|
@ -77,17 +64,5 @@
|
|||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "pretty-quick --staged --pattern '{src,public}/**/*.{js,jsx,ts,tsx,css,html}'"
|
||||
}
|
||||
},
|
||||
"importSort": {
|
||||
".js, .jsx, .ts, .tsx": {
|
||||
"style": "module",
|
||||
"parser": "typescript"
|
||||
}
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
import { render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
|
||||
import App from './App';
|
||||
import { ConfigContext, defaultConfig } from './contexts/config';
|
||||
import { LanguageContext, defaultLanguage } from './contexts/language';
|
||||
|
||||
test('renders logo', () => {
|
||||
render(
|
||||
<ConfigContext.Provider value={defaultConfig}>
|
||||
<LanguageContext.Provider value={defaultLanguage}>
|
||||
<IntlProvider locale={defaultLanguage.locale} messages={defaultLanguage.messages}>
|
||||
<App />
|
||||
</IntlProvider>
|
||||
</LanguageContext.Provider>
|
||||
</ConfigContext.Provider>
|
||||
);
|
||||
const logos = screen.getAllByText(/electionguard-logo.svg/i);
|
||||
const firstLogo = logos[0];
|
||||
expect(firstLogo).toBeInTheDocument();
|
||||
});
|
|
@ -46,7 +46,7 @@ const ManifestUploadStep: React.FC<ManifestUploadStepProps> = ({ onNext, uploadM
|
|||
const [uploading, setUploading] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
|
||||
const handleClose = (event?: React.SyntheticEvent, reason?: string) => {
|
||||
const handleClose = (_event?: React.SyntheticEvent, reason?: string) => {
|
||||
if (reason === 'clickaway') {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ const FormattedButton: React.FC<FormattedButtonProps> = (props) => {
|
|||
<Box className={className}>
|
||||
<Box display="inline-block" position="relative">
|
||||
<Button
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
{...buttonProps}
|
||||
onClick={upload ? undefined : onClick}
|
||||
className={classes.internal}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg
|
||||
|
@ -56,7 +56,7 @@
|
|||
C69.588,192.184,47.676,192.184,25.757,192.163z"
|
||||
/>
|
||||
</g>
|
||||
<g/>
|
||||
<g />
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
|
@ -83,7 +83,7 @@
|
|||
C177.686,108.788,160.615,125.558,139.3,125.711z"
|
||||
/>
|
||||
</g>
|
||||
<g/>
|
||||
<g />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
|
|
ΠΠΎ Π¨ΠΈΡΠΈΠ½Π°: | ΠΡΡΠΎΡΠ°: | Π Π°Π·ΠΌΠ΅Ρ: 5.4 KiB ΠΠΎΡΠ»Π΅ Π¨ΠΈΡΠΈΠ½Π°: | ΠΡΡΠΎΡΠ°: | Π Π°Π·ΠΌΠ΅Ρ: 5.4 KiB |
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg
|
||||
|
@ -56,7 +56,7 @@
|
|||
C69.588,192.184,47.676,192.184,25.757,192.163z"
|
||||
/>
|
||||
</g>
|
||||
<g/>
|
||||
<g />
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
|
@ -83,7 +83,7 @@
|
|||
C177.686,108.788,160.615,125.558,139.3,125.711z"
|
||||
/>
|
||||
</g>
|
||||
<g/>
|
||||
<g />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
|
@ -91,7 +91,7 @@
|
|||
fill="current"
|
||||
d="M385.763,157.191H329.43V56.843h54.093v14.135h-37.438V99.39h34.498v14.063h-34.498v29.672h39.678V157.191z"
|
||||
/>
|
||||
<path fill="current" d="M418.092,157.191h-16.303V51.105h16.303V157.191z"/>
|
||||
<path fill="current" d="M418.092,157.191h-16.303V51.105h16.303V157.191z" />
|
||||
<path
|
||||
fill="current"
|
||||
d="M499.897,125.774h-48.844c0.185,6.622,2.227,11.73,6.122,15.322c3.896,3.595,9.25,5.39,16.062,5.39
|
||||
|
|
ΠΠΎ Π¨ΠΈΡΠΈΠ½Π°: | ΠΡΡΠΎΡΠ°: | Π Π°Π·ΠΌΠ΅Ρ: 11 KiB ΠΠΎΡΠ»Π΅ Π¨ΠΈΡΠΈΠ½Π°: | ΠΡΡΠΎΡΠ°: | Π Π°Π·ΠΌΠ΅Ρ: 11 KiB |
|
@ -3,9 +3,9 @@ interface EnumStepper<TEnumValue extends number> {
|
|||
previousStep: (step: TEnumValue) => TEnumValue;
|
||||
}
|
||||
|
||||
export function createEnumStepper<T extends string, TEnumValue extends number>(
|
||||
stepEnum: { [key in T]: TEnumValue }
|
||||
): EnumStepper<TEnumValue> {
|
||||
export function createEnumStepper<T extends string, TEnumValue extends number>(stepEnum: {
|
||||
[key in T]: TEnumValue;
|
||||
}): EnumStepper<TEnumValue> {
|
||||
return {
|
||||
nextStep: (step: TEnumValue) =>
|
||||
step + 1 >= Object.keys(stepEnum).length / 2
|
||||
|
|
|
@ -1,7 +1,24 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx"
|
||||
"module": "esnext",
|
||||
"lib": ["dom", "esnext"],
|
||||
"moduleResolution": "node",
|
||||
"jsx": "react",
|
||||
"allowJs": true,
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"outDir": "dist",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist", ".storybook"]
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = {
|
||||
extends: ["../../.eslintrc.js"],
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../.eslintrc.json"
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
|
@ -1,8 +1,13 @@
|
|||
{
|
||||
"name": "@electionguard-ui/result-app",
|
||||
"version": "0.1.0",
|
||||
"description": "Result application for displaying electionguard results",
|
||||
"author": "electionguard",
|
||||
"license": "MIT",
|
||||
"repository": "microsoft/electionguard-ui",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@material-ui/core": "^4.12.3",
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
"@testing-library/react": "^11.1.0",
|
||||
"@testing-library/user-event": "^12.1.10",
|
||||
|
@ -10,24 +15,23 @@
|
|||
"@types/node": "^12.0.0",
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"babel-loader": "8.1.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-router": "^5.2.1",
|
||||
"react-router-dom": "^5.3.0",
|
||||
"react-scripts": "4.0.3",
|
||||
"typescript": "^4.3.5",
|
||||
"web-vitals": "^1.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"start": "PORT=3002 react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
"lint": "yarn eslint && yarn prettier",
|
||||
"lint:fix": "yarn eslint --fix && yarn prettier --write",
|
||||
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx",
|
||||
"prettier": "prettier --check '{src,public}/**/*.{js,jsx,ts,tsx,css,html,svg}'"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="description" content="Web site created using create-react-app" />
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
@ -24,12 +21,12 @@
|
|||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
|
@ -38,6 +35,5 @@
|
|||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
--></body>
|
||||
</html>
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
|
@ -2,8 +2,8 @@ import React from 'react';
|
|||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
test('renders page', () => {
|
||||
render(<App />);
|
||||
const h1Element = screen.getByText(/select election page/i);
|
||||
expect(h1Element).toBeInTheDocument();
|
||||
});
|
||||
|
|
|
@ -1,34 +1,14 @@
|
|||
import React from 'react';
|
||||
import { BrowserRouter as Router } from 'react-router-dom';
|
||||
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import MainRoutes from './routes/MainRoutes';
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
<Router>
|
||||
return (
|
||||
<Router>
|
||||
<MainRoutes />
|
||||
</Router>
|
||||
</div>
|
||||
);
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
|
@ -1,14 +1,13 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
ΠΠΎ Π¨ΠΈΡΠΈΠ½Π°: | ΠΡΡΠΎΡΠ°: | Π Π°Π·ΠΌΠ΅Ρ: 2.6 KiB |
|
@ -3,9 +3,9 @@ import { Box } from '@material-ui/core';
|
|||
|
||||
const BallotConfirmationPage: React.FC = ({ children }) => (
|
||||
<Box height="100vh" display="flex" flexDirection="column">
|
||||
{children}
|
||||
<h1> Ballot Confirmation Page</h1>
|
||||
{children}
|
||||
<h1> Ballot Confirmation Page</h1>
|
||||
</Box>
|
||||
);
|
||||
|
||||
export default BallotConfirmationPage;
|
||||
export default BallotConfirmationPage;
|
||||
|
|
|
@ -3,8 +3,8 @@ import { Box } from '@material-ui/core';
|
|||
|
||||
const ElectionPage: React.FC = ({ children }) => (
|
||||
<Box height="100vh" display="flex" flexDirection="column">
|
||||
{children}
|
||||
<h1> Election Page</h1>
|
||||
{children}
|
||||
<h1> Election Page</h1>
|
||||
</Box>
|
||||
);
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ import { Box } from '@material-ui/core';
|
|||
|
||||
const RecordsPage: React.FC = ({ children }) => (
|
||||
<Box height="100vh" display="flex" flexDirection="column">
|
||||
{children}
|
||||
<h1> Records Page</h1>
|
||||
{children}
|
||||
<h1> Records Page</h1>
|
||||
</Box>
|
||||
);
|
||||
|
||||
export default RecordsPage;
|
||||
export default RecordsPage;
|
||||
|
|
|
@ -3,10 +3,9 @@ import { Box } from '@material-ui/core';
|
|||
|
||||
const ResultsPage: React.FC = ({ children }) => (
|
||||
<Box height="100vh" display="flex" flexDirection="column">
|
||||
{children}
|
||||
<h1> Results Page</h1>
|
||||
{children}
|
||||
<h1> Results Page</h1>
|
||||
</Box>
|
||||
);
|
||||
|
||||
|
||||
export default ResultsPage;
|
||||
export default ResultsPage;
|
||||
|
|
|
@ -2,11 +2,10 @@ import React from 'react';
|
|||
import { Box } from '@material-ui/core';
|
||||
|
||||
const SelectElectionPage: React.FC = ({ children }) => (
|
||||
<Box height="100vh" display="flex" flexDirection="column">
|
||||
{children}
|
||||
<Box height="100vh" display="flex" flexDirection="column">
|
||||
{children}
|
||||
<h1> Select Election Page</h1>
|
||||
</Box>
|
||||
);
|
||||
|
||||
</Box>
|
||||
);
|
||||
|
||||
export default SelectElectionPage;
|
||||
export default SelectElectionPage;
|
||||
|
|
|
@ -2,15 +2,15 @@ import { ReportHandler } from 'web-vitals';
|
|||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
import React from "react";
|
||||
import {Route, Switch,Redirect } from "react-router-dom";
|
||||
import React from 'react';
|
||||
import { Route, Switch, Redirect } from 'react-router-dom';
|
||||
import ElectionPage from '../pages/ElectionPage';
|
||||
import RecordsPage from '../pages/RecordsPage';
|
||||
import ResultsPage from '../pages/ResultsPage';
|
||||
import BallotConfirmationPage from '../pages/BallotConfirmationPage';
|
||||
import SelectElectionPage from "../pages/SelectElectionPage";
|
||||
import SelectElectionPage from '../pages/SelectElectionPage';
|
||||
|
||||
const MainRoutes: React.FC = () => (
|
||||
<Switch>
|
||||
|
@ -20,5 +19,4 @@ const MainRoutes: React.FC = () => (
|
|||
</Switch>
|
||||
);
|
||||
|
||||
|
||||
export default MainRoutes;
|
||||
export default MainRoutes;
|
||||
|
|
|
@ -1,7 +1,21 @@
|
|||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx"
|
||||
"module": "esnext",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"moduleResolution": "node",
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"target": "esnext"
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2017",
|
||||
"module": "esnext",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true
|
||||
}
|
||||
}
|