You've already forked pages
forked from didirus/AstralRinth
* refactor: migrate to common eslint+prettier configs * fix: prettier frontend * feat: config changes * fix: lint issues * fix: lint * fix: type imports * fix: cyclical import issue * fix: lockfile * fix: missing dep * fix: switch to tabs * fix: continue switch to tabs * fix: rustfmt parity * fix: moderation lint issue * fix: lint issues * fix: ui intl * fix: lint issues * Revert "fix: rustfmt parity" This reverts commit cb99d2376c321d813d4b7fc7e2a213bb30a54711. * feat: revert last rs
63 lines
1.4 KiB
Vue
63 lines
1.4 KiB
Vue
<script setup lang="ts">
|
|
import { DropdownIcon, FolderOpenIcon, PlusIcon } from '@modrinth/assets'
|
|
import { ButtonStyled, injectNotificationManager, OverflowMenu } from '@modrinth/ui'
|
|
import { open } from '@tauri-apps/plugin-dialog'
|
|
import { useRouter } from 'vue-router'
|
|
|
|
import { add_project_from_path } from '@/helpers/profile.js'
|
|
|
|
const { handleError } = injectNotificationManager()
|
|
|
|
const props = defineProps({
|
|
instance: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
})
|
|
|
|
const router = useRouter()
|
|
|
|
const handleAddContentFromFile = async () => {
|
|
const newProject = await open({ multiple: true })
|
|
if (!newProject) return
|
|
|
|
for (const project of newProject) {
|
|
await add_project_from_path(props.instance.path, project.path ?? project).catch(handleError)
|
|
}
|
|
}
|
|
|
|
const handleSearchContent = async () => {
|
|
await router.push({
|
|
path: `/browse/${props.instance.loader === 'vanilla' ? 'resourcepack' : 'mod'}`,
|
|
query: { i: props.instance.path },
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="joined-buttons">
|
|
<ButtonStyled>
|
|
<button @click="handleSearchContent">
|
|
<PlusIcon />
|
|
Install content
|
|
</button>
|
|
</ButtonStyled>
|
|
<ButtonStyled>
|
|
<OverflowMenu
|
|
:options="[
|
|
{
|
|
id: 'from_file',
|
|
action: handleAddContentFromFile,
|
|
},
|
|
]"
|
|
>
|
|
<DropdownIcon />
|
|
<template #from_file>
|
|
<FolderOpenIcon />
|
|
<span class="no-wrap"> Add from file </span>
|
|
</template>
|
|
</OverflowMenu>
|
|
</ButtonStyled>
|
|
</div>
|
|
</template>
|