Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login / Registration #24

Merged
merged 3 commits into from
Sep 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 124 additions & 5 deletions package-lock.json

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

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"dependencies": {
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"axios": "^0.21.4",
"eventemitter3": "^4.0.7",
"formik": "^2.2.9",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.3.0",
Expand All @@ -50,6 +52,7 @@
"@types/jest": "^26.0.24",
"@types/react": "^17.0.19",
"@types/react-dom": "^17.0.9",
"@types/react-input-mask": "^3.0.1",
"@types/react-router-dom": "^5.1.8",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
Expand All @@ -74,6 +77,7 @@
"postcss": "^8.3.6",
"postcss-loader": "^6.1.1",
"prettier": "2.3.2",
"react-input-mask": "^2.0.4",
"style-loader": "^3.2.1",
"stylelint": "^13.13.1",
"stylelint-config-prettier": "^8.0.2",
Expand All @@ -84,7 +88,8 @@
"typescript-eslint": "0.0.1-alpha.0",
"webpack": "^5.52.1",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.2.0"
"webpack-dev-server": "^4.2.0",
"yup": "^0.32.9"
},
"browserslist": {
"production": [
Expand Down
Binary file added public/assets/mario-background.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 2 additions & 8 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="#000000" name="theme-color" />
<meta content="Mario game" name="description" />
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<title>Mario Pro Max</title>
</head>
<body>
Expand Down
87 changes: 75 additions & 12 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,91 @@
/*
* Copyright (c) 2021. Written by Leonid Artemev (me@artemev.it)
*/
import { createBrowserHistory } from "history";
import React from "react";
import { createBrowserHistory } from "history";
import { Route, Router, Switch } from "react-router-dom";
import { Login, Registration, Leaderboard, Forum } from "./pages";
import { Login, Registration, Leaderboard, Forum, Profile } from "./pages";
import { createTheme, ThemeProvider } from "@material-ui/core";

import { Game } from "./pages/Game";

declare module "@material-ui/core/styles" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это зачем? Я не придираюсь мне действительно интересно 🤔

interface Theme {
loginPage: {
background: string;
backdropFilter: string;
};
}
// allow configuration using `createTheme`
interface ThemeOptions {
loginPage?: {
background: string;
backdropFilter: string;
};
}
}

const history = createBrowserHistory();
const StubComponent = () => <div>Under construction! 👻</div>;

const darkTheme = createTheme({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я бы вынес это в Theme.ts

typography: {
fontFamily: [
"-apple-system",
"BlinkMacSystemFont",
'"Segoe UI"',
"Roboto",
'"Helvetica Neue"',
"Arial",
"sans-serif",
'"Apple Color Emoji"',
'"Segoe UI Emoji"',
'"Segoe UI Symbol"',
].join(","),
},
loginPage: {
background: "#00000033",
backdropFilter: "blur(10px)",
},
});

const lightTheme = createTheme({
typography: {
fontFamily: [
"-apple-system",
"BlinkMacSystemFont",
'"Segoe UI"',
"Roboto",
'"Helvetica Neue"',
"Arial",
"sans-serif",
'"Apple Color Emoji"',
'"Segoe UI Emoji"',
'"Segoe UI Symbol"',
].join(","),
},
loginPage: {
background: "#FFFFFF88",
backdropFilter: "blur(3px)",
},
});

function App() {
return (
<div className="App">
<Router history={history}>
<Switch>
<Route exact path="/" component={StubComponent} />
<Route exact path="/login" component={Login} />
<Route exact path="/registration" component={Registration} />
<Route exact path="/app" component={Game} />
<Route exact path="/leaderboard" component={Leaderboard} />
<Route exact path="/forum" component={Forum} />
</Switch>
</Router>
<ThemeProvider theme={lightTheme}>
<Router history={history}>
<Switch>
<Route exact path="/" component={StubComponent} />
<Route exact path="/login" component={Login} />
<Route exact path="/registration" component={Registration} />
<Route exact path="/app" component={Game} />
<Route exact path="/leaderboard" component={Leaderboard} />
<Route exact path="/forum" component={Forum} />
<Route exact path="/profile" component={Profile} />
</Switch>
</Router>
</ThemeProvider>
</div>
);
}
Expand Down
5 changes: 5 additions & 0 deletions src/constants/url.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const API_BASE_URL = "https://ya-praktikum.tech/api/v2";
export const SIGNIN_URL = `${API_BASE_URL}/auth/signin`;
export const SIGNUP_URL = `${API_BASE_URL}/auth/signup`;
export const SIGNOUT_URL = `${API_BASE_URL}/auth/logout`;
export const USER_URL = `${API_BASE_URL}/auth/user`;
7 changes: 7 additions & 0 deletions src/constants/validationErrors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const ERROR_MESSAGES = {
required: "Required field",
min: (num: number): string => `Minimum length ${num} symbols`,
max: (num: number): string => `Maximum length ${num} symbols`,
email: "Invalid email format",
password_mismatch: "Passwords do not match",
};
Loading