From 9cf2d88dddcdfef73e332c7fb6b0a7de304ca588 Mon Sep 17 00:00:00 2001
From: Trenton Zimmer <66042448+trmazi@users.noreply.github.com>
Date: Tue, 4 Feb 2025 19:40:10 -0500
Subject: [PATCH] Add arcade claiming
---
src/layouts/LayoutAuthenticated.vue | 23 ++--
src/router/index.js | 8 ++
src/stores/api/arcade.js | 25 +++++
src/views/Arcade/ClaimView.vue | 161 ++++++++++++++++++++++++++++
4 files changed, 209 insertions(+), 8 deletions(-)
create mode 100644 src/views/Arcade/ClaimView.vue
diff --git a/src/layouts/LayoutAuthenticated.vue b/src/layouts/LayoutAuthenticated.vue
index d9621ba..3bdc0e9 100644
--- a/src/layouts/LayoutAuthenticated.vue
+++ b/src/layouts/LayoutAuthenticated.vue
@@ -5,6 +5,7 @@ import {
mdiMenu,
mdiMonitor,
mdiStoreCog,
+ mdiStorePlus,
mdiGamepad,
mdiSecurity,
mdiMultimedia,
@@ -196,14 +197,6 @@ const menuAside = computed(() => {
});
}
- if (sortedArcades.length) {
- sideMenu.push({
- label: "My Arcades",
- icon: mdiStoreCog,
- menu: sortedArcades,
- });
- }
-
sideMenu.push({
label: "My Content",
icon: mdiMultimedia,
@@ -219,6 +212,20 @@ const menuAside = computed(() => {
],
});
+ if (sortedArcades.length) {
+ sideMenu.push({
+ label: "My Arcades",
+ icon: mdiStoreCog,
+ menu: sortedArcades,
+ });
+ }
+
+ sideMenu.push({
+ label: "Claim Arcade",
+ icon: mdiStorePlus,
+ to: `/arcade/claim`,
+ });
+
return sideMenu;
});
diff --git a/src/router/index.js b/src/router/index.js
index 6c30f08..e38328e 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -262,6 +262,14 @@ const routes = [
hotReload: true, // disables Hot Reload
},
},
+ {
+ meta: {
+ title: "Claim an Arcade",
+ },
+ path: "/arcade/claim",
+ name: "arcade_claim",
+ component: () => import("@/views/Arcade/ClaimView.vue"),
+ },
{
meta: {
title: "Game Overview",
diff --git a/src/stores/api/arcade.js b/src/stores/api/arcade.js
index 019c930..6c26172 100644
--- a/src/stores/api/arcade.js
+++ b/src/stores/api/arcade.js
@@ -79,3 +79,28 @@ export async function APIGetArcadePASELI(arcadeId) {
throw error;
}
}
+
+export async function APIStartTakeover(PCBID) {
+ try {
+ const data = await mainStore.callApi(`/arcade/takeover?PCBID=${PCBID}`);
+ if (data.status == "warn") {
+ window.alert(data.error_code);
+ }
+ return data.data;
+ } catch (error) {
+ console.log("Error fetching takeover:", error);
+ throw error;
+ }
+}
+
+export async function APISaveTakeover(PCBID) {
+ try {
+ const data = await mainStore.callApi(`/arcade/takeover`, "POST", {
+ PCBID: PCBID,
+ });
+ return data;
+ } catch (error) {
+ console.log("Error saving takeover:", error);
+ throw error;
+ }
+}
diff --git a/src/views/Arcade/ClaimView.vue b/src/views/Arcade/ClaimView.vue
new file mode 100644
index 0000000..f737efa
--- /dev/null
+++ b/src/views/Arcade/ClaimView.vue
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+ Claim an arcade using a PCBID. If the account already has an owner,
+ you may not claim the arcade.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ takeoverData?.arcade?.name }}
+
+
+ {{ takeoverData?.arcade?.description }}
+
+
+
+ This arcade has {{ takeoverData?.count }} machine(s).
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ✅ Successfully merged {{ takeoverData?.count }} machines. Yippie!
+
+
+
+
+
+
+
+
+
+
+
+
+ ❌ Failed to merge. Please try again.
+
+
+
+
+
+
+
+
+