Skip to content

Commit

Permalink
feat(app-config): add routing configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rams23 committed Dec 26, 2020
1 parent 5a20813 commit 8a0de1a
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 82 deletions.
3 changes: 1 addition & 2 deletions packages/game-app/cypress/integration/test.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jest/valid-expect-in-promise */
/// <reference types="cypress" />

context("Index page", () => {
Expand All @@ -7,6 +6,6 @@ context("Index page", () => {
});

it("should contain the title", () => {
cy.containsTranslation("home.title");
cy.contains("Signup");
});
});
129 changes: 122 additions & 7 deletions packages/game-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/game-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"redux-saga": "^1.1.3",
"web-vitals": "^0.2.4"
},
Expand Down Expand Up @@ -54,6 +55,7 @@
"@types/react": "^16.14.2",
"@types/react-dom": "^16.9.10",
"@types/react-redux": "^7.1.14",
"@types/react-router-dom": "^5.1.6",
"@types/redux-saga": "^0.10.5",
"cypress": "^6.2.0",
"env-cmd": "^10.1.0",
Expand Down
38 changes: 0 additions & 38 deletions packages/game-app/src/App.css

This file was deleted.

9 changes: 0 additions & 9 deletions packages/game-app/src/App.test.tsx

This file was deleted.

32 changes: 10 additions & 22 deletions packages/game-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import { useTranslate } from '@pipeline/i18n';
import {Redirect, Route, Switch} from 'react-router-dom';
import {RoutingPath} from "@pipeline/routing";

function App() {

const t = useTranslate();


return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
{t("home.title")}
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
<Switch>
<Route path={RoutingPath.Login} render={() => <div>Login</div>}/>
<Route path={RoutingPath.Signup} render={() => <div>Signup</div>}/>
<Route path={RoutingPath.Dashboard} render={() => <div>Dashboard</div>}/>
<Route path="*">
<Redirect to={RoutingPath.Signup}/>
</Route>
</Switch>
);
}

Expand Down
5 changes: 5 additions & 0 deletions packages/game-app/src/_shared/routing/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { RoutingPath } from "./routingPath";

export {
RoutingPath
}
5 changes: 5 additions & 0 deletions packages/game-app/src/_shared/routing/routingPath.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export enum RoutingPath {
Login = '/login',
Signup = '/signup',
Dashboard = '/dashboard',
}
8 changes: 6 additions & 2 deletions packages/game-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ import reportWebVitals from './reportWebVitals';

import {bootstrap} from "./_shared";
import {Provider} from "react-redux";

import {
BrowserRouter as Router
} from "react-router-dom";
const store = bootstrap();

ReactDOM.render(
<React.StrictMode>
<Provider store={store}>
<App/>
<Router>
<App/>
</Router>
</Provider>
</React.StrictMode>,
document.getElementById('root')
Expand Down
1 change: 0 additions & 1 deletion packages/game-app/src/logo.svg

This file was deleted.

3 changes: 2 additions & 1 deletion packages/game-app/tsconfig.paths.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"paths": {
"@assets/*": ["src/assets/*"],
"@pipeline/app-config": ["src/_shared/config"],
"@pipeline/i18n": ["src/_shared/i18n"]
"@pipeline/i18n": ["src/_shared/i18n"],
"@pipeline/routing": ["src/_shared/routing"]
}
}
}

0 comments on commit 8a0de1a

Please sign in to comment.