Context menus (#133)

* Context Menus in home and library

* Menu impl

* FInalize context menus

* Update App.vue

* Update App.vue

* fix scrolling
This commit is contained in:
Adrian O.V
2023-06-10 15:31:52 -04:00
committed by GitHub
parent e0e9c3f166
commit e836738887
9 changed files with 672 additions and 61 deletions

View File

@@ -60,7 +60,12 @@
<div class="table-cell table-text">Author</div>
<div class="table-cell table-text">Actions</div>
</div>
<div v-for="mod in search" :key="mod.file_name" class="table-row">
<div
v-for="mod in search"
:key="mod.file_name"
class="table-row"
@contextmenu.prevent.stop="(c) => handleRightClick(c, mod)"
>
<div class="table-cell table-text">
<AnimatedLogo v-if="mod.updating" class="btn icon-only updating-indicator"></AnimatedLogo>
<Button
@@ -138,6 +143,12 @@ const props = defineProps({
return {}
},
},
options: {
type: Object,
default() {
return {}
},
},
})
const projects = ref([])
@@ -302,6 +313,18 @@ async function removeMod(mod) {
await remove_project(props.instance.path, mod.path).catch(handleError)
projects.value = projects.value.filter((x) => mod.path !== x.path)
}
const handleRightClick = (event, mod) => {
if (mod.slug && mod.project_type) {
props.options.showMenu(
event,
{
link: `https://modrinth.com/${mod.project_type}/${mod.slug}`,
},
[{ name: 'open_link' }, { name: 'copy_link' }]
)
}
}
</script>
<style scoped lang="scss">