diff --git a/frontend/src/components/Details/ActionBar.vue b/frontend/src/components/Details/ActionBar.vue index d0624adf9..e1e18d0c8 100644 --- a/frontend/src/components/Details/ActionBar.vue +++ b/frontend/src/components/Details/ActionBar.vue @@ -5,7 +5,7 @@ import storeAuth from "@/stores/auth"; import storeDownload from "@/stores/download"; import type { Rom } from "@/stores/roms"; import type { Events } from "@/types/emitter"; -import { platformSlugEJSCoreMap } from "@/utils"; +import { getDownloadLink, platformSlugEJSCoreMap } from "@/utils"; import type { Emitter } from "mitt"; import { inject, ref } from "vue"; @@ -15,13 +15,32 @@ 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); } + +function copyDownloadLink(rom: Rom) { + navigator.clipboard.writeText( + location.host + + encodeURI( + getDownloadLink({ + rom, + files: downloadStore.filesToDownloadMultiFileRom, + }) + ) + ); + emitter?.emit("snackbarShow", { + msg: "Download link copied to clipboard!", + icon: "mdi-check-bold", + color: "green", + timeout: 2000, + }); +}