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

Har 146 add comments #32

Merged
merged 66 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
dd16d02
HAR-126: Поменял стили в регистрации и добавил рабочий глаз
glebkos May 7, 2024
3c38f45
HAR-126: Добавил outline: none для неавтивного поля
glebkos May 7, 2024
ed54aaa
HAR-126: Изменил высоту и рамки для outline
glebkos May 7, 2024
2a11853
HAR-126: Правки в профиле
glebkos May 7, 2024
5d97556
HAR-126: Убрал кнопки из полей авторизации
glebkos May 7, 2024
ea067a5
HAR-126: Минорные правки
glebkos May 7, 2024
3c1afc3
HAR-126: Минорные правки №2
glebkos May 7, 2024
aa668f3
HAR-126: Убрал подписчиков
glebkos May 7, 2024
e6d3ed9
HAR-126: Добавил лайки и поправил роутер
glebkos May 8, 2024
d75475b
HAR-126: Внес правки в доску лайков
glebkos May 8, 2024
51d26d7
HAR-126: Внес исправления в чат
glebkos May 9, 2024
1b25d1b
HAR-126: Линтер
glebkos May 9, 2024
9ba1588
HAR-126: Убрал scroll-bar у ника в чате
glebkos May 10, 2024
8b54469
HAR-126: Вернул подписчиков
glebkos May 11, 2024
57e03f5
HAR-126: Добавил очищение поиска при переходе
glebkos May 12, 2024
84edc92
HAR-126: Добавил закрытие окна с ошибкой
glebkos May 16, 2024
1ee742e
HAR-126: Исправил ошибку с отсутствием редиректа
glebkos May 16, 2024
5c07558
HAR-126: Добавил закрытие модалки по клику вне
glebkos May 16, 2024
46d13d5
HAR-126: Синтаксические ошибки
glebkos May 16, 2024
691a972
HAR-126: Исправил опечатку
glebkos May 16, 2024
9041eac
HAR-134: Минорные изменения
glebkos May 19, 2024
0f118bc
HAR-134: Добавил шаблон модалки
glebkos May 19, 2024
1242955
HAR-134: Поправил удаление доски
glebkos May 19, 2024
c03297e
HAR-134: Сделал емптиспейс для добавления пинов на доску
glebkos May 19, 2024
31c0735
HAR-134: Исправил кнопку создание доски в профиле
glebkos May 20, 2024
159485b
HAR-134: Сделал в пине кликабельным всего пользователя
glebkos May 20, 2024
dc8f1ba
HAR-134: Исправил размер при добавлении пина в мобильной версии
glebkos May 20, 2024
b51e9a2
HAR-134: Добавил api
glebkos May 20, 2024
3008a1f
HAR-134: Добавил api
glebkos May 20, 2024
41ea4ea
HAR-134: Поменял размер описания пина
glebkos May 20, 2024
1855e95
HAR-134: Пофиксил чат
glebkos May 22, 2024
a15e004
HAR-134: Добавил исключение досок на которых есть уже пин
glebkos May 23, 2024
183831e
HAR-134: Выпадающее меню пользователя v1.0
glebkos May 23, 2024
55f2723
HAR-134: Доделанный навбар
glebkos May 23, 2024
68af496
HAR-134: Добавил черновики и поменял список чатов
glebkos May 25, 2024
4aa4c32
HAR-134: Готовые ччерновики
glebkos May 25, 2024
06e783d
HAR-134: Тест WS для черновиков
glebkos May 25, 2024
039b22a
HAR-134: Пробуем другой подход
glebkos May 25, 2024
18c80ea
HAR-134: Минорные правки
glebkos May 25, 2024
d75029d
HAR-134: Переделал список чатов
glebkos May 25, 2024
1375f6d
HAR-134: Очистка поля ввода
glebkos May 25, 2024
bb05064
HAR-134: Вынес логику списка чатов во вне
glebkos May 25, 2024
bb929c2
HAR-134: Исправил чат в мобилке
glebkos May 25, 2024
4bfa387
HAR-134: Сделал меню для мобилки
glebkos May 25, 2024
3530c1f
HAR-134: Изменил создание пина
glebkos May 25, 2024
1dae274
HAR-134: Минорные правки
glebkos May 25, 2024
cd5d9ea
HAR-134: Починил профиль
glebkos May 25, 2024
a7c99fb
HAR-134: Исправил глазик
glebkos May 25, 2024
ad75b3a
HAR-134: Поменял размеры у пина
glebkos May 25, 2024
24974cb
HAR-134: Удалил package-lock.json
glebkos May 25, 2024
6bc56ca
HAR-134: Merge
glebkos May 25, 2024
643e836
HAR-138: Значки для пина
glebkos May 25, 2024
b38f3de
HAR-138: Сделал окно для отправки пина пользователям
glebkos May 26, 2024
b45163a
HAR-138: Исправил баг с прокруткой
glebkos May 26, 2024
4a305be
HAR-138: Сделал отправку сообщений
glebkos May 26, 2024
3c6e733
HAR-138: Сделал шеринг
glebkos May 26, 2024
27dcc9d
HAR-138: Изменил размеры превью пина
glebkos May 26, 2024
16daffe
HAR-138: Убрал отступ у window
glebkos May 26, 2024
fbf1767
HAR-138: Минорные изменения и окно уведомлений
glebkos May 26, 2024
46d8f03
HAR-138: Сделал окно и запрос за уведомлениями
glebkos May 26, 2024
5459bd0
HAR-138: Линтер
glebkos May 26, 2024
98d87ba
HAR-146: Сделанные комменты
glebkos May 26, 2024
f0741b6
HAR-146: Комменты финал
glebkos May 26, 2024
7c9fc1e
HAR-146: Поправил размеры комментов
glebkos May 26, 2024
12208e1
HAR-146: Правка API + linter
glebkos May 26, 2024
d3a4fd0
HAR-146: Изменение порядка
glebkos May 26, 2024
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
13,530 changes: 0 additions & 13,530 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="icon" href="/static/icon.png">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<body id="body">
<header id="navbar"></header>
<main id="root" class="root"></main>
<div id="error-block"></div>
Expand Down
3 changes: 2 additions & 1 deletion source/app/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class Router {
async go(path) {
path = this.slashDel(path);
const url = decodeURI(this.root + path);
window.history.pushState(null, null, url);
const args = [];
const reqRoute = this.routes.find((route) => {
route = route.path;
Expand Down Expand Up @@ -101,6 +100,8 @@ export class Router {
this.currentPage = errorView;
errorView.render();
}
const ev = new Event('pageMovement');
dispatchEvent(ev);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion source/entity/avatar/ui/avatar.handlebars
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<img src="{{avatarUrl}}" alt="" class="avatar_size avatar_object_fit avatar_border-radius">
<img src="{{avatarUrl}}" alt="" class="avatar_size avatar_object_fit avatar_border-radius avatar_display-block">
5 changes: 5 additions & 0 deletions source/entity/avatar/ui/avatar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@
.avatar_size{
width: 100%;
height: 100%;
user-select: none;
}

.avatar_display-block{
display: block;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {BoardListView} from './ui/boardList.js';
export {BoardListView};
import {BoardListView} from './ui/boardList.js';

export {BoardListView};
11 changes: 11 additions & 0 deletions source/entity/boardList/ui/boardList.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{#if boardsNotEmpty}}
{{#each boards}}
<div class="board-item" id="board-{{this.board_id}}">
<div class="title">{{this.title}}</div>
</div>
{{/each}}
{{else}}
<div class="board-list-message">
<span class="board-list__title description">Нет доступных досок</span>
</div>
{{/if}}
26 changes: 26 additions & 0 deletions source/entity/boardList/ui/boardList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import boardListTemplate from './boardList.handlebars';
import './boardList.scss';
import {View} from '../../../app/View.js';

/** Board list window view */
export class BoardListView extends View {
/**
* Default view constructor.
* @constructor
* @param {string} elemID - element ID
* @param {...any} args - args for constructor of view.
*/
constructor(elemID, ...args) {
super(...args);
this.root = document.querySelector('#' + elemID);
}

/**
* Renders view by pin and boards.
* @param {object} boards - Boards entity.
* @param {object} pin - Pin entity.
*/
render(boards) {
this.root.innerHTML = boardListTemplate({boards, boardsNotEmpty: boards?.length > 0});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
.board-item:hover{
cursor: pointer;
}

.board-list-message{
display: flex;
justify-content: center;
}
2 changes: 1 addition & 1 deletion source/entity/boardPin/ui/boardPin.handlebars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="feed-item_100-size">
<img src="{{ pin.content_url }}" alt="" class="pin" id="pin-{{ pin.pin_id }}">
<img src="{{ pin.content_url }}" alt="" class="pin" id="pin-{{pin.pin_id}}">
{{#if owner}}
<button class="button primary-button board-pin__button" id="pin-del-{{pin.pin_id}}">Удалить</button>
{{/if}}
Expand Down
22 changes: 12 additions & 10 deletions source/entity/boardPin/ui/boardPin.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ export class BoardPinFeedView extends View {
this.onClick(pin.pin_id);
});

const delBtn = document.querySelector('#pin-del-' + pin.pin_id);
delBtn.addEventListener('click', async (event) => {
event.preventDefault();
const api = new API('/boards/' + board.board_id + '/pins/' + pin.pin_id);
const response = await api.delete();
if (response.code) {
return;
}
this.root.remove();
});
if (board.is_owner) {
const delBtn = document.querySelector('#pin-del-' + pin.pin_id);
delBtn.addEventListener('click', async (event) => {
event.preventDefault();
const api = new API('/boards/' + board.board_id + '/pins/' + pin.pin_id);
const response = await api.delete();
if (response.code) {
return;
}
this.root.remove();
});
}
}
}
8 changes: 8 additions & 0 deletions source/entity/chatListItem/ui/chatListItem.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="chat-list-item" id="chat-list-item-{{chat.user.user_id}}">
<div class="avatar chat-list-avatar" id="chat-list-avatar">

</div>
<div class="chat-list-item-title description">
{{chat.user.nickname}}
</div>
</div>
34 changes: 34 additions & 0 deletions source/entity/chatListItem/ui/chatListItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import chatListTemplate from './chatListItem.handlebars';
import './chatListItem.scss';
import {View} from '../../../app/View.js';
import {Avatar} from '../../avatar/ui/avatar.js';
import {API} from '../../../shared/api/API.js';
import {ErrorWindowView} from '../../errorWindow/ui/errorWindow.js';
import {errors} from '../../../shared/config.js';

export class ChatListItemView extends View {
constructor(root, ...args) {
super(...args);
this.root = root;
}

render(chat, url) {
this.root.innerHTML = chatListTemplate({chat});
const chatListItem = document.querySelector('#chat-list-item-' + chat.user.user_id);
chatListItem.addEventListener('click', async (event) => {
event.preventDefault();
const api = new API('/messages/' + chat.user.user_id);
const response = await api.post(JSON.stringify({'text': url}));
if (response.code) {
const error = new ErrorWindowView();
error.render(errors['oops']);
return;
}
const ev = new Event('modalClose');
dispatchEvent(ev);
});

const avatar = new Avatar('chat-list-avatar', this.root);
avatar.render(chat.user.avatar_url);
}
}
15 changes: 15 additions & 0 deletions source/entity/chatListItem/ui/chatListItem.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.chat-list-item{
display: grid;
grid-template-columns: 50px 1fr;
gap: 10px;
align-items: center;
text-align: start;
width: 300px;
min-width: 100px;
}

@media screen and (max-width: 1024px) {
.chat-list-item {
width: 50vw;
}
}
9 changes: 9 additions & 0 deletions source/entity/comment/ui/comment.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="comment-avatar" id="comment-avatar">

</div>
<div class="comment-nickname annotation">
{{comment.user.nickname}}
</div>
<div class="comment-content annotation">
{{comment.value}}
</div>
23 changes: 23 additions & 0 deletions source/entity/comment/ui/comment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import commentView from './comment.handlebars';
import './comment.scss';
import {View} from '../../../app/View.js';
import {Avatar} from '../../avatar/ui/avatar.js';

export class CommentView extends View {
constructor(rootID, ...args) {
super(...args);
this.root = document.querySelector(`#${rootID}`);
}

render(comment, addNew = false) {
const commentElem = document.createElement('div');
commentElem.classList.add('comment-block');
commentElem.innerHTML = commentView({comment});

const avatar = new Avatar('comment-avatar', commentElem);
avatar.render(comment.user.avatar_url);

const pos = addNew ? 'afterbegin' : 'beforeend';
this.root.insertAdjacentElement(pos, commentElem);
}
}
31 changes: 31 additions & 0 deletions source/entity/comment/ui/comment.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@use '../../../shared/styles/variables';

.comment-avatar{
grid-row: 1 / 2;
grid-column: 1 / 2;
width: 30px;
height: 30px;
}

.comment-nickname{
grid-row: 1 / 2;
grid-column: 2 / 3;
}

.comment-content{
grid-row: 2 / 3;
grid-column: 1 / 3;
padding-left: 5px;
}

.comment-block{
width: calc(100% - 10px);
height: fit-content;
display: grid;
grid-template-columns: 30px 1fr;
grid-template-rows: 30px 1fr;
gap: 10px;
border-top: variables.$border-color 1px solid;
align-items: center;
padding: 10px 5px 0 5px;
}
3 changes: 3 additions & 0 deletions source/entity/errorWindow/ui/errorWindow.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
<div class="error-window__cancel" id="error-cancel">
<img src="/static/plus.svg" alt="" class="cancel-icon">
</div>
<div class="time-line" id="time-line">

</div>
</div>
18 changes: 16 additions & 2 deletions source/entity/errorWindow/ui/errorWindow.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {View} from '../../../app/View.js';
import errorViewTemplate from './errorWindow.handlebars';
import './errorWindow.scss';
import {errors} from '../../../shared/config.js';

/** Error window view */
export class ErrorWindowView extends View {
Expand All @@ -17,15 +18,28 @@ export class ErrorWindowView extends View {

/**
* Renders view by error message.
* @param {message} message - Error message entity.
* @param {string} message - Error message entity.
*/
render(message) {
if (!message) {
message = errors['oops'];
}
this.root.innerHTML = errorViewTemplate({message});

const errorTimeLine = this.root.querySelector('#time-line');

errorTimeLine.classList.add('active');

const time1 = setTimeout(() => {
this.root.innerHTML = null;
errorTimeLine.classList.remove('active');
}, 5000);

const cancelButton = document.querySelector('#error-cancel');
cancelButton.addEventListener('click', (event) => {
event.preventDefault();
this.root.innerHTML = null;
}, {once: true});
clearTimeout(time1);
}, {once: true});
}
}
32 changes: 31 additions & 1 deletion source/entity/errorWindow/ui/errorWindow.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
.error-window {
min-width: 400px;
min-height: 100px;
border: variables.$error-color 3px solid;
border: variables.$error-color 1px solid;
border-radius: variables.$element-border-radius;
background-color: variables.$background-color;
position: fixed;
inset: auto 20px 60px auto;
padding: 20px 35px 20px 20px;
overflow: hidden;
}

.error-window__cancel{
Expand All @@ -30,6 +31,35 @@
white-space: pre-line;
}

.time-line:before {
content: "";
position: absolute;
bottom: 0;
right: 0;
height: 15px;
width: 100%;
background-color: variables.$error-color;
}

.time-line.active:before{
animation: time-line 5s linear forwards;
}

@keyframes time-line {
100% {
right: 100%;
}
}

//.time-line{
// position: absolute;
// inset: auto 0 0 0;
// width: 100%;
// height: 20px;
// border-radius: 0 0 20px 20px;
// justify-content: left;
//}

@media screen and (max-width: 430px) {
.error-window{
min-width: 100px;
Expand Down
5 changes: 3 additions & 2 deletions source/entity/inputField/ui/inputField.handlebars
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<label for="{{field.inputField}}">{{field.label}}</label>
<input type="{{field.type}}" class="input" id="{{field.inputField}}" placeholder="{{field.placeholder}}" value="{{field.value}}">
<input type="{{field.type}}" class="input" id="{{field.inputField}}" placeholder="{{field.placeholder}}" value="{{field.value}}" {{#if field.disabled}}disabled{{/if}}>
{{#if isPassword}}
<div class="eye" id="eye">
<img src="/static/eye.svg" alt="" class="eye-image">
<img src="/static/eye.svg" alt="" class="eye-image" id="eye-open">
<img src="/static/eye_closed.svg" alt="" class="eye-image-close eye__visibility-hidden" id="eye-closed">
</div>
{{/if}}
<div class="input_error" id="{{field.errContent}}"></div>
Expand Down
Loading
Loading