mirror of
https://github.com/rommapp/romm.git
synced 2026-12-05 05:07:31 +01:00
fixed add to collection for non-admin users
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import AdminMenu from "@/components/common/Game/AdminMenu.vue";
|
||||
import romApi from "@/services/api/rom";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storeDownload from "@/stores/download";
|
||||
import type { DetailedRom } from "@/stores/roms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
@@ -13,7 +12,6 @@ import { inject, ref } from "vue";
|
||||
const props = defineProps<{ rom: DetailedRom }>();
|
||||
const downloadStore = storeDownload();
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const auth = storeAuth();
|
||||
const playInfoIcon = ref("mdi-play");
|
||||
const emulationSupported = isEmulationSupported(props.rom.platform_slug);
|
||||
|
||||
@@ -88,11 +86,7 @@ async function copyDownloadLink(rom: DetailedRom) {
|
||||
</v-btn>
|
||||
<v-menu location="bottom">
|
||||
<template #activator="{ props: menuProps }">
|
||||
<v-btn
|
||||
v-if="auth.scopes.includes('roms.write')"
|
||||
class="flex-grow-1"
|
||||
v-bind="menuProps"
|
||||
>
|
||||
<v-btn class="flex-grow-1" v-bind="menuProps">
|
||||
<v-icon icon="mdi-dots-vertical" size="large" />
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
@@ -1,42 +1,46 @@
|
||||
<script setup lang="ts">
|
||||
import { inject } from "vue";
|
||||
import type { Emitter } from "mitt";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { SimpleRom } from "@/stores/roms";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storeHeartbeat from "@/stores/heartbeat";
|
||||
import type { SimpleRom } from "@/stores/roms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject } from "vue";
|
||||
|
||||
defineProps<{ rom: SimpleRom }>();
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const heartbeat = storeHeartbeat();
|
||||
const auth = storeAuth();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-list rounded="0" class="pa-0">
|
||||
<v-list-item
|
||||
:disabled="!heartbeat.value.ANY_SOURCE_ENABLED"
|
||||
class="py-4 pr-5"
|
||||
@click="emitter?.emit('showMatchRomDialog', rom)"
|
||||
>
|
||||
<v-list-item-title class="d-flex">
|
||||
<v-icon icon="mdi-search-web" class="mr-2" />Manual match
|
||||
</v-list-item-title>
|
||||
<v-list-item-subtitle>
|
||||
{{
|
||||
!heartbeat.value.ANY_SOURCE_ENABLED
|
||||
? "No metadata source enabled"
|
||||
: ""
|
||||
}}
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
class="py-4 pr-5"
|
||||
@click="emitter?.emit('showEditRomDialog', { ...rom })"
|
||||
>
|
||||
<v-list-item-title class="d-flex">
|
||||
<v-icon icon="mdi-pencil-box" class="mr-2" />Edit
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-divider />
|
||||
<template v-if="auth.scopes.includes('roms.write')">
|
||||
<v-list-item
|
||||
:disabled="!heartbeat.value.ANY_SOURCE_ENABLED"
|
||||
class="py-4 pr-5"
|
||||
@click="emitter?.emit('showMatchRomDialog', rom)"
|
||||
>
|
||||
<v-list-item-title class="d-flex">
|
||||
<v-icon icon="mdi-search-web" class="mr-2" />Manual match
|
||||
</v-list-item-title>
|
||||
<v-list-item-subtitle>
|
||||
{{
|
||||
!heartbeat.value.ANY_SOURCE_ENABLED
|
||||
? "No metadata source enabled"
|
||||
: ""
|
||||
}}
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
class="py-4 pr-5"
|
||||
@click="emitter?.emit('showEditRomDialog', { ...rom })"
|
||||
>
|
||||
<v-list-item-title class="d-flex">
|
||||
<v-icon icon="mdi-pencil-box" class="mr-2" />Edit
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-divider />
|
||||
</template>
|
||||
<v-list-item
|
||||
class="py-4 pr-5"
|
||||
@click="emitter?.emit('showAddToCollectionDialog', [{ ...rom }])"
|
||||
@@ -46,14 +50,16 @@ const heartbeat = storeHeartbeat();
|
||||
collection
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-divider />
|
||||
<v-list-item
|
||||
class="py-4 pr-5 text-romm-red"
|
||||
@click="emitter?.emit('showDeleteRomDialog', [rom])"
|
||||
>
|
||||
<v-list-item-title class="d-flex">
|
||||
<v-icon icon="mdi-delete" class="mr-2" />Delete
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
<template v-if="auth.scopes.includes('roms.write')">
|
||||
<v-divider />
|
||||
<v-list-item
|
||||
class="py-4 pr-5 text-romm-red"
|
||||
@click="emitter?.emit('showDeleteRomDialog', [rom])"
|
||||
>
|
||||
<v-list-item-title class="d-flex">
|
||||
<v-icon icon="mdi-delete" class="mr-2" />Delete
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</v-list>
|
||||
</template>
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import AdminMenu from "@/components/common/Game/AdminMenu.vue";
|
||||
import romApi from "@/services/api/rom";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storeDownload from "@/stores/download";
|
||||
import type { SimpleRom } from "@/stores/roms";
|
||||
import { isEmulationSupported } from "@/utils";
|
||||
|
||||
// Props
|
||||
defineProps<{ rom: SimpleRom }>();
|
||||
const auth = storeAuth();
|
||||
const downloadStore = storeDownload();
|
||||
</script>
|
||||
|
||||
@@ -44,7 +42,6 @@ const downloadStore = storeDownload();
|
||||
<v-menu location="bottom">
|
||||
<template #activator="{ props }">
|
||||
<v-btn
|
||||
v-if="auth.scopes.includes('roms.write')"
|
||||
class="action-bar-btn-small"
|
||||
size="x-small"
|
||||
v-bind="props"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import AdminMenu from "@/components/common/Game/AdminMenu.vue";
|
||||
import RAvatar from "@/components/common/Game/RAvatar.vue";
|
||||
import romApi from "@/services/api/rom";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storeDownload from "@/stores/download";
|
||||
import storeRoms, { type SimpleRom } from "@/stores/roms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
@@ -30,7 +29,6 @@ const router = useRouter();
|
||||
const route = useRoute();
|
||||
const downloadStore = storeDownload();
|
||||
const romsStore = storeRoms();
|
||||
const auth = storeAuth();
|
||||
const page = ref(parseInt(window.location.hash.slice(1)) || 1);
|
||||
const storedRomsPerPage = parseInt(localStorage.getItem("romsPerPage") ?? "");
|
||||
const itemsPerPage = ref(isNaN(storedRomsPerPage) ? 25 : storedRomsPerPage);
|
||||
@@ -181,11 +179,7 @@ onMounted(() => {
|
||||
</v-btn>
|
||||
<v-menu location="bottom">
|
||||
<template #activator="{ props }">
|
||||
<v-btn
|
||||
v-if="auth.scopes.includes('roms.write')"
|
||||
v-bind="props"
|
||||
size="small"
|
||||
>
|
||||
<v-btn v-bind="props" size="small">
|
||||
<v-icon>mdi-dots-vertical</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user