Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
334c3b8
feat: add weather block
Vadim-Bykov Jan 18, 2021
e60a954
feat: update weather data
Vadim-Bykov Jan 18, 2021
87a429e
feat: create class ToDo
Vadim-Bykov Jan 19, 2021
8468b4a
feat: add content into active and completed blocks
Vadim-Bykov Jan 20, 2021
a776967
feat: replace started and completed items
Vadim-Bykov Jan 20, 2021
8773df4
feat: add keypress and blur listeners
Vadim-Bykov Jan 21, 2021
96a8c2f
refactor: update styles
Vadim-Bykov Jan 22, 2021
76160b1
Merge pull request #8 from natein/additional-blocks
Vadim-Bykov Jan 22, 2021
a29a74f
Merge branch 'develop' into masonry-&-fix-layout
natein Jan 23, 2021
5c2ed49
Merge pull request #10 from natein/masonry-&-fix-layout
natein Jan 23, 2021
8f52404
feat: add danger button into block menu
Vadim-Bykov Jan 25, 2021
a739328
feat: add items into main menu
Vadim-Bykov Jan 25, 2021
54179a8
feat: add the ability to remove and add blocks
Vadim-Bykov Jan 26, 2021
3396a9a
feat: add background nature noise and music
natein Jan 28, 2021
98958ea
Merge pull request #12 from natein/sound-files
natein Jan 28, 2021
92d79b2
Merge pull request #11 from natein/additional-menu
Vadim-Bykov Jan 30, 2021
3445e27
feat: add calculator, update finance and todo styles
Vadim-Bykov Jan 30, 2021
4037ecf
feat: add calculator into command-men
Vadim-Bykov Jan 30, 2021
88879a0
feat: add options-menu
Vadim-Bykov Jan 30, 2021
bca65e9
feat: add audio elements for backgrond sound
Vadim-Bykov Jan 30, 2021
d53e823
feat: add function to show favicon
Vadim-Bykov Jan 30, 2021
dd204d0
feat: services for backend
natein Jan 31, 2021
541adfa
feat: add backend path
natein Jan 31, 2021
da22ade
Merge pull request #13 from natein/services
natein Jan 31, 2021
62d124a
feat: add options into options-menu
Vadim-Bykov Jan 31, 2021
fec3a16
Merge branch 'develop' into calculator
Vadim-Bykov Jan 31, 2021
27d2df9
Merge pull request #14 from natein/calculator
Vadim-Bykov Jan 31, 2021
b8f1716
refeactor: adaptive content
Vadim-Bykov Feb 3, 2021
0a900fb
Merge pull request #15 from natein/adaptiv
Vadim-Bykov Feb 3, 2021
d54a5d5
feat: add color
natein Feb 3, 2021
c8a01f7
feat: add two forms and validation
natein Feb 3, 2021
6a40f7b
feat: add token variable
natein Feb 3, 2021
6f9b663
feat: add token check
natein Feb 3, 2021
763a4ae
Merge pull request #16 from natein/Registration-&-Login-form
natein Feb 3, 2021
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
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ module.exports = {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-param-reassign": [2, { "props": false }]
}
};

