diff --git a/src/components/MatchesTable.vue b/src/components/MatchesTable.vue new file mode 100644 index 0000000..70a71f5 --- /dev/null +++ b/src/components/MatchesTable.vue @@ -0,0 +1,455 @@ + + + + + diff --git a/src/components/Nav.vue b/src/components/Nav.vue index 6c7597c..a4af2f1 100644 --- a/src/components/Nav.vue +++ b/src/components/Nav.vue @@ -14,8 +14,8 @@ diff --git a/src/router/index.js b/src/router/index.js index 152289e..900ee18 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -17,7 +17,7 @@ const routes = [ } }, { - path: '/explore', + path: '/matches', name: 'Explore', components: { main: lazyLoadView('Explore') diff --git a/src/utils/ApiRequests.js b/src/utils/ApiRequests.js index be1f81c..1960bd5 100644 --- a/src/utils/ApiRequests.js +++ b/src/utils/ApiRequests.js @@ -2,6 +2,17 @@ import axios from "axios"; const API_URL = process.env.VUE_APP_API_URL +export const GetMatches = async () => { + try { + const res = await axios.get(`${API_URL}/matches`) + + if (res.status === 200) + return res.data + } catch (err) { + // TODO: Error handling + console.log(err.response.status, err.response.statusText) + } +} export const GetUser = async (id) => { try { diff --git a/src/utils/Utils.js b/src/utils/Utils.js index 6a93065..3ec8b21 100644 --- a/src/utils/Utils.js +++ b/src/utils/Utils.js @@ -67,20 +67,6 @@ export const constructAvatarUrl = (hash, size) => { } } -export const GetAvgRank = (stats) => { - let count = 0 - let fullRank = 0 - - stats.map(player => { - if (player.rank?.old) { - fullRank += player.rank?.old - count += 1 - } - }) - - return count === 0 ? 0 : Math.floor(fullRank / count) -} - export const sortObjectValue = (obj, direction = 'asc') => { const sortable = [] for (let key in obj) { diff --git a/src/utils/index.js b/src/utils/index.js index c55092b..cd5a5dc 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -3,13 +3,12 @@ import {GoToLink, GoToMatch, GoToPlayer} from "./GoTo"; import {SaveLastVisitedToLocalStorage} from "./LocalStorage"; import {GetHLTV_1} from "./HLTV"; import {DisplayRank, LoadImage} from "./Display"; -import {GetMatchDetails, GetPlayerMeta, GetPlayerValue, GetUser, LoadMoreMatches, TrackMe, GetWeaponDmg} from "./ApiRequests"; +import {GetMatchDetails, GetPlayerMeta, GetPlayerValue, GetUser, LoadMoreMatches, TrackMe, GetWeaponDmg, GetMatches} from "./ApiRequests"; import { checkStatEmpty, closeNav, constructAvatarUrl, FixMapName, - GetAvgRank, getPlayerArr, GetWinLoss, setTitle, @@ -44,10 +43,10 @@ export { checkStatEmpty, getPlayerArr, constructAvatarUrl, - GetAvgRank, FixMapName, closeNav, sortObjectValue, GetWeaponDmg, - CreatePlayersArray + CreatePlayersArray, + GetMatches } diff --git a/src/views/Explore.vue b/src/views/Explore.vue index 90fc223..246c5ee 100644 --- a/src/views/Explore.vue +++ b/src/views/Explore.vue @@ -1,21 +1,73 @@ - \ No newline at end of file + +.wrapper { + background: rgba(0, 0, 0, .7); +} + +.container-lg { + padding: 2rem; + + h3 { + margin-bottom: 2rem; + } +} + +@media (max-width: 1200px) { + .container-lg { + padding: 2rem 1rem; + } +} + diff --git a/src/views/Match.vue b/src/views/Match.vue index 722fe24..69414a8 100644 --- a/src/views/Match.vue +++ b/src/views/Match.vue @@ -48,9 +48,9 @@ @@ -63,7 +63,8 @@ + :href="'steam://rungame/730/76561202255233023/+csgo_download_match ' + data.matchDetails.share_code" + title="Watch Demo"> @@ -130,7 +131,6 @@ import { FixMapName, FormatDuration, FormatFullDate, - GetAvgRank, GetMatchDetails, GoToLink, LoadImage @@ -154,7 +154,6 @@ export default { matchDetails: {}, stats: [], score: [0], - avgRank: 0, }) // Functions @@ -182,7 +181,6 @@ export default { type: 'changePlayesArr', data: CreatePlayersArray(data.stats) }) - data.avgRank = GetAvgRank(data.stats) console.log(data.matchDetails) } else { diff --git a/src/views/Player.vue b/src/views/Player.vue index c3b0fb9..f8f5fd8 100644 --- a/src/views/Player.vue +++ b/src/views/Player.vue @@ -117,109 +117,12 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MapRank - Match length - ScoreKAD+/-RatingDurationDate
- - - - - - - - Match long - Match short - - {{ match.score[0] }} - {{ match.score[1] }} - - {{ match.stats.kills ? match.stats.kills : "0" }} - - {{ match.stats.assists ? match.stats.assists : "0" }} - - {{ match.stats.deaths ? match.stats.deaths : "0" }} - - {{ - (match.stats.kills ? match.stats.kills : 0) - (match.stats.deaths ? match.stats.deaths : 0) - }} - - {{ - GetHLTV_1( - match.stats.kills, - match.score[0] + match.score[1], - match.stats.deaths, - match.stats.multi_kills?.duo, - match.stats.multi_kills?.triple, - match.stats.multi_kills?.quad, - match.stats.multi_kills?.pent) - }} - - {{ FormatDuration(match.duration) }} - - {{ FormatDate(match.date) }} -
+
No matches on record
+
+
@@ -314,30 +217,26 @@ import { constructAvatarUrl, DisplayRank, FixMapName, - FormatDate, - FormatDuration, - FormatFullDate, - FormatFullDuration, FormatVacDate, - GetHLTV_1, GetPlayerMeta, GetUser, GetWinLoss, GoToLink, - GoToMatch, GoToPlayer, LoadImage, LoadMoreMatches, + MatchNotParsedTime, SaveLastVisitedToLocalStorage, setTitle, sortObjectValue, - TrackMe, - MatchNotParsedTime + TrackMe } from "../utils"; import {FOOTER_HEIGHT, NAV_HEIGHT} from "@/constants"; +import MatchesTable from "@/components/MatchesTable"; export default { name: 'Player', + components: {MatchesTable}, props: ['id'], setup(props) { // Variables @@ -562,12 +461,6 @@ export default { RefreshData, TrackMe, GetWinLoss, - FormatDate, - FormatFullDate, - FormatDuration, - FormatFullDuration, - GoToMatch, - GetHLTV_1, DisplayRank, constructAvatarUrl, FormatVacDate, @@ -806,225 +699,6 @@ export default { } } -table { - margin-bottom: 0; - - tr { - th { - line-height: 1; - } - - td { - line-height: 60px; - font-size: 1rem; - } - - th:last-child, td:last-child { - text-align: right; - width: 150px; - } - - th[title] { - text-decoration: underline dotted grey; - } - - td { - vertical-align: middle; - } - - .map { - padding-left: 3rem; - } - - .match-len { - width: 18px; - height: 18px; - } - - .td-map { - position: relative; - padding-left: 3rem; - text-align: left !important; - width: 50px; - - .parsed { - position: absolute; - left: 7px; - bottom: 23px; - color: var(--bs-warning); - font-size: 1.7rem; - } - - .not-yet-parsed { - position: absolute; - left: 10px; - bottom: 25px; - color: darkgrey; - font-size: 1.7rem; - } - - .map-not-found { - position: absolute; - top: 4px; - left: 48px; - font-size: 4.35rem; - color: rgba(255, 193, 7, .86); - } - - img { - width: 60px; - height: auto; - } - } - - .td-rank { - .uprank { - box-shadow: 0 0 20px greenyellow; - border: 1px solid greenyellow; - border-radius: 5px; - } - - .downrank { - box-shadow: 0 0 20px #ff2f2f; - border: 1px solid #ff2f2f; - border-radius: 5px; - } - - img { - width: 70px; - height: auto; - - .rank-icon { - height: 35px; - } - } - } - - .td-score { - font-size: 1.2rem; - width: 120px; - } - - .td-date, .date { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - } - - .match { - $first: rgb(0, 0, 0); - $last: rgb(0, 0, 0); - $win: false; - $loss: false; - $draw: false; - $ban: false; - - &.win { - $first: rgb(0, 255, 0); - background: linear-gradient(to right, - rgba($first, 0.2) 0%, - rgba($first, 0.1) 15%, - rgba(0, 0, 0, 0.4) 30%, - rgba(0, 0, 0, 0.4) 70%, - rgba($last, 0.6) 80%, - rgba($last, 0.6) 100% - ); - - &:hover { - background: linear-gradient(to right, - rgba($first, 0.3) 0%, - rgba($first, 0.2) 15%, - rgba(0, 0, 0, 0.5) 30%, - rgba(0, 0, 0, 0.5) 70%, - rgba($last, 0.7) 80%, - rgba($last, 0.7) 100% - ); - } - } - - &.draw { - $first: rgb(255, 255, 0); - background: linear-gradient(to right, - rgba($first, 0.2) 0%, - rgba($first, 0.1) 15%, - rgba(0, 0, 0, 0.4) 30%, - rgba(0, 0, 0, 0.4) 70%, - rgba($last, 0.6) 80%, - rgba($last, 0.6) 100% - ); - - &:hover { - background: linear-gradient(to right, - rgba($first, 0.3) 0%, - rgba($first, 0.2) 15%, - rgba(0, 0, 0, 0.5) 30%, - rgba(0, 0, 0, 0.5) 70%, - rgba($last, 0.7) 80%, - rgba($last, 0.7) 100% - ); - } - } - - &.loss { - $first: rgb(255, 0, 0); - background: linear-gradient(to right, - rgba($first, 0.2) 0%, - rgba($first, 0.1) 15%, - rgba(0, 0, 0, 0.4) 30%, - rgba(0, 0, 0, 0.4) 70%, - rgba($last, 0.6) 80%, - rgba($last, 0.6) 100% - ); - - &:hover { - background: linear-gradient(to right, - rgba($first, 0.3) 0%, - rgba($first, 0.2) 15%, - rgba(0, 0, 0, 0.5) 30%, - rgba(0, 0, 0, 0.5) 70%, - rgba($last, 0.7) 80%, - rgba($last, 0.7) 100% - ); - } - } - - - &.ban { - $last: rgb(93, 3, 3); - background: linear-gradient(to right, - rgba($first, 0.2) 0%, - rgba($first, 0.1) 15%, - rgba(0, 0, 0, 0.4) 30%, - rgba(0, 0, 0, 0.4) 70%, - rgba($last, 0.6) 80%, - rgba($last, 0.6) 100% - ); - - &:hover { - background: linear-gradient(to right, - rgba($first, 0.3) 0%, - rgba($first, 0.2) 15%, - rgba(0, 0, 0, 0.5) 30%, - rgba(0, 0, 0, 0.5) 70%, - rgba($last, 0.7) 80%, - rgba($last, 0.7) 100% - ); - } - } - - border-bottom: 1px solid rgba(73, 73, 73, 0.73); - - &:last-child { - border: none; - } - - &:hover { - cursor: pointer; - } - } -} - @media screen and (max-width: 768px) { .card { .avatar { @@ -1045,50 +719,6 @@ table { } } } - - .map { - padding-left: 2.2rem !important; - } - - .td-map { - position: relative; - padding-left: 2.2rem !important; - width: 35px !important; - - .parsed { - position: absolute; - left: .3rem !important; - } - - .not-yet-parsed { - position: absolute; - left: .3rem !important; - } - - img { - width: 40px !important; - height: auto; - } - } - .td-rank img { - width: 50px !important; - height: auto; - max-width: 50px; - } - - .td-score { - font-size: 1rem !important; - max-width: 90px; - } - - .td-date { - font-size: 1rem !important; - } - - .kills, .deaths, .assists, .kdiff, .duration, .hltv, .length, - .td-kills, .td-deaths, .td-assists, .td-plus, .td-duration, .td-hltv, .td-length { - display: none; - } } @media screen and (max-width: 991px) { @@ -1098,18 +728,5 @@ table { .side-info { display: none !important; } - .avatar { - width: 100px !important; - height: 100px !important; - } - .trackme-btn { - top: 25px; - } -} - -@media screen and (max-width: 1199px) { - .td-plus, .kdiff { - display: none; - } }