-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
144 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<script setup lang="ts"> | ||
import { DropdownIcon, FolderOpenIcon, SearchIcon } from '@modrinth/assets' | ||
import { Button, OverflowMenu } from '@modrinth/ui' | ||
import { open } from '@tauri-apps/api/dialog' | ||
import { add_project_from_path } from '@/helpers/profile.js' | ||
import { handleError } from '@/store/notifications.js' | ||
import { useRouter } from 'vue-router' | ||
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).catch(handleError) | ||
} | ||
} | ||
const handleSearchContent = async () => { | ||
await router.push({ | ||
path: `/browse/${props.instance.loader === 'vanilla' ? 'datapack' : 'mod'}`, | ||
query: { i: props.instance.path }, | ||
}) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="joined-buttons"> | ||
<Button color="primary" @click="handleSearchContent"><SearchIcon /> Add content </Button> | ||
|
||
<OverflowMenu | ||
:options="[ | ||
{ | ||
id: 'search', | ||
action: () => handleSearchContent, | ||
}, | ||
{ | ||
id: 'from_file', | ||
action: () => handleAddContentFromFile, | ||
}, | ||
]" | ||
class="btn btn-primary btn-dropdown-animation icon-only" | ||
> | ||
<DropdownIcon /> | ||
<template #search> | ||
<SearchIcon /> | ||
<span class="no-wrap"> Search </span> | ||
</template> | ||
<template #from_file> | ||
<FolderOpenIcon /> | ||
<span class="no-wrap"> Add from file </span> | ||
</template> | ||
</OverflowMenu> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.