Commit 17856fc7 authored by d.arizona's avatar d.arizona

change source

parent d1de1d22
{
"root": true,
"extends": "@notum-cz/eslint-config-notum-react/hooks",
"rules": {
"no-console": "off",
"prettier/prettier": "error",
"no-param-reassign": [
"error",
{
"props": true,
"ignorePropertyModificationsFor": [
"state",
"acc",
"e",
"ctx",
"req",
"request",
"res",
"response",
"$scope",
"registration"
]
}
],
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"no-alert": "off",
"@typescript-eslint/no-use-before-define": "off",
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
"no-shadow": "off"
},
"overrides": [
{
"files": ["**/store/**/*.ts"],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
}
]
}
# Tia-dev This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
semangat sist.. ## Available Scripts
\ No newline at end of file
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `npm run build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "tia-dev", "name": "my-app",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@babel/core": "^7.11.0",
"@emotion/core": "^10.0.28",
"@emotion/styled": "^10.0.27",
"@lingui/cli": "^2.9.1",
"@lingui/core": "^2.9.1",
"@lingui/macro": "^2.9.1",
"@lingui/react": "^2.9.1",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@notum-cz/eslint-config-notum-react": "^1.3.0",
"@sentry/browser": "^5.20.1",
"@testing-library/jest-dom": "^4.2.4", "@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0", "@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1", "@testing-library/user-event": "^7.2.1",
"@types/jest": "^24.9.1",
"@types/lingui__macro": "^2.7.3",
"@types/lingui__react": "^2.8.2",
"@types/node": "^12.12.53",
"@types/react": "^16.9.44",
"@types/react-dom": "^16.9.8",
"@types/react-redux": "^7.1.9",
"@types/react-router-dom": "^5.1.5",
"@types/redux-logger": "^3.0.8",
"babel-core": "^7.0.0-bridge.0",
"bootstrap": "^4.5.0",
"immer": "^6.0.9",
"jscpd": "^3.3.1",
"prettier": "^2.0.5",
"react": "^16.13.1", "react": "^16.13.1",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",
"react-hook-form": "^5.7.2", "react-scripts": "3.4.1"
"react-redux": "^7.2.1",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.1",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"ts-action": "^11.0.0",
"ts-action-immer": "^3.0.3",
"typescript": "^3.7.5",
"use-immer": "^0.4.1"
}, },
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject", "eject": "react-scripts eject"
"lint": "eslint src/ --ext .tsx,.ts",
"lint:fix": "eslint --fix src/ --ext .tsx,.ts",
"add-locale": "lingui add-locale",
"extract": "lingui extract",
"compile": "lingui compile",
"duplicity": "jscpd --ignore '**/*.min.js,**/*.map' ./src"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app"
......
import React from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</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;
import React from "react"; import React from 'react';
import { render } from "@testing-library/react"; import { render } from '@testing-library/react';
import App from "./App"; import App from './App';
test("renders learn react link", () => { test('renders learn react link', () => {
const { getByText } = render(<App />); const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i); const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument(); expect(linkElement).toBeInTheDocument();
......
import React, { Suspense } from "react";
import "./App.css";
import { I18nProvider } from "@lingui/react";
import { useSelector } from "react-redux";
import { BrowserRouter as Router, Switch, Route, Link } from "react-router-dom";
import { getSelectedLanguage } from "./store/general/selectors";
import routes from "./router";
import { AppLanguages } from "./helpers/constants/languages";
import catalogCs from "./plugins/locales/cs/messages";
import catalogEn from "./plugins/locales/en/messages";
const catalogs: { [key in AppLanguages]: any } = {
cs: catalogCs,
en: catalogEn,
};
function App(): JSX.Element {
const language = useSelector(getSelectedLanguage);
const renderLoading = (text: string): JSX.Element => {
return <h1>{text}</h1>;
};
return (
<Suspense fallback={renderLoading("Aplikace se nacita")}>
<I18nProvider language={language} catalogs={catalogs}>
<Router>
<div>
<nav>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/about">About</Link>
</li>
</ul>
</nav>
{/* A <Switch> looks through its children <Route>s and
renders the first one that matches the current URL. */}
<Switch>
{routes.map((route) => (
<Route key={route.path} path={route.path} {...route.props} />
))}
</Switch>
</div>
</Router>
</I18nProvider>
</Suspense>
);
}
export default App;
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="6" viewBox="0 0 8 6">
<g fill="none" fill-rule="evenodd">
<path d="M0 0H23.977V24H0z" transform="rotate(90 13.5 2.5)"/>
<path fill="#4B4B4B" d="M8.998 10.02L15.002 8.998 13.975 14.998z" transform="rotate(90 13.5 2.5) rotate(45 12 11.998)"/>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<g fill="none" fill-rule="evenodd">
<circle cx="16" cy="16" r="16" fill="#FFF" opacity=".247"/>
<g>
<path d="M0 0H24V24H0z" transform="translate(4 4)"/>
<g fill-rule="nonzero">
<path fill="#F5F5F5" d="M17.655 11.78H.31c-.171 0-.31-.139-.31-.31V.32C0 .147.139.01.31.01h17.345c.171 0 .31.138.31.31v11.15c0 .171-.139.31-.31.31z" transform="translate(4 4) translate(3 6)"/>
<g fill="#FF4B55">
<path d="M17.965.915H0V.32C0 .15.139.01.31.01h17.345c.171 0 .31.14.31.31v.596zM0 3.631H17.965V4.631H0zM0 1.82H17.965V2.8200000000000003H0zM17.965 6.347H.31c-.171 0-.31-.138-.31-.31v-.595h17.965v.905zM0 9.064H17.965V10.064H0zM17.655 11.78H.31c-.171 0-.31-.139-.31-.31v-.596h17.965v.596c0 .171-.139.31-.31.31zM0 7.253H17.965V8.253H0z" transform="translate(4 4) translate(3 6)"/>
</g>
<path fill="#41479B" d="M8.053.01H.31C.139.01 0 .148 0 .32v5.718c0 .17.139.31.31.31h7.743c.171 0 .31-.14.31-.31V.319c0-.17-.139-.31-.31-.31z" transform="translate(4 4) translate(3 6)"/>
<g fill="#F5F5F5">
<path d="M.379.054L.447.26.664.26c.028 0 .04.036.017.053L.507.443l.065.206C.581.676.55.7.527.682L.351.556.175.682C.152.698.12.676.13.649L.195.443.021.314C-.002.297.01.262.038.261L.255.26.323.054C.332.027.37.027.38.054zM.379 1.13l.068.205.217.002c.028 0 .04.036.017.053l-.174.128.065.207c.009.027-.022.049-.045.032l-.176-.126-.176.127C.152 1.774.12 1.752.13 1.725l.065-.207-.174-.128c-.023-.017-.011-.053.017-.053l.217-.002.068-.205c.009-.027.047-.027.056 0zM.379 2.205l.068.206.217.001c.028 0 .04.036.017.053l-.174.129.065.206c.009.027-.022.05-.045.033l-.176-.126-.176.126C.152 2.85.12 2.827.13 2.801l.065-.207-.174-.129c-.023-.017-.011-.052.017-.053l.217-.001.068-.206c.009-.026.047-.026.056 0zM.379 3.28l.068.206.217.002c.028 0 .04.036.017.053l-.174.128.065.207c.009.027-.022.049-.045.033l-.176-.126-.176.126C.152 3.925.12 3.903.13 3.876l.065-.206-.174-.13c-.023-.016-.011-.052.017-.052l.217-.002.068-.205c.009-.027.047-.027.056 0zM.379 4.356l.068.206.217.002c.028 0 .04.036.017.052l-.174.13.065.206c.009.026-.022.049-.045.032l-.176-.126-.176.126C.152 5.001.12 4.978.13 4.952l.065-.207-.174-.129C-.002 4.6.01 4.564.038 4.564l.217-.002.068-.206c.009-.026.047-.026.056 0zM1.213.581l.069.206.217.002c.028 0 .04.036.017.052L1.34.97l.066.207c.008.026-.022.049-.045.032l-.176-.126-.177.126c-.022.017-.053-.006-.044-.032L1.03.97.856.841C.833.825.845.79.873.79l.216-.002.069-.206c.009-.026.047-.026.055 0zM1.213 1.657l.069.206.217.001c.028 0 .04.036.017.053l-.175.129.066.206c.008.027-.022.05-.045.033l-.176-.126-.177.126C.987 2.3.956 2.279.965 2.252l.065-.206-.174-.13C.833 1.9.845 1.865.873 1.865l.216-.001.069-.206c.009-.027.047-.027.055 0zM1.213 2.732l.069.206.217.002c.028 0 .04.036.017.052l-.175.13.066.206c.008.027-.022.049-.045.032l-.176-.126-.177.126c-.022.017-.053-.005-.044-.032l.065-.207-.174-.129C.833 2.976.845 2.94.873 2.94l.216-.002.069-.206c.009-.026.047-.026.055 0zM1.213 3.808l.069.206.217.001c.028 0 .04.036.017.053l-.175.129.066.206c.008.027-.022.05-.045.033l-.176-.126-.177.126c-.022.016-.053-.006-.044-.033l.065-.206-.174-.129c-.023-.017-.011-.052.017-.053l.216-.001.069-.206c.009-.027.047-.027.055 0zM2.048.054l.069.206.217.001c.028 0 .04.036.017.053l-.175.129.066.206c.008.027-.022.05-.045.033L2.02.556l-.177.126C1.821.698 1.791.676 1.8.649l.066-.206-.175-.13c-.022-.016-.01-.052.018-.052L1.924.26l.069-.206c.009-.027.046-.027.055 0zM2.048 1.13l.069.205.217.002c.028 0 .04.036.017.053l-.175.128.066.207c.008.027-.022.049-.045.032l-.176-.126-.177.126c-.023.017-.053-.005-.045-.032l.066-.207-.175-.128c-.022-.017-.01-.053.018-.053l.216-.002.069-.205c.009-.027.046-.027.055 0zM2.048 2.205l.069.206.217.001c.028 0 .04.036.017.053l-.175.129.066.206c.008.027-.022.05-.045.033l-.176-.126-.177.126c-.023.016-.053-.006-.045-.033l.066-.206-.175-.129c-.022-.017-.01-.052.018-.053l.216-.001.069-.206c.009-.026.046-.026.055 0zM2.048 3.28l.069.206.217.002c.028 0 .04.036.017.053l-.175.128.066.207c.008.027-.022.049-.045.033l-.176-.126-.177.126c-.023.016-.053-.006-.045-.033l.066-.207-.175-.128c-.022-.017-.01-.053.018-.053l.216-.002.069-.205c.009-.027.046-.027.055 0zM2.048 4.356l.069.206.217.002c.028 0 .04.036.017.052l-.175.13.066.206c.008.026-.022.049-.045.032l-.176-.126-.177.126c-.023.017-.053-.006-.045-.032l.066-.207-.175-.129c-.022-.016-.01-.052.018-.052l.216-.002.069-.206c.009-.026.046-.026.055 0zM2.883.581l.069.206.216.002c.028 0 .04.036.018.052L3.01.97l.066.207c.008.026-.022.049-.045.032l-.177-.126-.176.126c-.023.017-.053-.006-.045-.032L2.7.97 2.525.841C2.503.825 2.515.79 2.542.79L2.76.787 2.828.58c.009-.026.046-.026.055 0zM2.883 1.657l.069.206.216.001c.028 0 .04.036.018.053l-.175.129.066.206c.008.027-.022.05-.045.033l-.177-.126-.176.126c-.023.016-.053-.006-.045-.033l.066-.206-.175-.13c-.022-.016-.01-.052.017-.052l.217-.001.069-.206c.009-.027.046-.027.055 0zM2.883 2.732l.069.206.216.002c.028 0 .04.036.018.052l-.175.13.066.206c.008.027-.022.049-.045.032l-.177-.126-.176.126c-.023.017-.053-.005-.045-.032L2.7 3.12l-.175-.129c-.022-.016-.01-.052.017-.052l.217-.002.069-.206c.009-.026.046-.026.055 0zM2.883 3.808l.069.206.216.001c.028 0 .04.036.018.053l-.175.129.066.206c.008.027-.022.05-.045.033l-.177-.126-.176.126c-.023.016-.053-.006-.045-.033l.066-.206-.175-.129c-.022-.017-.01-.052.017-.053l.217-.001.069-.206c.009-.027.046-.027.055 0zM3.718.054l.069.206.216.001c.028 0 .04.036.017.053l-.174.129.065.206c.009.027-.022.05-.044.033L3.69.556l-.176.126C3.49.698 3.46.676 3.469.649l.065-.206-.174-.13c-.022-.016-.01-.052.017-.052L3.594.26l.069-.206c.008-.027.046-.027.055 0zM3.718 1.13l.069.205.216.002c.028 0 .04.036.017.053l-.174.128.065.207c.009.027-.022.049-.044.032l-.177-.126-.176.126c-.023.017-.053-.005-.045-.032l.065-.207-.174-.128c-.022-.017-.01-.053.017-.053l.217-.002.069-.205c.008-.027.046-.027.055 0zM3.718 2.205l.069.206.216.001c.028 0 .04.036.017.053l-.174.129.065.206c.009.027-.022.05-.044.033l-.177-.126-.176.126c-.023.016-.053-.006-.045-.033l.065-.206-.174-.129c-.022-.017-.01-.052.017-.053l.217-.001.069-.206c.008-.026.046-.026.055 0zM3.718 3.28l.069.206.216.002c.028 0 .04.036.017.053l-.174.128.065.207c.009.027-.022.049-.044.033l-.177-.126-.176.126c-.023.016-.053-.006-.045-.033l.065-.207-.174-.128c-.022-.017-.01-.053.017-.053l.217-.002.069-.205c.008-.027.046-.027.055 0zM3.718 4.356l.069.206.216.002c.028 0 .04.036.017.052l-.174.13.065.206c.009.026-.022.049-.044.032l-.177-.126-.176.126c-.023.017-.053-.006-.045-.032l.065-.207-.174-.129c-.022-.016-.01-.052.017-.052l.217-.002.069-.206c.008-.026.046-.026.055 0zM4.553.581l.068.206.217.002c.028 0 .04.036.017.052L4.681.97l.065.207c.009.026-.022.049-.045.032l-.176-.126-.176.126c-.023.017-.053-.006-.045-.032L4.369.97 4.195.841C4.172.825 4.185.79 4.212.79L4.43.787 4.497.58c.01-.026.047-.026.056 0zM4.553 1.657l.068.206.217.001c.028 0 .04.036.017.053l-.174.129.065.206c.009.027-.022.05-.045.033l-.176-.126-.176.126c-.023.016-.053-.006-.045-.033l.065-.206-.174-.13c-.023-.016-.01-.052.017-.052l.217-.001.068-.206c.01-.027.047-.027.056 0zM4.553 2.732l.068.206.217.002c.028 0 .04.036.017.052l-.174.13.065.206c.009.027-.022.049-.045.032l-.176-.126-.176.126c-.023.017-.053-.005-.045-.032l.065-.207-.174-.129c-.023-.016-.01-.052.017-.052l.217-.002.068-.206c.01-.026.047-.026.056 0zM4.553 3.808l.068.206.217.001c.028 0 .04.036.017.053l-.174.129.065.206c.009.027-.022.05-.045.033l-.176-.126-.176.126c-.023.016-.053-.006-.045-.033l.065-.206-.174-.129c-.023-.017-.01-.052.017-.053l.217-.001.068-.206c.01-.027.047-.027.056 0zM5.388.054l.068.206.217.001c.028 0 .04.036.017.053l-.174.129.065.206c.009.027-.022.05-.045.033L5.36.556l-.176.126C5.16.698 5.13.676 5.139.649l.065-.206-.174-.13c-.023-.016-.011-.052.017-.052L5.264.26l.068-.206c.01-.027.047-.027.056 0zM5.388 1.13l.068.205.217.002c.028 0 .04.036.017.053l-.174.128.065.207c.009.027-.022.049-.045.032l-.176-.126-.176.126c-.023.017-.054-.005-.045-.032l.065-.207-.174-.128c-.023-.017-.011-.053.017-.053l.217-.002.068-.205c.01-.027.047-.027.056 0zM5.388 2.205l.068.206.217.001c.028 0 .04.036.017.053l-.174.129.065.206c.009.027-.022.05-.045.033l-.176-.126-.176.126c-.023.016-.054-.006-.045-.033l.065-.206-.174-.129c-.023-.017-.011-.052.017-.053l.217-.001.068-.206c.01-.026.047-.026.056 0zM5.388 3.28l.068.206.217.002c.028 0 .04.036.017.053l-.174.128.065.207c.009.027-.022.049-.045.033l-.176-.126-.176.126c-.023.016-.054-.006-.045-.033l.065-.207-.174-.128c-.023-.017-.011-.053.017-.053l.217-.002.068-.205c.01-.027.047-.027.056 0zM5.388 4.356l.068.206.217.002c.028 0 .04.036.017.052l-.174.13.065.206c.009.026-.022.049-.045.032l-.176-.126-.176.126c-.023.017-.054-.006-.045-.032l.065-.207-.174-.129c-.023-.016-.011-.052.017-.052l.217-.002.068-.206c.01-.026.047-.026.056 0zM6.223.581l.068.206.217.002c.028 0 .04.036.017.052L6.35.97l.065.207c.008.026-.022.049-.045.032l-.176-.126-.176.126c-.023.017-.054-.006-.045-.032L6.039.97 5.865.841C5.842.825 5.854.79 5.882.79l.217-.002.068-.206c.009-.026.047-.026.056 0zM6.223 1.657l.068.206.217.001c.028 0 .04.036.017.053l-.174.129.065.206c.008.027-.022.05-.045.033l-.176-.126-.176.126c-.023.016-.054-.006-.045-.033l.065-.206-.174-.13c-.023-.016-.011-.052.017-.052l.217-.001.068-.206c.009-.027.047-.027.056 0zM6.223 2.732l.068.206.217.002c.028 0 .04.036.017.052l-.174.13.065.206c.008.027-.022.049-.045.032l-.176-.126-.176.126c-.023.017-.054-.005-.045-.032l.065-.207-.174-.129c-.023-.016-.011-.052.017-.052l.217-.002.068-.206c.009-.026.047-.026.056 0zM6.223 3.808l.068.206.217.001c.028 0 .04.036.017.053l-.174.129.065.206c.008.027-.022.05-.045.033l-.176-.126-.176.126c-.023.016-.054-.006-.045-.033l.065-.206-.174-.129c-.023-.017-.011-.052.017-.053l.217-.001.068-.206c.009-.027.047-.027.056 0zM7.057.054l.069.206.217.001c.028 0 .04.036.017.053l-.175.129.066.206c.008.027-.022.05-.045.033L7.03.556l-.177.126C6.831.698 6.8.676 6.81.649l.065-.206L6.7.313c-.023-.016-.011-.052.017-.052L6.933.26l.069-.206c.009-.027.046-.027.055 0zM7.057 1.13l.069.205.217.002c.028 0 .04.036.017.053l-.175.128.066.207c.008.027-.022.049-.045.032l-.176-.126-.177.126c-.022.017-.053-.005-.044-.032l.065-.207L6.7 1.39c-.023-.017-.011-.053.017-.053l.216-.002.069-.205c.009-.027.046-.027.055 0zM7.057 2.205l.069.206.217.001c.028 0 .04.036.017.053l-.175.129.066.206c.008.027-.022.05-.045.033l-.176-.126-.177.126c-.022.016-.053-.006-.044-.033l.065-.206-.174-.129c-.023-.017-.011-.052.017-.053l.216-.001.069-.206c.009-.026.046-.026.055 0zM7.057 3.28l.069.206.217.002c.028 0 .04.036.017.053l-.175.128.066.207c.008.027-.022.049-.045.033l-.176-.126-.177.126c-.022.016-.053-.006-.044-.033l.065-.207-.174-.128c-.023-.017-.011-.053.017-.053l.216-.002.069-.205c.009-.027.046-.027.055 0zM7.057 4.356l.069.206.217.002c.028 0 .04.036.017.052l-.175.13.066.206c.008.026-.022.049-.045.032l-.176-.126-.177.126c-.022.017-.053-.006-.044-.032l.065-.207-.174-.129c-.023-.016-.011-.052.017-.052l.216-.002.069-.206c.009-.026.046-.026.055 0z" transform="translate(4 4) translate(3 6) translate(.491 .667)"/>
</g>
</g>
</g>
</g>
</svg>
export enum AppLanguages {
EN = "en",
CS = "cs",
}
export const DEFAULT_LANGUAGE = AppLanguages.EN;
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
import React from "react";
import ReactDOM from "react-dom";
import "bootstrap/dist/css/bootstrap.min.css"
import * as Sentry from "@sentry/browser";
import { Provider } from "react-redux";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
import store from "./store";
if (process.env.NODE_ENV === "production") {
Sentry.init({ dsn: process.env.SENTRY_DNS });
}
ReactDOM.render(
// TODO: Add <React.StrictMode> when lingui@v3 will be released
<Provider store={store}>
{/* See https://emotion.sh/docs/theming for more info */}
{/* <ThemeProvider theme={theme}> */}
<App />
{/* </ThemeProvider> */}
</Provider>,
document.getElementById("root")
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
import React from "react";
import { Trans } from "@lingui/macro";
const Home: React.FC = () => {
return (
<div>
<Trans render="h1">About</Trans>
</div>
);
};
export default Home;
import React from 'react';
import clsx from 'clsx';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import Drawer from '@material-ui/core/Drawer';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import List from '@material-ui/core/List';
import CssBaseline from '@material-ui/core/CssBaseline';
import Typography from '@material-ui/core/Typography';
import Divider from '@material-ui/core/Divider';
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import InboxIcon from '@material-ui/icons/MoveToInbox';
import MailIcon from '@material-ui/icons/Mail';
const drawerWidth = 240;
const useStyles = makeStyles((theme) => ({
root: {
display: 'flex',
},
appBar: {
zIndex: theme.zIndex.drawer + 1,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
},
appBarShift: {
marginLeft: drawerWidth,
width: `calc(100% - ${drawerWidth}px)`,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
},
menuButton: {
marginRight: 36,
},
hide: {
display: 'none',
},
drawer: {
width: drawerWidth,
flexShrink: 0,
whiteSpace: 'nowrap',
},
drawerOpen: {
width: drawerWidth,
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
},
drawerClose: {
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
overflowX: 'hidden',
width: theme.spacing(7) + 1,
[theme.breakpoints.up('sm')]: {
width: theme.spacing(9) + 1,
},
},
toolbar: {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
padding: theme.spacing(0, 1),
// necessary for content to be below app bar
...theme.mixins.toolbar,
},
content: {
flexGrow: 1,
padding: theme.spacing(3),
},
}));
export default function MiniDrawer() {
const classes = useStyles();
const theme = useTheme();
const [open, setOpen] = React.useState(false);
const handleDrawerOpen = () => {
setOpen(true);
};
const handleDrawerClose = () => {
setOpen(false);
};
return (
<div className={classes.root}>
<CssBaseline />
<AppBar
position="fixed"
className={clsx(classes.appBar, {
[classes.appBarShift]: open,
})}
>
<Toolbar style={{ flex: 1, backgroundColor: 'white' }}>
<IconButton
color="default"
aria-label="open drawer"
onClick={handleDrawerOpen}
edge="start"
className={clsx(classes.menuButton, {
[classes.hide]: open,
})}
>
<MenuIcon />
</IconButton>
<div style={{ backgroundColor: 'white', height: '70px', display: 'flex', flex: 1, placeContent: 'flex-end' }}>
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', paddingRight: 20, paddingLeft: 20 }}>
<div style={{ width: 44, height: 44, backgroundColor: '#354960', borderRadius: 30, marginRight: 10 }} />
<Typography style={{ color: 'black' }}>Tommy</Typography>
<img src={require('../assets/dropdown-white.svg')} alt="React Logo" style={{ marginLeft: 15 }} />
</div>
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', paddingRight: 10, paddingLeft: 10, borderLeftColor: '#c2c2c2', borderLeftWidth: .2, borderLeftStyle: 'solid' }}>
<img src={require('../assets/search.png')} alt="React Logo" style={{ height: 18, width: 18 }} />
</div>
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', paddingRight: 20, paddingLeft: 20, borderLeftColor: '#c2c2c2', borderLeftWidth: .2, borderLeftStyle: 'solid' }}>
<img src={require('../assets/flagEnglish.png')} alt="React Logo" style={{ height: 32, width: 32 }} />
<Typography style={{ color: 'black' }}>EN</Typography>
</div>
</div>
</Toolbar>
</AppBar>
<Drawer
variant="permanent"
className={clsx(classes.drawer, {
[classes.drawerOpen]: open,
[classes.drawerClose]: !open,
})}
classes={{
paper: clsx({
[classes.drawerOpen]: open,
[classes.drawerClose]: !open,
}),
}}
>
<div className={classes.toolbar}>
<IconButton onClick={handleDrawerClose}>
{theme.direction === 'rtl' ? <ChevronRightIcon /> : <ChevronLeftIcon />}
</IconButton>
</div>
<Divider />
<List>
{['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) => (
<ListItem button key={text}>
<ListItemIcon>{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}</ListItemIcon>
<ListItemText primary={text} />
</ListItem>
))}
</List>
<Divider />
<List>
{['All mail', 'Trash', 'Spam'].map((text, index) => (
<ListItem button key={text}>
<ListItemIcon>{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}</ListItemIcon>
<ListItemText primary={text} />
</ListItem>
))}
</List>
</Drawer>
<main className={classes.content}>
<div className={classes.toolbar} />
<Typography paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua. Rhoncus dolor purus non enim praesent elementum
facilisis leo vel. Risus at ultrices mi tempus imperdiet. Semper risus in hendrerit
gravida rutrum quisque non tellus. Convallis convallis tellus id interdum velit laoreet id
donec ultrices. Odio morbi quis commodo odio aenean sed adipiscing. Amet nisl suscipit
adipiscing bibendum est ultricies integer quis. Cursus euismod quis viverra nibh cras.
Metus vulputate eu scelerisque felis imperdiet proin fermentum leo. Mauris commodo quis
imperdiet massa tincidunt. Cras tincidunt lobortis feugiat vivamus at augue. At augue eget
arcu dictum varius duis at consectetur lorem. Velit sed ullamcorper morbi tincidunt. Lorem
donec massa sapien faucibus et molestie ac.
</Typography>
<Typography paragraph>
Consequat mauris nunc congue nisi vitae suscipit. Fringilla est ullamcorper eget nulla
facilisi etiam dignissim diam. Pulvinar elementum integer enim neque volutpat ac
tincidunt. Ornare suspendisse sed nisi lacus sed viverra tellus. Purus sit amet volutpat
consequat mauris. Elementum eu facilisis sed odio morbi. Euismod lacinia at quis risus sed
vulputate odio. Morbi tincidunt ornare massa eget egestas purus viverra accumsan in. In
hendrerit gravida rutrum quisque non tellus orci ac. Pellentesque nec nam aliquam sem et
tortor. Habitant morbi tristique senectus et. Adipiscing elit duis tristique sollicitudin
nibh sit. Ornare aenean euismod elementum nisi quis eleifend. Commodo viverra maecenas
accumsan lacus vel facilisis. Nulla posuere sollicitudin aliquam ultrices sagittis orci a.
</Typography>
</main>
</div>
);
}
import "../styles/Sidebar.css";
import React from "react";
export const Sidebar = ({ width, height, children }) => {
const [xPosition, setX] = React.useState(-width);
const toggleMenu = () => {
if (xPosition < 0) {
setX(0);
} else {
setX(-width);
}
};
React.useEffect(() => {
setX(0);
}, []);
return (
<React.Fragment>
<div
className="side-bar"
style={{
transform: `translatex(${xPosition}px)`,
width: width,
minHeight: height
}}
>
<button
onClick={() => toggleMenu()}
className="toggle-menu"
style={{
transform: `translate(${width}px, 20vh)`
}}
></button>
<div className="content">{children}</div>
</div>
</React.Fragment>
);
};
\ No newline at end of file
{
"About": {
"origin": [
[
"src/pages/About.tsx",
5
]
]
}
}
\ No newline at end of file
{
"Home": {
"origin": [
[
"src/pages/Home.tsx",
5
]
]
}
}
\ No newline at end of file
/* eslint-disable */module.exports={languageData:{"plurals":function(n,ord){var s=String(n).split("."),i=s[0],v0=!s[1];if(ord)return"other";return n==1&&v0?"one":i>=2&&i<=4&&v0?"few":!v0?"many":"other"}},messages:{"About":"O nas","Home":"Domu"}};
\ No newline at end of file
{
"About": "O nas",
"Home": "Domu"
}
\ No newline at end of file
/* eslint-disable */module.exports={languageData:{"plurals":function(n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return n10==1&&n100!=11?"one":n10==2&&n100!=12?"two":n10==3&&n100!=13?"few":"other";return n==1&&v0?"one":"other"}},messages:{"About":"About","Home":"Home"}};
\ No newline at end of file
{
"About": "About",
"Home": "Home"
}
\ No newline at end of file
// / <reference types="react-scripts" />
declare module "*.svg" {
const content: any;
export default content;
}
declare module "*.png" {
const value: any;
export default value;
}
\ No newline at end of file
import { RouteProps } from "react-router-dom";
import { lazy } from "react";
export interface Route {
path: string;
props: RouteProps;
}
const routes: Route[] = [
{
path: "/",
props: {
component: lazy(() => import("../pages/Home")),
exact: true,
},
},
{
path: "/about",
props: {
component: lazy(() => import("../pages/About")),
exact: true,
},
},
];
export default routes;
...@@ -11,26 +11,17 @@ ...@@ -11,26 +11,17 @@
// opt-in, read https://bit.ly/CRA-PWA // opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean( const isLocalhost = Boolean(
window.location.hostname === "localhost" || window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address. // [::1] is the IPv6 localhost address.
window.location.hostname === "[::1]" || window.location.hostname === '[::1]' ||
// 127.0.0.0/8 are considered localhost for IPv4. // 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match( window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
) )
); );
type Config = { export function register(config) {
onSuccess?: (registration: ServiceWorkerRegistration) => void; if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
export function register(config?: Config): void {
if (
process.env.NODE_ENV === "production" &&
"serviceWorker" in navigator &&
process.env.PUBLIC_URL
) {
// The URL constructor is available in all browsers that support SW. // The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
if (publicUrl.origin !== window.location.origin) { if (publicUrl.origin !== window.location.origin) {
...@@ -40,7 +31,7 @@ export function register(config?: Config): void { ...@@ -40,7 +31,7 @@ export function register(config?: Config): void {
return; return;
} }
window.addEventListener("load", () => { window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) { if (isLocalhost) {
...@@ -51,8 +42,8 @@ export function register(config?: Config): void { ...@@ -51,8 +42,8 @@ export function register(config?: Config): void {
// service worker/PWA documentation. // service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => { navigator.serviceWorker.ready.then(() => {
console.log( console.log(
"This web app is being served cache-first by a service " + 'This web app is being served cache-first by a service ' +
"worker. To learn more, visit https://bit.ly/CRA-PWA" 'worker. To learn more, visit https://bit.ly/CRA-PWA'
); );
}); });
} else { } else {
...@@ -63,24 +54,24 @@ export function register(config?: Config): void { ...@@ -63,24 +54,24 @@ export function register(config?: Config): void {
} }
} }
function registerValidSW(swUrl: string, config?: Config): void { function registerValidSW(swUrl, config) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl)
.then((registration) => { .then(registration => {
registration.onupdatefound = (): void => { registration.onupdatefound = () => {
const installingWorker = registration.installing; const installingWorker = registration.installing;
if (installingWorker == null) { if (installingWorker == null) {
return; return;
} }
installingWorker.onstatechange = (): void => { installingWorker.onstatechange = () => {
if (installingWorker.state === "installed") { if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) { if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched, // At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older // but the previous service worker will still serve the older
// content until all client tabs are closed. // content until all client tabs are closed.
console.log( console.log(
"New content is available and will be used when all " + 'New content is available and will be used when all ' +
"tabs for this page are closed. See https://bit.ly/CRA-PWA." 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
); );
// Execute callback // Execute callback
...@@ -91,7 +82,7 @@ function registerValidSW(swUrl: string, config?: Config): void { ...@@ -91,7 +82,7 @@ function registerValidSW(swUrl: string, config?: Config): void {
// At this point, everything has been precached. // At this point, everything has been precached.
// It's the perfect time to display a // It's the perfect time to display a
// "Content is cached for offline use." message. // "Content is cached for offline use." message.
console.log("Content is cached for offline use."); console.log('Content is cached for offline use.');
// Execute callback // Execute callback
if (config && config.onSuccess) { if (config && config.onSuccess) {
...@@ -102,25 +93,25 @@ function registerValidSW(swUrl: string, config?: Config): void { ...@@ -102,25 +93,25 @@ function registerValidSW(swUrl: string, config?: Config): void {
}; };
}; };
}) })
.catch((error) => { .catch(error => {
console.error("Error during service worker registration:", error); console.error('Error during service worker registration:', error);
}); });
} }
function checkValidServiceWorker(swUrl: string, config?: Config): void { function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page. // Check if the service worker can be found. If it can't reload the page.
fetch(swUrl, { fetch(swUrl, {
headers: { "Service-Worker": "script" }, headers: { 'Service-Worker': 'script' },
}) })
.then((response) => { .then(response => {
// Ensure service worker exists, and that we really are getting a JS file. // Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get("content-type"); const contentType = response.headers.get('content-type');
if ( if (
response.status === 404 || response.status === 404 ||
(contentType != null && contentType.indexOf("javascript") === -1) (contentType != null && contentType.indexOf('javascript') === -1)
) { ) {
// No service worker found. Probably a different app. Reload the page. // No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then((registration) => { navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => { registration.unregister().then(() => {
window.location.reload(); window.location.reload();
}); });
...@@ -132,18 +123,18 @@ function checkValidServiceWorker(swUrl: string, config?: Config): void { ...@@ -132,18 +123,18 @@ function checkValidServiceWorker(swUrl: string, config?: Config): void {
}) })
.catch(() => { .catch(() => {
console.log( console.log(
"No internet connection found. App is running in offline mode." 'No internet connection found. App is running in offline mode.'
); );
}); });
} }
export function unregister(): void { export function unregister() {
if ("serviceWorker" in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready navigator.serviceWorker.ready
.then((registration) => { .then(registration => {
registration.unregister(); registration.unregister();
}) })
.catch((error) => { .catch(error => {
console.error(error.message); console.error(error.message);
}); });
} }
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
// allows you to do things like: // allows you to do things like:
// expect(element).toHaveTextContent(/react/i) // expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom // learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom/extend-expect"; import '@testing-library/jest-dom/extend-expect';
import { combineReducers } from "redux";
import * as general from "./general/reducers";
export interface CombinedState {
general: general.State;
}
export const initialState: CombinedState = {
general: general.initialState,
};
export const reducer = combineReducers<CombinedState>({
general: general.generalReducer,
});
import { reducer } from "ts-action";
import {
AppLanguages,
DEFAULT_LANGUAGE,
} from "../../helpers/constants/languages";
export interface State {
language: AppLanguages;
}
export const initialState: State = {
language: DEFAULT_LANGUAGE,
};
export const generalReducer = reducer<State>(initialState);
import { AppLanguages } from "../../helpers/constants/languages";
import { CombinedState } from "../combinedReducers";
export const getSelectedLanguage = (state: CombinedState): AppLanguages =>
state.general.language;
import { applyMiddleware, createStore } from "redux";
import logger from "redux-logger";
import thunk from "redux-thunk";
import { reducer } from "./combinedReducers";
const store = createStore(reducer, applyMiddleware(logger, thunk));
export default store;
.side-bar {
height: 100% !important;
display: flex;
flex-direction: column;
border-right: 1px solid;
border-radius: 0;
border-color: rgba(64, 194, 133, 0.693);
background-color: rgb(255, 255, 255);
transition: 0.8s ease;
}
.toggle-menu {
height: 50px;
border-top-right-radius: 10rem;
border-bottom-right-radius: 9rem;
width: 10px;
position: absolute;
outline: none;
z-index: 1;
background-color: rgba(64, 194, 133, 0.693);
border-color: rgba(64, 194, 133, 0.693);
border-left: 0;
}
\ No newline at end of file
https://create-react-app.dev/docs/running-tests/
\ No newline at end of file
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": [
"src"
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment