fix: DI nonsense (#4174)

* fix: DI nonsense

* fix: lint

* fix: client try di issue

* fix: injects outside of context

* fix: use .catch

* refactor: convert projects.vue to composition API.

* fix: moderation checklist notif pos change watcher

* fix: lint issues
This commit is contained in:
Cal H.
2025-08-15 19:02:55 +01:00
committed by GitHub
parent 9b5f172170
commit 4ad6daa45c
32 changed files with 318 additions and 323 deletions

View File

@@ -397,7 +397,8 @@ import { useModerationStore } from '~/store/moderation.ts'
import KeybindsModal from './ChecklistKeybindsModal.vue'
import ModpackPermissionsFlow from './ModpackPermissionsFlow.vue'
const { addNotification } = injectNotificationManager()
const notifications = injectNotificationManager()
const { addNotification } = notifications
const keybindsModal = ref<InstanceType<typeof KeybindsModal>>()
@@ -626,6 +627,11 @@ function handleKeybinds(event: KeyboardEvent) {
onMounted(() => {
window.addEventListener('keydown', handleKeybinds)
initializeAllStages()
notifications.setNotificationLocation('left')
})
onUnmounted(() => {
notifications.setNotificationLocation('right')
})
function initializeAllStages() {

View File

@@ -74,12 +74,14 @@
<script setup lang="ts">
import { DownloadIcon, ExternalIcon, SpinnerIcon, XIcon } from '@modrinth/assets'
import { BackupWarning, ButtonStyled, NewModal } from '@modrinth/ui'
import { BackupWarning, ButtonStyled, injectNotificationManager, NewModal } from '@modrinth/ui'
import { ModrinthServersFetchError } from '@modrinth/utils'
import { computed, nextTick, ref } from 'vue'
import type { ModrinthServer } from '~/composables/servers/modrinth-servers.ts'
import { handleError } from '~/composables/servers/modrinth-servers.ts'
import { handleServersError } from '~/composables/servers/modrinth-servers.ts'
const notifications = injectNotificationManager()
const cf = ref(false)
@@ -120,18 +122,19 @@ const handleSubmit = async () => {
hide()
} else {
submitted.value = false
handleError(
handleServersError(
new ModrinthServersFetchError(
'Could not find CurseForge modpack at that URL.',
404,
new Error(`No modpack found at ${url.value}`),
),
notifications,
)
}
} catch (error) {
submitted.value = false
console.error('Error installing:', error)
handleError(error)
handleServersError(error, notifications)
}
}
}