forked from modrinth/code
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from DIDIRUS4/feature-0
- Loading branch information
Showing
12 changed files
with
464 additions
and
344 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,70 @@ | ||
<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, get } from '@/helpers/profile.js' | ||
import { handleError } from '@/store/notifications.js' | ||
import { useRouter } from 'vue-router' | ||
import { i18n } from '@/main.js' | ||
const t = i18n.global.t | ||
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, 'mod').catch(handleError) | ||
} | ||
props.instance.initProjects(await get(props.instance.path).catch(handleError)) | ||
} | ||
const handleSearchContent = async () => { | ||
await router.push({ | ||
path: `/browse/${props.instance.metadata.loader === 'vanilla' ? 'datapack' : 'mod'}`, | ||
query: { i: props.instance.path }, | ||
}) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="joined-buttons"> | ||
<Button color="primary" @click="handleSearchContent" | ||
><SearchIcon /> {{ t('Instance.Mods.AddContent') }} | ||
</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"> {{t('Instance.Mods.Search')}} </span> | ||
</template> | ||
<template #from_file> | ||
<FolderOpenIcon /> | ||
<span class="no-wrap"> {{ t('Instance.Mods.AddFile') }} </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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,18 +3,19 @@ | |
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"web:build": "turbo run build --filter=@modrinth/frontend", | ||
"pages:build": "NITRO_PRESET=cloudflare-pages pnpm --filter frontend run build", | ||
"web:dev": "turbo run dev --filter=@modrinth/frontend", | ||
"web:build": "turbo run build --filter=@modrinth/frontend", | ||
"app:dev": "turbo run dev --filter=@modrinth/app", | ||
"app:build": "turbo run build --filter=@modrinth/app", | ||
"pages:build": "NITRO_PRESET=cloudflare-pages pnpm --filter frontend run build", | ||
"build": "turbo run build --continue", | ||
"lint": "turbo run lint --continue", | ||
"test": "turbo run test --continue" | ||
}, | ||
"devDependencies": { | ||
"prettier": "^3.3.2", | ||
"turbo": "^2.0.6", | ||
"vue": "^3.4.31" | ||
"prettier": "^3.3.3", | ||
"turbo": "^2.0.7", | ||
"vue": "^3.4.32" | ||
}, | ||
"packageManager": "[email protected]", | ||
"pnpm": { | ||
|
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.