-
Notifications
You must be signed in to change notification settings - Fork 1
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
DEAD-4-NEW #5
Open
AlexNov03
wants to merge
12
commits into
DEAD-3
Choose a base branch
from
DEAD-4-NEW
base: DEAD-3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
DEAD-4-NEW #5
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8b57c72
authorisation feet: create authorisation form with handlebars
AlexNov03 d162e25
Add hide/view password feature
sonyion 5cef15f
authorisation feet: implement forms component
AlexNov03 409b3a5
app feet: implement SPA application
AlexNov03 3740cb3
app feet: implement interaction with the backend
AlexNov03 10b4c6c
feed ref: change handlebars titles
AlexNov03 4f26869
feed fix: added ajax to cards
AlexNov03 b7ef743
feed feet: add cards from backend
AlexNov03 1c027fb
feed fix: fix urls and button text
AlexNov03 486720a
feed fix: change button name
AlexNov03 f07f83a
feed fix: change routes to api
AlexNov03 bf93633
feed fix: added email to header
AlexNov03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ public/images | |
*precompiled.js | ||
|
||
|
||
public/closedEye.png | ||
public/openedEye.png |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const HTTP_METHOD_POST = 'POST'; | ||
const HTTP_METHOD_GET = 'GET'; | ||
|
||
export default async function Ajax({ method, url, body = null }) { | ||
const requestBody = { | ||
credentials: 'include', | ||
method, | ||
header: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}; | ||
|
||
if (method === HTTP_METHOD_POST) { | ||
requestBody.body = JSON.stringify(body); | ||
} | ||
|
||
const response = await fetch(url, requestBody); | ||
|
||
let respBody; | ||
try { | ||
respBody = await response.json(); | ||
} catch { | ||
return { | ||
status: response.status, | ||
error: 'failed to parse respBody', | ||
body: 'failed to parse respBody', | ||
}; | ||
} | ||
// console.log('respBody', respBody); | ||
|
||
if (response.status >= 400) { | ||
return { | ||
status: response.status, | ||
error: respBody, | ||
}; | ||
} | ||
return { | ||
status: response.status, | ||
body: respBody, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{{#each items}} | ||
<div class='card'> | ||
{{#if imageUrl}} | ||
{{#if media-url}} | ||
<div class="card-img"> | ||
<img src="{{imageUrl}}"> | ||
<img src="{{media-url}}"> | ||
</div> | ||
{{/if}} | ||
<div class='card-content'> | ||
<p class='card-content__header'>{{title}}</p> | ||
<p class='card-content__text'>{{description}}</p> | ||
<p class='card-content__text'>{{body}}</p> | ||
</div> | ||
</div> | ||
{{/each}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
import Ajax from '../../ajax.js'; | ||
|
||
export default class Cards { | ||
constructor(parent, items) { | ||
this.parent = parent; | ||
this.items = items; | ||
this.items = {}; | ||
} | ||
|
||
render() { | ||
async render() { | ||
const template = Handlebars.templates['cards.hbs']; | ||
await this.getCurrentCards2(); | ||
this.parent.innerHTML = template({ items: this.items }); | ||
} | ||
|
||
async getCurrentCards2() { | ||
const response = await Ajax({ | ||
url: 'http://dead-vc.ru/api/v1/feed', | ||
method: 'GET', | ||
}); | ||
|
||
switch (response.status) { | ||
case 200: | ||
this.items = response.body.data; | ||
console.log(this.items); | ||
break; | ||
default: | ||
console.error('Error', response.status, response.error); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
@import '/public/variables.css'; | ||
|
||
.auth-form { | ||
margin-top: 50px; | ||
width: 100%; | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--space-s); | ||
padding: var(--space-m); | ||
background-color: var(--main-color); | ||
border-radius: var(--border-radius-m); | ||
} | ||
|
||
.auth-form-links { | ||
display: flex; | ||
justify-content: center; | ||
gap: var(--space-xs); | ||
} | ||
|
||
.active-href { | ||
color: var(--hover-color); | ||
text-decoration: underline; | ||
} | ||
|
||
.disabled-href { | ||
color: var(--hover-color); | ||
text-decoration: none; | ||
} | ||
|
||
.auth-form-header { | ||
text-align: center; | ||
font-size: 24px; | ||
font-weight: 600; | ||
color: var(--accent-color); | ||
} | ||
|
||
.auth-form-header p { | ||
color: var(--accent-color); | ||
} | ||
|
||
.auth-form-inputs { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--space-xs); | ||
} | ||
|
||
.auth-form-inputs input { | ||
padding: 10px; | ||
border-radius: 5px; | ||
font-size: var(--text-size-xs); | ||
} | ||
|
||
.input-correct { | ||
border: 1.5px solid var(--secondary-text-color); | ||
} | ||
|
||
.input-error { | ||
border: 1.5px solid var(--error-color); | ||
} | ||
|
||
.label-hint { | ||
font-size: var(--text-size-xs); | ||
color: var(--text-color); | ||
} | ||
|
||
.label-error { | ||
font-size: var(--text-size-xs); | ||
color: var(--error-color); | ||
} | ||
|
||
.auth-form-inputs button { | ||
padding: 10px; | ||
border-radius: 5px; | ||
color: var(--main-color); | ||
border: 0 none; | ||
background-color: var(--accent-color); | ||
} | ||
|
||
.password-rules { | ||
line-height: var(--line-height-s); | ||
font-size: var(--text-size-xs); | ||
color: var(--secondary-text-color); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<div class="auth-form"> | ||
<div class="auth-form-header"> | ||
DEAD-VC | ||
</div> | ||
<div class="auth-form-links"> | ||
{{#if context.isReg}} | ||
<a class="disabled-href" data-section="auth" id="authhref" href="auth.html"> | ||
Войти | ||
</a> | ||
<a class="active-href" data-section="reg" id="reghref" href="reg.html"> | ||
Регистрация | ||
</a> | ||
{{else}} | ||
<a class="active-href" data-section="auth" id="authhref" href="auth.html"> | ||
Войти | ||
</a> | ||
<a class="disabled-href" data-section="reg" id="reghref" href="reg.html"> | ||
Регистрация | ||
</a> | ||
{{/if}} | ||
</div> | ||
<form class="auth-form-inputs" action="" method="post"> | ||
<label class="label-hint" for="email-input">Email</label> | ||
{{#if context.isEmailCorrect}} | ||
<input class="input-correct" id="email-input" type="email" placeholder="Введите Email"> | ||
{{else}} | ||
<input class="input-error" id="email-input" type="email" placeholder="Введите Email"> | ||
<label class="label-error" for="email-input">Ошибочный Email</label> | ||
{{/if}} | ||
|
||
<label class="label-hint" for="password-input">Пароль</label> | ||
{{#if context.isPasswordCorrect}} | ||
<input class="input-correct" id="password-input" type="password" placeholder="Введите пароль"> | ||
{{else}} | ||
<input class="input-error" id="password-input" type="password" placeholder="Введите пароль"> | ||
<label class="label-error" for="password-input">Ошибочный пароль</label> | ||
{{/if}} | ||
|
||
{{#if context.isReg}} | ||
<label class="label-hint" for="password-input-repeat">Подтверждение пароля</label> | ||
{{#if context.isPasswordRepeatCorrect}} | ||
<input class="input-correct" id="password-input-repeat" type="password" placeholder="Повторите пароль"> | ||
{{else}} | ||
<input class="input-error" id="password-input-repeat" type="password" placeholder="Повторите пароль"> | ||
<label class="label-error" for="password-input-repeat">Пароли не совпадают</label> | ||
{{/if}} | ||
{{/if}} | ||
{{#if context.isReg}} | ||
<button type="submit">Создать аккаунт</button> | ||
{{else}} | ||
<button type="submit">Войти</button> | ||
{{/if}} | ||
</form> | ||
<div class="password-rules"> | ||
{{#unless context.isPasswordCorrect}} | ||
Пароль должен быть длиной от 6 до 255 символов и содержать только: | ||
<ul> | ||
<li> | ||
строчные и прописные латинские буквы | ||
</li> | ||
<li> | ||
цифры (0-9) | ||
</li> | ||
<li> | ||
специальные символы ?,!,_,-,$ | ||
</li> | ||
</ul> | ||
{{/unless}} | ||
{{#if context.isApiError}} | ||
{{context.apiErrorText}} | ||
{{/if}} | ||
</div> | ||
</div> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n, настрой преттиер, он автоматически добавляет