diff --git a/scss/custom.scss b/scss/custom.scss index 21d1851..29a3d63 100644 --- a/scss/custom.scss +++ b/scss/custom.scss @@ -17,5 +17,13 @@ $warning: #c3a235; $info: $blue; $success: #609926; +// Custom classes +.mt-n5 { + margin-top: -3rem !important; +} +.mt-n4 { + margin-top: -2rem !important; +} + // Bootstrap @import "../node_modules/bootstrap/scss/bootstrap"; diff --git a/src/components/Footer.vue b/src/components/Footer.vue index 873c30c..09fb280 100644 --- a/src/components/Footer.vue +++ b/src/components/Footer.vue @@ -1,7 +1,7 @@ diff --git a/src/components/Nav.vue b/src/components/Nav.vue index 0a8263f..4a03efe 100644 --- a/src/components/Nav.vue +++ b/src/components/Nav.vue @@ -1,21 +1,21 @@ \ No newline at end of file + + + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 890fa23..75570a4 100644 --- a/src/main.js +++ b/src/main.js @@ -5,4 +5,4 @@ import store from './store' import 'bootstrap' import '../scss/custom.scss' -createApp(App).use(store).use(router).mount('#app') +createApp(App).use(store).use(router).mount('#app') \ No newline at end of file diff --git a/src/utils/index.js b/src/utils/index.js index e3f2141..5e9c25e 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,16 +1,22 @@ -import {DateTime} from "luxon/build/es6/luxon"; -import router from '@/router' +import {DateTime, Duration} from "luxon/build/es6/luxon"; +import router from '../router' export const FormatDuration = (d) => { - const hours = Math.floor(d / 3600) - const num = d % 3600 - const minutes = Math.floor(num % 3600 / 60) - const seconds = Math.floor(num % 3600 % 60) + const duration = Duration.fromObject({hours: 0, minutes: 0, seconds: d}).normalize().toObject() - if (hours !== 0) - return `${hours}:${minutes < 10 ? '0' + minutes : minutes}:${seconds < 10 ? '0' + seconds : seconds}` - else - return `${minutes < 10 ? '0' + minutes : minutes}:${seconds < 10 ? '0' + seconds : seconds}` + if (duration.hours > 1) + return `${duration.hours} h ${duration.minutes} min` + else if (duration.hours < 1) + return `${duration.minutes} min` +} + +export const FormatFullDuration = (d) => { + const duration = Duration.fromObject({hours: 0, minutes: 0, seconds: d}).normalize() + + if (duration.hours > 1) + return duration.toFormat('hh:mm:ss') + else if (duration.hours < 1) + return duration.toFormat('mm:ss') } export const FormatDate = (date) => { @@ -18,7 +24,7 @@ export const FormatDate = (date) => { const diff = DateTime.now().diff(matchDate) if (diff.as('days') > 10) - return matchDate.toLocaleString({weekday: 'short', day: 'numeric', month: 'numeric', year: 'numeric'}) + return matchDate.toLocaleString({weekday: 'short', day: '2-digit', month: '2-digit', year: 'numeric'}) else if (diff.as('days') < 1) if (diff.as('hours') < 1) return Math.floor(diff.as('minutes')) + ' minutes ago' @@ -28,6 +34,20 @@ export const FormatDate = (date) => { return Math.floor(diff.as('days')) + ' days ago' } +export const FormatFullDate = (date) => { + const matchDate = DateTime.fromISO(date) + + return matchDate.toLocaleString({ + weekday: 'short', + day: '2-digit', + month: '2-digit', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + second: '2-digit' + }) +} + export const GoToMatch = (id) => { router.push(`/match/${id}`) } @@ -47,4 +67,17 @@ export const GetHLTV_1 = (kills = 0, rounds, deaths = 0, k2 = 0, k3 = 0, k4 = 0, const RoundsWithMultipleKillsRating = (k1 + 4 * k2 + 9 * k3 + 16 * k4 + 25 * k5) / rounds / Weight_RMK return ((KillRating + 0.7 * SurvivalRating + RoundsWithMultipleKillsRating) / 2.7).toFixed(2) +} + +export const SaveLastVisitedToLocalStorage = (data) => { + let a = JSON.parse(localStorage.getItem('recent-visited')) || []; + if (a.length === 0) { + a.push(data); + } else if (a.find(p => p.steamid64 === data.steamid64)) { + a.splice(a.findIndex(j => j.steamid64 === data.steamid64), 1) + a.push(data) + } else if (!a.find(p => p.steamid64 === data.steamid64)) { + a.push(data) + } + localStorage.setItem('recent-visited', JSON.stringify(a)); } \ No newline at end of file diff --git a/src/views/Explore.vue b/src/views/Explore.vue index 55dd221..90fc223 100644 --- a/src/views/Explore.vue +++ b/src/views/Explore.vue @@ -1,9 +1,21 @@ \ No newline at end of file + + + \ No newline at end of file diff --git a/src/views/Home.vue b/src/views/Home.vue index de28c8d..5695d90 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,62 +1,77 @@ - \ No newline at end of file diff --git a/src/views/Match.vue b/src/views/Match.vue index 0e2122b..d49bf4f 100644 --- a/src/views/Match.vue +++ b/src/views/Match.vue @@ -21,14 +21,9 @@
-
- {{data.score[0]}} - - - {{data.score[1]}} -
-
- - +
+ +
@@ -37,7 +32,6 @@ import {defineAsyncComponent, onBeforeMount, reactive, watch} from "vue"; import axios from 'axios' import {GetHLTV_1, GoToPlayer} from "../utils"; -import "../components/ScoreTeam" const ScoreTeam = defineAsyncComponent(() => import('../components/ScoreTeam')) @@ -61,12 +55,13 @@ export default { // Functions const GetMatch = () => { axios - .get(`http://localhost:1337/http://localhost:8000/match/${props.match_id}`) + .get(`http://localhost:8000/match/${props.match_id}`) .then((response) => { document.title = `${response.data.map} | CSGO-W.TF` data.matchDetails = response.data data.stats = response.data.stats data.score = response.data.score + console.log(response.data) }) .catch((e) => { console.log(e) @@ -106,56 +101,10 @@ export default { } - \ No newline at end of file