From 65bc21f61acf2745de0fc604ef1942e5124610a6 Mon Sep 17 00:00:00 2001 From: Trenton Zimmer <66042448+trmazi@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:15:46 -0500 Subject: [PATCH] Add play video page --- .env.development | 4 +- .env.production | 4 +- src/layouts/LayoutAuthenticated.vue | 18 ++- src/router/index.js | 8 ++ src/stores/api/account.js | 10 ++ src/stores/api/music.js | 37 ++++++ src/views/Profile/VideoView.vue | 175 ++++++++++++++++++++++++++++ 7 files changed, 248 insertions(+), 8 deletions(-) create mode 100644 src/stores/api/music.js create mode 100644 src/views/Profile/VideoView.vue diff --git a/.env.development b/.env.development index feda988..dbd63fd 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,5 @@ VITE_API_URL="http://10.5.7.5:8000/" VITE_API_KEY="your_api_key_should_be_here" -VITE_ASSET_PATH="/assets" \ No newline at end of file +VITE_ASSET_PATH="/assets" +VITE_DISCORD_OAUTH_URL="https://discord.com/api/oauth2/authorize?client_id=947985989421395988&redirect_uri=https%3A%2F%2Fphaseii.network%2Faccount%2Fdiscord_callback&response_type=code&scope=identify" +VITE_TACHI_OAUTH_URL="https://kamai.tachi.ac/oauth/request-auth?clientID=CI820ca69046783e9fb4cc7d616f985ea2cab00f5f" \ No newline at end of file diff --git a/.env.production b/.env.production index ed30443..f1a3f4a 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,5 @@ VITE_API_URL="https://restfulsleep.phaseii.network" VITE_API_KEY="your_api_key_should_be_here" -VITE_ASSET_PATH="https://cdn.phaseii.network/file/PhaseII/web-assets" \ No newline at end of file +VITE_ASSET_PATH="https://cdn.phaseii.network/file/PhaseII/web-assets" +VITE_DISCORD_OAUTH_URL="" +VITE_TACHI_OAUTH_URL="" \ No newline at end of file diff --git a/src/layouts/LayoutAuthenticated.vue b/src/layouts/LayoutAuthenticated.vue index f2b5ecf..079c470 100644 --- a/src/layouts/LayoutAuthenticated.vue +++ b/src/layouts/LayoutAuthenticated.vue @@ -7,6 +7,7 @@ import { mdiStoreCog, mdiGamepad, mdiSecurity, + mdiMultimedia, } from "@mdi/js"; import { ref, watch, onMounted, computed } from "vue"; import { useRouter, useRoute } from "vue-router"; @@ -128,12 +129,6 @@ const menuAside = computed(() => { const sortedArcades = mainStore.userArcades.map((arcade) => ({ label: arcade.name, to: `/arcade/${arcade.id}`, - // menu: [ - // { label: "Overview", to: `/arcade/${arcade.id}` }, - // { label: "Event Settings", to: `/arcade/${arcade.id}/events` }, - // { label: "Machine List", to: `/arcade/${arcade.id}/machines` }, - // { label: "PASELI", to: `/arcade/${arcade.id}/paseli` }, - // ], })); const adminMenu = [ @@ -205,6 +200,17 @@ const menuAside = computed(() => { }); } + sideMenu.push({ + label: "My Content", + icon: mdiMultimedia, + menu: [ + { + label: "Play Videos", + to: `/profile/videos`, + }, + ], + }); + return sideMenu; }); diff --git a/src/router/index.js b/src/router/index.js index ee846e7..0bf3e0c 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -82,6 +82,14 @@ const routes = [ // name: "profile_goals", // component: () => import("@/views/Profile/GoalsView.vue"), // }, + { + meta: { + title: "Play Videos", + }, + path: "/profile/videos", + name: "profile_videos", + component: () => import("@/views/Profile/VideoView.vue"), + }, { meta: { title: "View Profile", diff --git a/src/stores/api/account.js b/src/stores/api/account.js index ea29b1e..49fc396 100644 --- a/src/stores/api/account.js +++ b/src/stores/api/account.js @@ -103,3 +103,13 @@ export async function APIDeleteCard(cardId) { throw error; } } + +export async function APIGetPlayVideos() { + try { + const data = await mainStore.callApi(`/user/playVideos`); + return data.data; + } catch (error) { + console.log("Error fetching videos:", error); + throw error; + } +} diff --git a/src/stores/api/music.js b/src/stores/api/music.js new file mode 100644 index 0000000..b935a80 --- /dev/null +++ b/src/stores/api/music.js @@ -0,0 +1,37 @@ +import { useMainStore } from "@/stores/main"; +const mainStore = useMainStore(); + +export async function APIGetMusicData( + game, + version, + songIds = null, + oneChart = false +) { + try { + const data = await mainStore.callApi( + `/music?game=${game}&version=${version}` + + (oneChart ? "&oneChart=true" : ""), + "GET", + null, + { songIds: songIds.toString() } + ); + return data.data; + } catch (error) { + console.log("Error fetching music data:", error); + throw error; + } +} + +export async function getAttemptData(game, userId = null) { + try { + const data = await mainStore.callApi( + `/attempts/${game}` + (userId ? `?userId=${userId}` : ""), + "GET", + null + ); + return data.data; + } catch (error) { + console.log("Error fetching attempt data:", error); + throw error; + } +} diff --git a/src/views/Profile/VideoView.vue b/src/views/Profile/VideoView.vue new file mode 100644 index 0000000..c8006ff --- /dev/null +++ b/src/views/Profile/VideoView.vue @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + Your browser does not support the video tag. + + + + + + + {{ videoData[0]?.game }} {{ videoData[0]?.version }} + + + + + {{ videoData[0]?.timestamp }} + + + + + + + + + + + Your video is still uploading! + + + Please wait for the upload to complete. + + + Upload started at {{ videoData[0].timestamp }} + + + + + + + + + + + + + + + + + +
{{ videoData[0]?.timestamp }}