diff --git a/src/App.vue b/src/App.vue index ddca830..a4833e7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,6 +19,8 @@ import MdDrawer from "vue-material/dist/components/MdDrawer"; import MdButton from "vue-material/dist/components/MdButton"; import MdProgress from "vue-material/dist/components/MdProgress"; import MdSnackbar from "vue-material/dist/components/MdSnackbar"; +import MdMenu from "vue-material/dist/components/MdMenu"; +import MdList from "vue-material/dist/components/MdList"; Vue.use(MdTabs); Vue.use(MdIcon); @@ -28,6 +30,8 @@ Vue.use(MdDrawer); Vue.use(MdButton); Vue.use(MdProgress); Vue.use(MdSnackbar); +Vue.use(MdMenu); +Vue.use(MdList); import TabsMenu from "@/components/TabsMenu.vue"; import LoaderPage from "@/components/Others/LoaderPage.vue"; @@ -195,4 +199,18 @@ a { .clickable:hover { cursor: pointer; } + +.md-menu-content-container { + color: black; + background-color: #e0eddd; + border: 3px solid black; +} + +.md-scrollbar::-webkit-scrollbar-thumb { + background-color: #fd8846 !important; +} + +.md-scrollbar::-webkit-scrollbar-corner { + background-color: black !important; +} diff --git a/src/api/GlobalApi.js b/src/api/GlobalApi.js index bb591ea..f1ba531 100644 --- a/src/api/GlobalApi.js +++ b/src/api/GlobalApi.js @@ -36,6 +36,15 @@ export default class GlobalApi { document.title = "Факты 13"; } + getHumanServerName(server) { + for (const mode in this.stats['servers']) { + for (const srv in this.stats['servers'][mode]) { + if (this.stats['servers'][mode][srv]['key'] === server) return this.stats['servers'][mode][srv]['name']; + } + } + return "неизвестный"; + } + async fillThis(value) { console.log(`[API] load: ${value}`); this.load_stages.add(value); @@ -64,6 +73,7 @@ export default class GlobalApi { 'n':[] }; for (let srv in response) { + response[srv]['key'] = srv; if (response[srv]['status'] == false) srvs.n.push(response[srv]); else if (response[srv]['player_count'] > 0) srvs.w.push(response[srv]); else srvs.e.push(response[srv]); @@ -136,6 +146,8 @@ export default class GlobalApi { h = divmod(h, 24)[1]; //бля простите я тупой + let total_h = divmod(u_time, 60 * 60); + if (!s & !m & !h & !d) { return "не играл"; } @@ -145,9 +157,9 @@ export default class GlobalApi { if (!d) { return time; } else if (d < 2) { - return `${h} ч\n`; + return `${h} ч`; } else { - return `${h} ч\n(${n} н ${d} д ${h} ч`; + return `${total_h[0]} ч (${n} н ${d} д ${h} ч)`; } } } diff --git a/src/api/PlayerApi.js b/src/api/PlayerApi.js index 2af856c..ab607ff 100644 --- a/src/api/PlayerApi.js +++ b/src/api/PlayerApi.js @@ -5,7 +5,9 @@ export default class PlayerApi { permition: null, steam_data: null, ban: null, - steamids: null + steamids: null, + gametime: {}, + lastplay: {} } discord = null; @@ -18,6 +20,43 @@ export default class PlayerApi { } } + getGametimeTotal(player) { + if (player === undefined) player = this.store; + let t = 0; + for (const srv in player.gametime) { + for (const map_name in player.gametime[srv]) { + t += player.gametime[srv][map_name]; + } + } + return t; + } + + getGametime(api, player) { + if (player === undefined) player = this.store; + let t = []; + let total_on_server = [0]; + for (const srv in player.gametime) { + total_on_server = [0]; + for (const map_name in player.gametime[srv]) { + total_on_server[0] += player.gametime[srv][map_name]; + } + t.push([api.getHumanServerName(srv), total_on_server[0]]); + } + return t; + } + + getLastplayList(player) { + if (player === undefined) player = this.store; + let t = []; + for (const srv in player.lastplay) { + for (const map_name in player.lastplay[srv]) { + t.push([map_name.replace("workshop/", "").split(".ugc")[0], new Date(player.lastplay[srv][map_name] * 1000).toLocaleDateString()]); + } + + } + return t; + } + async loadFull() { return axios.get(`/api/profile/current`) .then(response => { diff --git a/src/components/TabsMenuElements/ProfileView/AuthWindow.vue b/src/components/Others/AuthWindow.vue similarity index 100% rename from src/components/TabsMenuElements/ProfileView/AuthWindow.vue rename to src/components/Others/AuthWindow.vue diff --git a/src/components/Others/ProfileViewer.vue b/src/components/Others/ProfileViewer.vue new file mode 100644 index 0000000..20f9d2f --- /dev/null +++ b/src/components/Others/ProfileViewer.vue @@ -0,0 +1,42 @@ + + + \ No newline at end of file diff --git a/src/components/TabsMenuElements/ProfileView/Components/ProfileContainer.vue b/src/components/TabsMenuElements/ProfileView/Components/ProfileContainer.vue new file mode 100644 index 0000000..b216cc0 --- /dev/null +++ b/src/components/TabsMenuElements/ProfileView/Components/ProfileContainer.vue @@ -0,0 +1,106 @@ + + + + + \ No newline at end of file diff --git a/src/components/TabsMenuElements/ProfileView/ProfileView.vue b/src/components/TabsMenuElements/ProfileView/ProfileView.vue index 296c077..c13d2d7 100644 --- a/src/components/TabsMenuElements/ProfileView/ProfileView.vue +++ b/src/components/TabsMenuElements/ProfileView/ProfileView.vue @@ -1,66 +1,22 @@