-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from frontend-park-mail-ru/har-126-add-new-pages
HAR-126: Добавляю страницы чата, поиска и подписок
- Loading branch information
Showing
96 changed files
with
1,791 additions
and
243 deletions.
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
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
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,3 @@ | ||
<button class="button" id="{{id}}"> | ||
{{content}} | ||
</button> |
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,17 @@ | ||
import {View} from '../../../app/View.js'; | ||
import buttonTemplate from './button.handlebars'; | ||
import './button.scss'; | ||
|
||
export class ButtonView extends View { | ||
constructor(rootID, ...args) { | ||
super(...args); | ||
this.root = document.querySelector(`#${rootID}`); | ||
} | ||
|
||
render(content, classes, id) { | ||
this.root.innerHTML = buttonTemplate({content, id}); | ||
|
||
const button = this.root.querySelector(`#${id}`); | ||
button.classList.add(...classes); | ||
} | ||
} |
Empty file.
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
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
8 changes: 4 additions & 4 deletions
8
...eedBoards/ui/profileFeedBoards.handlebars → ...eedBoards/ui/profileFeedBoards.handlebars
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,4 +1,4 @@ | ||
<div class="board__item window" id="board-{{board.board_id}}"> | ||
<div class="board__title title">{{board.title}}</div> | ||
<div class="board__description description">{{board.description}}</div> | ||
</div> | ||
<div class="board__item window" id="board-{{board.board_id}}"> | ||
<div class="board__title title">{{board.title}}</div> | ||
<div class="board__description description">{{board.description}}</div> | ||
</div> |
78 changes: 39 additions & 39 deletions
78
...profileFeedBoards/ui/profileFeedBoards.js → ...profileFeedBoards/ui/profileFeedBoards.js
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,39 +1,39 @@ | ||
import {View} from '../../../app/View.js'; | ||
import profileFeedBoardsTemplate from './profileFeedBoards.handlebars'; | ||
import './profileFeedBoards.scss'; | ||
|
||
/** | ||
* Class to handle view of board card | ||
*/ | ||
export class ProfileFeedBoardsView extends View { | ||
/** | ||
* Initialize variables | ||
* @param {Element} root – element where to render | ||
* @param {Array} args – arguments to pass into parent function | ||
*/ | ||
constructor(root, ...args) { | ||
super(...args); | ||
this.root = root; | ||
} | ||
|
||
/** | ||
* Actions on click | ||
* @param {int} boardID – id of a board | ||
*/ | ||
onClick(boardID) { | ||
window.location.pathname = '/board/' + boardID; | ||
} | ||
|
||
/** | ||
* Function to render board card | ||
* @param {json} board – info about board | ||
*/ | ||
render(board) { | ||
this.root.innerHTML = profileFeedBoardsTemplate({board}); | ||
const eventRoot = document.querySelector('#board-' + board.board_id); | ||
eventRoot.addEventListener('click', (event) => { | ||
event.preventDefault(); | ||
this.onClick(board.board_id); | ||
}); | ||
} | ||
} | ||
import {View} from '../../../app/View.js'; | ||
import profileFeedBoardsTemplate from './profileFeedBoards.handlebars'; | ||
import './profileFeedBoards.scss'; | ||
|
||
/** | ||
* Class to handle view of board card | ||
*/ | ||
export class FeedBoardsView extends View { | ||
/** | ||
* Initialize variables | ||
* @param {Element} root – element where to render | ||
* @param {Array} args – arguments to pass into parent function | ||
*/ | ||
constructor(root, ...args) { | ||
super(...args); | ||
this.root = root; | ||
} | ||
|
||
/** | ||
* Actions on click | ||
* @param {int} boardID – id of a board | ||
*/ | ||
onClick(boardID) { | ||
history.pushState(null, null, '/board/' + boardID); | ||
} | ||
|
||
/** | ||
* Function to render board card | ||
* @param {json} board – info about board | ||
*/ | ||
render(board) { | ||
this.root.innerHTML = profileFeedBoardsTemplate({board}); | ||
const eventRoot = document.querySelector('#board-' + board.board_id); | ||
eventRoot.addEventListener('click', (event) => { | ||
event.preventDefault(); | ||
this.onClick(board.board_id); | ||
}); | ||
} | ||
} |
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,11 @@ | ||
<div class="user-list-item" id="user-{{user.user_id}}"> | ||
<div class="avatar list-item-avatar" id="list-item-avatar"> | ||
|
||
</div> | ||
<div class="list-item-nickname"> | ||
{{user.nickname}} | ||
</div> | ||
<div class="list-item-followers-count"> | ||
подписчиков {{user.subscribers_count}} | ||
</div> | ||
</div> |
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,23 @@ | ||
import {View} from '../../../app/View.js'; | ||
import userListTemplate from './userListItem.handlebars'; | ||
import './userListItem.scss'; | ||
|
||
export class UserListItemView extends View { | ||
constructor(root, ...args) { | ||
super(...args); | ||
this.root = root; | ||
} | ||
|
||
onClick(userNickname) { | ||
history.pushState(null, null, '/profile/' + userNickname); | ||
} | ||
|
||
render(user) { | ||
this.root.innerHTML = userListTemplate({user}); | ||
const eventRoot = document.querySelector('#user-' + user.user_id); | ||
eventRoot.addEventListener('click', (event) => { | ||
event.preventDefault(); | ||
this.onClick(user.nickname); | ||
}); | ||
} | ||
} |
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,28 @@ | ||
.user-list-item{ | ||
width: 300px; | ||
height: 70px; | ||
display: grid; | ||
grid-template: | ||
"a b" 1fr | ||
"a c" 1fr / 70px 1fr; | ||
gap: 5px 10px; | ||
align-items: center; | ||
} | ||
|
||
.list-item-avatar{ | ||
grid-area: a; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.list-item-nickname{ | ||
grid-area: b; | ||
font-size: 18px; | ||
text-align: start; | ||
} | ||
|
||
.list-item-followers-count{ | ||
grid-area: c; | ||
font-weight: bold; | ||
text-align: start; | ||
} |
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
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,5 @@ | ||
{{#each objects}} | ||
<div class="list-item" id="list-item-{{@index}}"> | ||
|
||
</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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {View} from '../../../app/View.js'; | ||
import listBlockTemplate from './listBlock.handlebars'; | ||
import './listBlock.scss'; | ||
import {Avatar} from '../../../entity/avatar/ui/avatar.js'; | ||
|
||
export class ListBlockView extends View { | ||
constructor(root, ...args) { | ||
super(...args); | ||
this.root = document.querySelector(`#${root}`); | ||
} | ||
|
||
render(objects, RenderEntity, ...args) { | ||
this.root.innerHTML = listBlockTemplate({objects}); | ||
const prefix = '#list-item-'; | ||
for (let i = 0; i < objects.length; ++i) { | ||
const root = document.querySelector(prefix + i); | ||
|
||
const entity = new RenderEntity(root); | ||
entity.render(objects[i], ...args); | ||
|
||
const avatar = new Avatar('list-item-avatar', root); | ||
avatar.render(objects[i].avatar_url); | ||
} | ||
} | ||
} |
Oops, something went wrong.