-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c262410
commit 4b7ad40
Showing
42 changed files
with
825 additions
and
1,064 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\chat\\styles.scss":"1","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\registration\\styles.scss":"2","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Input\\styles.scss":"3","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\login\\styles.scss":"4","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\account\\styles.scss":"5","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Form\\styles.scss":"6","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Link\\styles.scss":"7","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\error\\styles.scss":"8","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Modal\\styles.scss":"9","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\account\\components\\AccountPhoto\\styles.scss":"10"},{"size":13372,"mtime":1708907856866,"hashOfConfig":"11"},{"size":135,"mtime":1708892428481,"hashOfConfig":"11"},{"size":853,"mtime":1708907080241,"hashOfConfig":"11"},{"size":128,"mtime":1708892428478,"hashOfConfig":"11"},{"size":3868,"mtime":1709391740708,"hashOfConfig":"11"},{"size":851,"mtime":1708907078157,"hashOfConfig":"11"},{"size":390,"mtime":1708907040933,"hashOfConfig":"11"},{"size":395,"mtime":1708892428472,"hashOfConfig":"11"},{"size":1122,"mtime":1709391740708,"hashOfConfig":"11"},{"size":390,"mtime":1708907040933,"hashOfConfig":"11"},"1v6j01t"] | ||
[{"C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\chat\\styles.scss":"1","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\registration\\styles.scss":"2","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Input\\styles.scss":"3","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\login\\styles.scss":"4","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\account\\styles.scss":"5","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Form\\styles.scss":"6","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Link\\styles.scss":"7","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\error\\styles.scss":"8","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Modal\\styles.scss":"9","C:\\1\\middle.messenger.praktikum.yandex\\src\\pages\\account\\components\\AccountPhoto\\styles.scss":"10","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Button\\styles.scss":"11","C:\\1\\middle.messenger.praktikum.yandex\\src\\components\\Message\\styles.scss":"12"},{"size":11756,"mtime":1710702679458,"hashOfConfig":"13"},{"size":135,"mtime":1708892428481,"hashOfConfig":"13"},{"size":853,"mtime":1708907080241,"hashOfConfig":"13"},{"size":128,"mtime":1708892428478,"hashOfConfig":"13"},{"size":3868,"mtime":1709391740708,"hashOfConfig":"13"},{"size":851,"mtime":1708907078157,"hashOfConfig":"13"},{"size":390,"mtime":1708907040933,"hashOfConfig":"13"},{"size":395,"mtime":1708892428472,"hashOfConfig":"13"},{"size":1152,"mtime":1710584696300,"hashOfConfig":"13"},{"size":895,"mtime":1710102023778,"hashOfConfig":"13"},{"size":1159,"mtime":1709970950492,"hashOfConfig":"13"},{"size":1167,"mtime":1710702879251,"hashOfConfig":"13"},"1v6j01t"] |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
{{text}} | ||
{{!-- <div id="avatar"></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
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
margin-top: 60px; | ||
} | ||
|
||
.error { | ||
.error-message { | ||
margin: 0 auto; | ||
margin-top: 14px; | ||
text-align: center; | ||
|
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import Block from "../../services/Block"; | ||
import tpl from "./tpl.hbs?raw"; | ||
import IndexPage from "./indexPage"; | ||
import { Connect } from "../../services/Store"; | ||
|
||
export default class Message extends Block { | ||
render() { | ||
return this.compile(tpl, this.props); | ||
} | ||
} | ||
const Message = Connect(IndexPage, (state) => { | ||
return { currentUserId: state.user.id }; | ||
}); | ||
|
||
export default Message; |
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,9 +1,8 @@ | ||
{{!-- TODO: paste date here --}} | ||
{{!-- <div class="date">19 июня</div> --}} | ||
{{!-- {{{date}}} --}} | ||
<div class="message {{userId}}{{#if checked}} checked{{/if}}"> | ||
<div class="content"> | ||
{{{message}}} | ||
</div> | ||
<div class="time">{{date}}</div> | ||
<div class="content"> | ||
{{message}} | ||
</div> | ||
<div class="time">{{time}}</div> | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
|
||
.title { | ||
font-size: 15px; | ||
margin-bottom: 16px; | ||
|
||
&.error { | ||
color: $red-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
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,35 +1,52 @@ | ||
import Block from "./services/Block"; | ||
import LoginPage from "./pages/login"; | ||
import RegistrationPage from "./pages/registration"; | ||
import ChatPage from "./pages/chat"; | ||
import AccountPage from "./pages/account"; | ||
import ErrorPage from "./pages/error"; | ||
import "./assets/scss/styles.scss"; | ||
import router from "./services/Router/Router"; | ||
import { getUserInfo } from "./api/auth"; | ||
import { setCurrentUser } from "./services/Store"; | ||
|
||
const routes: Record<string, Block> = { | ||
homepage: LoginPage, | ||
registration: RegistrationPage, | ||
chat: ChatPage, | ||
error500: new ErrorPage({ | ||
errorCode: "500 ", | ||
router | ||
.use("*", ErrorPage, { | ||
justification: "Не туда попали", | ||
errorCode: "404", | ||
}) | ||
.use("/", LoginPage) | ||
.use("/sign-up", RegistrationPage) | ||
.use("/messenger", ChatPage) | ||
.use("/settings", AccountPage) | ||
.use("/error500", ErrorPage, { | ||
justification: "Мы уже фиксим", | ||
}), | ||
}; | ||
errorCode: "500", | ||
}) | ||
.start(); | ||
|
||
const pathName = window.location.pathname.slice(1); | ||
document.addEventListener("click", (e) => { | ||
if ((e.target as HTMLElement).tagName.toLowerCase() === "a") { | ||
e.preventDefault(); | ||
const link = (e.target as HTMLElement).getAttribute("href"); | ||
if (link) { | ||
router.go(link); | ||
} | ||
} | ||
}); | ||
|
||
const res = pathName | ||
? routes[pathName] | ||
? routes[pathName] | ||
: new ErrorPage({ | ||
errorCode: "404", | ||
justification: "Не туда попали", | ||
}) | ||
: routes.homepage; | ||
getUserInfo() | ||
.then((user) => { | ||
if ( | ||
user && | ||
(router._currentRoute?._pathname === "/" || | ||
router._currentRoute?._pathname === "/sign-up") | ||
) { | ||
router.go("/messenger"); | ||
} | ||
|
||
function render(query: string, block: Block) { | ||
const root = document.querySelector(query); | ||
root?.appendChild(block.getContent()); | ||
return root; | ||
} | ||
|
||
render("#app", res); | ||
setCurrentUser(user); | ||
}) | ||
.catch(() => { | ||
if (router._currentRoute?._pathname !== "/sign-up") { | ||
router.go("/"); | ||
} | ||
}); |
This file was deleted.
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
Oops, something went wrong.