3 changes: 3 additions & 0 deletions debug.log
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
[0112/191140.288:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[0113/181410.359:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[0114/181756.347:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[0118/180712.859:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[0121/174104.700:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[0125/183609.977:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
5 changes: 5 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"dependencies": {
"chart.js": "^2.9.3",
"core-js": "^3.4.7",
"openweather-apis": "^4.4.1",
"regenerator-runtime": "^0.13.3"
}
}
Binary file added src/assets/audio/ambient.mp3
Binary file not shown.
Binary file added src/assets/audio/birds-waves.mp3
Binary file not shown.
Binary file added src/assets/audio/birds.mp3
Binary file not shown.
Binary file added src/assets/audio/cafe.mp3
Binary file not shown.
Binary file added src/assets/audio/thunder.mp3
Binary file not shown.
Binary file added src/assets/audio/waves.mp3
Binary file not shown.
Binary file added src/assets/fonts/fonts-calculator/Crystal.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/assets/fonts/fonts-calculator/symbol.ttf
Binary file not shown.
Binary file added src/assets/fonts/fonts-weather/owfont-regular.eot
Binary file not shown.
Binary file added src/assets/fonts/fonts-weather/owfont-regular.otf
Binary file not shown.
394 changes: 394 additions & 0 deletions src/assets/fonts/fonts-weather/owfont-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/fonts/fonts-weather/owfont-regular.ttf
Binary file not shown.
Binary file not shown.
Binary file added src/assets/img/metal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img/weather.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
--accent-color-contrast: #120C0E;
--error-color: #f00;
--text-color: #000;
--input-outline-color: #ccc;
--app-background-color: #fff;
--header-footer-text-color: #FDF6A1;
}
Expand Down
3 changes: 2 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="./assets/icons/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="icons/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>Start Page</title>
</head>

Expand Down
105 changes: 105 additions & 0 deletions src/js/components/auth/auth.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
.modal-shadow {
position: fixed;
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: rgba(0, 0, 0, 0.5);
top: 0;
}

.modal {
width: 300px;
padding: 10px 0;
background-color: var(--modal-background-color);
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 9px;
}

.auth {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
border-radius: 10px;
width: 300px;
background-color: var(--accent-color-contrast);
}

.auth-header {
margin-top: 15px;
font-size: 33px;
line-height: 33px;
color: var(--header-footer-text-color);
}

.auth-description {
margin: 10px 10px 20px 10px;
font-size: 16px;
color: var(--header-footer-text-color);
}

.auth-form {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 100%;
}

.auth-inputs {
display: flex;
flex-direction: column;
align-items: center;
padding: 10px;
background-color: var(--header-footer-text-color);
width: 100%;
}

.auth-form-input {
max-width: 260px;
width: calc(100% - 20px);
font-size: 16px;
padding: 12px;
margin: 10px;
border: 1px solid var(--input-outline-color);
border-radius: 5px;
}

.auth-form-error {
max-width: 260px;
color: var(--error-color);
margin-bottom: 20px;
}

.auth-button {
font-weight: bold;
margin: 10px;
padding: 10px 20px;
font-size: 18px;
background-color: var(--header-footer-text-color);
border: none;
border-radius: 5px;
cursor: pointer;
}

.button-register {
background-color: transparent;
color: var(--header-footer-text-color);
}

.auth-button:focus {
outline:none;
box-shadow: none;
}

.button-log-in:hover {
background-color: var(--app-background-color);
}

.button-register:hover {
color: var(--app-background-color);
}
176 changes: 176 additions & 0 deletions src/js/components/auth/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
import './auth.css';
import * as Constants from '../../data/constants';
import create from '../../utils/create';
import { validatePassword, validateEmail } from './validation';
import * as RemoteAuth from '../../services/auth';

export class Auth {
constructor(register) {
this.isLogin = register;
this.modelContainer = create('div', 'modal-shadow');
this.modal = create('div', 'auth');
this.modelContainer.appendChild(this.modal);
this.modelContainer.addEventListener('click', this.clickShadow.bind(this));
document.body.appendChild(this.modelContainer);
this.render();
this.addListeners();
}

render() {
const formCaption = (this.isLogin) ? 'Login' : 'Register';
const emailInput = (this.isLogin) ? '' : `;
<input
id="auth-email"
class="auth-form-input"
name="login"
type="email"
placeholder="youremail@domain.com"
required
/>`;
const buttonLogin = (this.isLogin) ? 'Login' : 'Register';
const buttonRegister = (this.isLogin) ? 'Register' : 'Login';
const template = `
<h1 class="auth-header">${formCaption}</h1>
<span class="auth-description">Insert your e-mail and password.</span>
<form class="auth-form" method="post">
<div class="auth-inputs">
<input
id="auth-username"
class="auth-form-input"
name="username"
type="text"
placeholder="Username"
required
/>
${emailInput}
<input
id="auth-password"
class="auth-form-input"
name="password"
type="password"
placeholder="**************"
autocomplete ="off"
required
/>
<span class="auth-form-error"></span>
</div>
<div class="auth-buttons">
<button
class="auth-button button-register"
type="button"
>
${buttonRegister}
</button>
<button class="auth-button button-log-in"
type="submit">${buttonLogin}</button>
</div>
</form>
`;
this.modal.innerHTML = template;
}

addListeners() {
this.regBtn = document.querySelector('.button-register');
this.loginBtn = document.querySelector('.button-log-in');
if (this.isLogin) {
this.regBtn.addEventListener('click', this.switchForm.bind(this));
this.loginBtn.addEventListener('click', this.login.bind(this));
} else {
this.regBtn.addEventListener('click', this.switchForm.bind(this));
this.loginBtn.addEventListener('click', this.register.bind(this));
const password = document.querySelector('#auth-password');
password.addEventListener('change', this.validatePassword.bind(this));
const email = document.querySelector('#auth-email');
email.addEventListener('change', this.validateEmail.bind(this));
}
}

register(evt) {
evt.preventDefault();
const username = document.querySelector('#auth-username');
const email = document.querySelector('#auth-email');
const password = document.querySelector('#auth-password');
this.registerUser(username.value, email.value, password.value);
}

login(evt) {
evt.preventDefault();
const username = document.querySelector('#auth-username');
const password = document.querySelector('#auth-password');
this.loginUser(username.value, password.value);
}

switchForm() {
this.isLogin = !this.isLogin;
this.modal.innerHTML = '';
this.render();
this.addListeners();
}

validatePassword(evt) {
const mess = document.querySelector('.auth-form-error');
if (!validatePassword(evt.target.value)) {
mess.innerText = 'password must contain digits, uppercase and lovercase letters, special symbols';
} else {
mess.innerText ='';
}
}

validateEmail(evt) {
const mess = document.querySelector('.auth-form-error');
if (!validateEmail(evt.target.value)) {
mess.innerText = 'incorrect email';
} else {
mess.innerText ='';
}
}

clickShadow(evt) {
if(evt.target === this.modelContainer) {
this.closeModal();
}
}

closeModal() {
document.body.removeChild(this.modelContainer);
window.myapp.header.deleteLoginForm();
}

async registerUser(username, email, password) {
try {
const res = await RemoteAuth.registerUser(username, email, password);
if (res.statusCode === 200) {
localStorage.setItem(Constants.userItemLocalStorage, JSON.stringify(res.token));
window.myapp.header.setLogged();
this.closeModal();
}
if (res.statusCode === 400) {
const mess = document.querySelector('.auth-form-error');
mess.innerText = `${res.reason}`;
}
} catch (err) {
const mess = document.querySelector('.auth-form-error');
mess.innerText = `${err.name}: ${err.message}`;
}
}

async loginUser(username, password) {
try {
const res = await RemoteAuth.loginUser(username, password);
if (res.statusCode === 200) {
localStorage.setItem(Constants.userItemLocalStorage, JSON.stringify(res.token));
window.myapp.header.setLogged();
this.closeModal();
}
if (res.statusCode === 403) {
const mess = document.querySelector('.auth-form-error');
mess.innerText = `${res.reason}`;
}
} catch (err) {
const mess = document.querySelector('.auth-form-error');
mess.innerText = `${err.name}: ${err.message}`;
}
}
}

export default Auth;
10 changes: 10 additions & 0 deletions src/js/components/auth/validation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const validatePassword = function validatePassword(password) {
const re = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,15}$/;
return re.test(password);
};

export const validateEmail = function validateEmail(email) {
// eslint-disable-next-line no-useless-escape,max-len
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
};
16 changes: 16 additions & 0 deletions src/js/components/base-menu/baseMenu.css

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

Loading