diff --git a/frontend/static/css/index.css b/frontend/static/css/index.css new file mode 100644 index 0000000..12a9efb --- /dev/null +++ b/frontend/static/css/index.css @@ -0,0 +1,17 @@ +*{ + color: #cccccc; + font-size: 35px; + background-color: #1a1a1a; +} + +body { +} + +#app #avatar +{ + max-height: 10em; + max-width: 10em; + min-height: 6em; + min-width: 6em; +} + diff --git a/frontend/static/css/me.css b/frontend/static/css/me.css index 0b3155b..1d731ee 100644 --- a/frontend/static/css/me.css +++ b/frontend/static/css/me.css @@ -1,18 +1,17 @@ #app #main .account { - background-color: red; + color: #1a1a1a; } #app #main { width: 60%; display: flex; - margin-left: auto; - margin-right: auto; flex-direction: column; + color: #1a1a1a; } #app #main .profile { - background-color: green; + color: #1a1a1a; } diff --git a/frontend/static/css/profile.css b/frontend/static/css/profile.css index e0a5684..b86bfb0 100644 --- a/frontend/static/css/profile.css +++ b/frontend/static/css/profile.css @@ -1,9 +1,3 @@ -#app #avatar -{ - height: 100px; - width: 100px; -} - #app #username { font-size: 0.8em; diff --git a/frontend/static/css/search.css b/frontend/static/css/search.css index 46389d3..1b70a0a 100644 --- a/frontend/static/css/search.css +++ b/frontend/static/css/search.css @@ -1,7 +1,10 @@ #app img + { - max-height: 3em; - max-width: 3em; + max-height: 4em; + max-width: 4em; + min-height: 2em; + min-width: 2em; } #app ul diff --git a/frontend/static/js/index.js b/frontend/static/js/index.js index 2caae56..0ad94fb 100644 --- a/frontend/static/js/index.js +++ b/frontend/static/js/index.js @@ -19,6 +19,8 @@ import TournamentPageView from "./views/tournament/TournamentPageView.js"; import TournamentsView from "./views/tournament/TournamentsListView.js"; import TournamentCreateView from "./views/tournament/TournamentCreateView.js"; +import {manage_popup} from "./utils/noticeUtils.js"; + let client = new Client(location.protocol + "//" + location.host) let lastView = undefined @@ -107,6 +109,8 @@ const router = async(uri) => { if (await renderView(view)) return 1; + + manage_popup(client) return 0; }; diff --git a/frontend/static/js/utils/noticeUtils.js b/frontend/static/js/utils/noticeUtils.js new file mode 100644 index 0000000..65ad8cf --- /dev/null +++ b/frontend/static/js/utils/noticeUtils.js @@ -0,0 +1,4 @@ +function manage_popup(client) { +} + +export {manage_popup} diff --git a/frontend/static/js/views/MeView.js b/frontend/static/js/views/MeView.js index 7371f98..8cdcf64 100644 --- a/frontend/static/js/views/MeView.js +++ b/frontend/static/js/views/MeView.js @@ -11,11 +11,24 @@ export default class extends AbstractAuthentificateView async postInit() { - document.getElementById("save-account-button").onclick = this.save_account; - document.getElementById("delete-account-button").onclick = this.delete_account; - document.getElementById("save-profile-button").onclick = this.save_profile; + this.display_avatar(); + document.getElementById("save-account-button").onclick = () => this.save_account(); + document.getElementById("delete-account-button").onclick = () => this.delete_account(); + document.getElementById("save-profile-button").onclick = () => this.save_profile(); } + async display_avatar() { + let profile = await client.profiles.getProfile(client.me.id); + if (profile !== undefined || profile !== null) { + if (document.getElementById("avatar") != undefined) + document.getElementById("avatar").remove(); + let avatar = document.createElement("img"); + avatar.id = "avatar"; + avatar.src = profile.avatar_url; + document.getElementsByClassName("avatar")[0].appendChild(avatar); + } + } + async delete_account() { let current_password = document.getElementById("current_password-input").value; @@ -68,6 +81,7 @@ export default class extends AbstractAuthentificateView let form_data = new FormData(); form_data.append("file", avatar.files[0]); await client.me.change_avatar(form_data); + this.display_avatar(); } document.getElementById("save-profile").innerHTML = "Saved"; } @@ -78,6 +92,8 @@ export default class extends AbstractAuthentificateView

ME

+
+

Account

diff --git a/frontend/static/js/views/Search.js b/frontend/static/js/views/Search.js index 0bcb36e..1e920c5 100644 --- a/frontend/static/js/views/Search.js +++ b/frontend/static/js/views/Search.js @@ -10,7 +10,10 @@ export default class extends AbstractView { async wait_get_online_users() { return new Promise((resolve) => { const checkInterval = setInterval(() => { - if (Object.keys(client.notice.online_users).length > 0) { + if (client.notice !== undefined && + client.notice.online_users !== undefined && + Object.keys(client.notice.online_users).length > 0) { + clearInterval(checkInterval); resolve(); } diff --git a/frontend/templates/index.html b/frontend/templates/index.html index 7e05bed..e7c319a 100644 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -5,7 +5,7 @@ Bozo Pong - +
+
+ Test +