From 412845079d413a3f089c09085e5130cbba8d4196 Mon Sep 17 00:00:00 2001 From: zurdi Date: Fri, 12 Apr 2024 09:41:40 +0200 Subject: [PATCH 1/2] added copy download link button to details view --- frontend/src/components/Details/ActionBar.vue | 31 +++++++++- frontend/src/components/Details/Saves.vue | 16 ++--- .../src/components/Game/Card/ActionBar.vue | 59 +++++++++---------- frontend/src/services/api/rom.ts | 37 ++++++------ 4 files changed, 87 insertions(+), 56 deletions(-) diff --git a/frontend/src/components/Details/ActionBar.vue b/frontend/src/components/Details/ActionBar.vue index d0624adf9..118277474 100644 --- a/frontend/src/components/Details/ActionBar.vue +++ b/frontend/src/components/Details/ActionBar.vue @@ -15,13 +15,37 @@ const emitter = inject>("emitter"); const auth = storeAuth(); const emulation = ref(false); const playInfoIcon = ref("mdi-play"); -const emulationSupported = props.rom.platform_slug.toLowerCase() in platformSlugEJSCoreMap; +const emulationSupported = + props.rom.platform_slug.toLowerCase() in platformSlugEJSCoreMap; function toggleEmulation() { emulation.value = !emulation.value; playInfoIcon.value = emulation.value ? "mdi-information" : "mdi-play"; emitter?.emit("showEmulation", null); } + +async function copyDownloadLink(rom: Rom) { + const downloadLink = await romApi.downloadRom({ + rom, + files: downloadStore.filesToDownloadMultiFileRom, + shareLink: true, + }); + if (downloadLink) { + emitter?.emit("snackbarShow", { + msg: "Download link copied to clipboard!", + icon: "mdi-check-bold", + color: "green", + timeout: 2000, + }); + } else { + emitter?.emit("snackbarShow", { + msg: `Unable to copy download link: ${downloadLink}`, + icon: "mdi-close-circle", + color: "red", + timeout: 4000, + }); + } +}