Skip to content

Commit

Permalink
tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhel1 committed Dec 24, 2023
1 parent 9c5697e commit c6621c8
Show file tree
Hide file tree
Showing 9 changed files with 268 additions and 51 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</head>
<body>
<div id="nav"></div>
<div id="app"></div>
<main id="app"></main>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
1 change: 0 additions & 1 deletion src/components/avatar/avatar.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "/src/scss/utils";

.avatar {
border-radius: 50%;
Expand Down
236 changes: 236 additions & 0 deletions src/data/chat_list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
export const chat_list_data = [
{
id: 1,
avatar: `https://fikiwiki.com/uploads/posts/2022-02/1644885500_22-fikiwiki-com-p-kartinki-dlya-geimerov-na-avu-26.jpg`,
type: "dialog",
title: "Ivan",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Ivan",
second_name: "Ivanov",
avatar: `https://fikiwiki.com/uploads/posts/2022-02/1644885500_22-fikiwiki-com-p-kartinki-dlya-geimerov-na-avu-26.jpg`,
},
time: "12.33",
text: "this is message from user"
}
},
{
id: 22,
title: "Neighbors",
type: "chat",
unread_msg_count: 6,
last_message: {
user: {
first_name: "Shurum",
second_name: "Burum",
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 333,
type: "dialog",
title: "Shurum",
unread_msg_count: 1,
last_message: {
user: {
first_name: "Shurum",
second_name: "Burum",
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 7,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
type: "dialog",
title: "Alena",
unread_msg_count: 8,
last_message: {
user: {
first_name: "Nina",
second_name: "Alena",
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
{
id: 4444,
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
type: "dialog",
title: "Nina",
unread_msg_count: 4,
last_message: {
user: {
first_name: "Nina",
second_name: "Anin",
avatar: `https://klike.net/uploads/posts/2023-01/1673594987_3-24.jpg`,
},
time: "12.34",
text: "this is message from user this is message from user this is message from user"
}
},
]
10 changes: 10 additions & 0 deletions src/data/conversation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const conversation =
{
id: 1,
user: {
first_name: "Ivan",
second_name: "Ivanov",
avatar: `https://fikiwiki.com/uploads/posts/2022-02/1644885500_22-fikiwiki-com-p-kartinki-dlya-geimerov-na-avu-26.jpg`,
},
}

11 changes: 11 additions & 0 deletions src/data/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const Error404 = {
error: 404,
errorText: "Oops! This Page Could Not Be Found",
message: "sorry but the page you are looking for does not exist, have been removed. name changed or is temporarily unavailable",
}

export const Error500 = {
error: 500,
errorText: "Oops! This Page Could Not Be Found",
message: "sorry but the page you are looking for does not exist, have been removed. name changed or is temporarily unavailable",
}
4 changes: 4 additions & 0 deletions src/data/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { chat_list_data as ChatListData } from './chat_list';
export { conversation as ConversationData } from './conversation';
export { Error404 as Errors404Data } from './errors';
export { Error500 as Errors500Data } from './errors';
10 changes: 4 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import Handlebars from 'handlebars';
import * as Components from './components';
import * as Pages from './pages';
import { chat_list_data } from "./data/chat_list";
import * as Errors from "./data/errors";
import {conversation} from "./data/conversation";
import * as Data from "./data";

const pages = {
'signin': [ Pages.SignInPage, ],
'signup': [ Pages.SignUpPage, ],
'messenger': [ Pages.Messenger, { chat_list: chat_list_data, conversation: conversation }],
'404': [ Pages.ErrorPage, Errors.Error404],
'500': [ Pages.ErrorPage, Errors.Error500 ],
'messenger': [ Pages.Messenger, { chat_list: Data.ChatListData, conversation: Data.ConversationData }],
'404': [ Pages.ErrorPage, Data.Errors404Data],
'500': [ Pages.ErrorPage, Data.Errors500Data],
};

Object.entries(Components).forEach(([ name, component ]) => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/messenger/messenger.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<main class="messenger">
<div class="messenger">
{{> ChatList list=chat_list}}
{{#if true}}
{{> Conversation conversation=conversation}}
{{^}}
<span class="messenger__placeholder">Choose a chat to start messaging.</span>
{{/if}}
</main>
</div>
41 changes: 0 additions & 41 deletions src/scss/utils.scss

This file was deleted.

0 comments on commit c6621c8

Please sign in to comment.