fix: undefined functions/properties across frontend (#4210)

* fix: notification mark as read

* revert: composition API change

* fix: categories

* feat: enable vue/no-undef-properties in 'warn' mode.

* fix: app undefined properties

* revert: ss block

* fix: eslint-disable for [version].vue
This commit is contained in:
Cal H.
2025-08-18 12:46:58 +01:00
committed by GitHub
parent 166d14e7e1
commit 5ffe14f058
22 changed files with 684 additions and 556 deletions

View File

@@ -110,7 +110,7 @@
placeholder="Path to launcher" placeholder="Path to launcher"
@change="setPath" @change="setPath"
/> />
<Button class="r-btn" @click="() => (selectedLauncherPath = '')"> <Button class="r-btn" @click="() => (selectedProfileType.path = '')">
<XIcon /> <XIcon />
</Button> </Button>
</div> </div>

View File

@@ -1,10 +1,14 @@
<template> <template>
<div v-if="!hidden" class="splash-screen dark" :class="{ 'fade-out': doneLoading }"> <div v-if="!hidden" class="splash-screen dark" :class="{ 'fade-out': doneLoading }">
<div v-if="os !== 'MacOS'" class="app-buttons"> <div v-if="os !== 'MacOS'" class="app-buttons">
<button class="btn icon-only transparent" icon-only @click="() => getCurrent().minimize()"> <button
class="btn icon-only transparent"
icon-only
@click="() => getCurrentWindow().minimize()"
>
<MinimizeIcon /> <MinimizeIcon />
</button> </button>
<button class="btn icon-only transparent" @click="() => getCurrent().toggleMaximize()"> <button class="btn icon-only transparent" @click="() => getCurrentWindow().toggleMaximize()">
<MaximizeIcon /> <MaximizeIcon />
</button> </button>
<button class="btn icon-only transparent" @click="handleClose"> <button class="btn icon-only transparent" @click="handleClose">

View File

@@ -173,7 +173,7 @@
<span class="version-info"> <span class="version-info">
for for
<Categories <Categories
:categories="notif.extra_data.version.loaders" :categories="loaderCategories"
:type="notif.extra_data.project.project_type" :type="notif.extra_data.project.project_type"
class="categories" class="categories"
/> />
@@ -340,8 +340,11 @@ import {
ProjectStatusBadge, ProjectStatusBadge,
useRelativeTime, useRelativeTime,
} from '@modrinth/ui' } from '@modrinth/ui'
import { getUserLink, renderString } from '@modrinth/utils'
import { markAsRead } from '~/helpers/platform-notifications'
import { getProjectLink, getVersionLink } from '~/helpers/projects' import { getProjectLink, getVersionLink } from '~/helpers/projects'
import { acceptTeamInvite, removeSelfFromTeam } from '~/helpers/teams'
import ThreadSummary from './thread/ThreadSummary.vue' import ThreadSummary from './thread/ThreadSummary.vue'
@@ -388,6 +391,12 @@ const user = computed(() => props.notification.extra_data.user)
const organization = computed(() => props.notification.extra_data.organization) const organization = computed(() => props.notification.extra_data.organization)
const invitedBy = computed(() => props.notification.extra_data.invited_by) const invitedBy = computed(() => props.notification.extra_data.invited_by)
const loaderCategories = computed(() => {
return tags.value.loaders.filter((loader) => {
return version.value?.loaders?.includes(loader.name)
})
})
const threadLink = computed(() => { const threadLink = computed(() => {
if (report.value) { if (report.value) {
return `/dashboard/report/${report.value.id}` return `/dashboard/report/${report.value.id}`

View File

@@ -113,6 +113,7 @@ import { BoxIcon, SettingsIcon, TransferIcon, XIcon } from '@modrinth/assets'
import { Avatar, Button, Checkbox, CopyCode, Modal } from '@modrinth/ui' import { Avatar, Button, Checkbox, CopyCode, Modal } from '@modrinth/ui'
import { formatProjectType } from '@modrinth/utils' import { formatProjectType } from '@modrinth/utils'
const EDIT_DETAILS = 1 << 2
const modalOpen = ref(null) const modalOpen = ref(null)
const props = defineProps({ const props = defineProps({

View File

@@ -312,7 +312,14 @@ import { computed } from 'vue'
import { UiChartsChart as Chart, UiChartsCompactChart as CompactChart } from '#components' import { UiChartsChart as Chart, UiChartsCompactChart as CompactChart } from '#components'
import PaletteIcon from '~/assets/icons/palette.svg?component' import PaletteIcon from '~/assets/icons/palette.svg?component'
import { analyticsSetToCSVString, intToRgba } from '~/utils/analytics.js' import {
analyticsSetToCSVString,
countryCodeToFlag,
countryCodeToName,
formatPercent,
getDefaultColor,
intToRgba,
} from '~/utils/analytics.js'
const router = useNativeRouter() const router = useNativeRouter()
const theme = useTheme() const theme = useTheme()

View File

@@ -1,8 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { EditIcon, SettingsIcon, TrashIcon } from '@modrinth/assets' import { SettingsIcon } from '@modrinth/assets'
import { import {
ButtonStyled,
commonMessages,
CopyCode, CopyCode,
getDismissableMetadata, getDismissableMetadata,
NOTICE_LEVELS, NOTICE_LEVELS,
@@ -73,7 +71,7 @@ defineProps<{
</TagItem> </TagItem>
</div> </div>
<div class="col-span-2 flex gap-2 md:col-span-1"> <div class="col-span-2 flex gap-2 md:col-span-1">
<ButtonStyled> <!-- <ButtonStyled>
<button @click="() => startEditing(notice)"> <button @click="() => startEditing(notice)">
<EditIcon /> {{ formatMessage(commonMessages.editButton) }} <EditIcon /> {{ formatMessage(commonMessages.editButton) }}
</button> </button>
@@ -82,7 +80,7 @@ defineProps<{
<button @click="() => deleteNotice(notice)"> <button @click="() => deleteNotice(notice)">
<TrashIcon /> {{ formatMessage(commonMessages.deleteLabel) }} <TrashIcon /> {{ formatMessage(commonMessages.deleteLabel) }}
</button> </button>
</ButtonStyled> </ButtonStyled> -->
</div> </div>
</div> </div>
<div class="col-span-full grid"> <div class="col-span-full grid">

View File

@@ -1,4 +1,3 @@
import { injectNotificationManager } from '@modrinth/ui'
import type { Organization, Project, Report, User, Version } from '@modrinth/utils' import type { Organization, Project, Report, User, Version } from '@modrinth/utils'
type Thread = { id: string } type Thread = { id: string }
@@ -156,24 +155,14 @@ function isSimilar(a: PlatformNotification, b: PlatformNotification | undefined)
export async function markAsRead( export async function markAsRead(
ids: string[], ids: string[],
): Promise<(notifications: PlatformNotification[]) => PlatformNotification[]> { ): Promise<(notifications: PlatformNotification[]) => PlatformNotification[]> {
try { await useBaseFetch(`notifications?ids=${JSON.stringify([...new Set(ids)])}`, {
await useBaseFetch(`notifications?ids=${JSON.stringify([...new Set(ids)])}`, { method: 'PATCH',
method: 'PATCH', })
return (notifications: PlatformNotification[]) => {
const newNotifs = notifications ?? []
newNotifs.forEach((n) => {
if (ids.includes(n.id)) n.read = true
}) })
return (notifications: PlatformNotification[]) => { return newNotifs
const newNotifs = notifications ?? []
newNotifs.forEach((n) => {
if (ids.includes(n.id)) n.read = true
})
return newNotifs
}
} catch (err: any) {
const { addNotification } = injectNotificationManager()
addNotification({
title: 'Error marking notification as read',
text: err?.data?.description ?? err,
type: 'error',
})
return () => []
} }
} }

View File

@@ -984,7 +984,7 @@ import NavStackItem from '~/components/ui/NavStackItem.vue'
import NavTabs from '~/components/ui/NavTabs.vue' import NavTabs from '~/components/ui/NavTabs.vue'
import ProjectMemberHeader from '~/components/ui/ProjectMemberHeader.vue' import ProjectMemberHeader from '~/components/ui/ProjectMemberHeader.vue'
import { saveFeatureFlags } from '~/composables/featureFlags.ts' import { saveFeatureFlags } from '~/composables/featureFlags.ts'
import { userCollectProject } from '~/composables/user.js' import { userCollectProject, userFollowProject } from '~/composables/user.js'
import { useModerationStore } from '~/store/moderation.ts' import { useModerationStore } from '~/store/moderation.ts'
import { reportProject } from '~/utils/report-helpers.ts' import { reportProject } from '~/utils/report-helpers.ts'

File diff suppressed because it is too large Load Diff

View File

@@ -202,6 +202,8 @@ import {
import DropArea from '~/components/ui/DropArea.vue' import DropArea from '~/components/ui/DropArea.vue'
import { acceptFileFromProjectType } from '~/helpers/fileUtils.js' import { acceptFileFromProjectType } from '~/helpers/fileUtils.js'
import { isPermission } from '~/utils/permissions.ts'
import { reportVersion } from '~/utils/report-helpers.ts'
const props = defineProps({ const props = defineProps({
project: { project: {

View File

@@ -87,6 +87,7 @@ import { IntlFormatted } from '@vintl/vintl/components'
import { useAuth } from '@/composables/auth.js' import { useAuth } from '@/composables/auth.js'
import { useScopes } from '@/composables/auth/scopes.ts' import { useScopes } from '@/composables/auth/scopes.ts'
import { useBaseFetch } from '@/composables/fetch.js' import { useBaseFetch } from '@/composables/fetch.js'
import { normalizeChildren } from '@/utils/vue-children.ts'
const { addNotification } = injectNotificationManager() const { addNotification } = injectNotificationManager()
const { formatMessage } = useVIntl() const { formatMessage } = useVIntl()

View File

@@ -144,6 +144,7 @@ import { commonMessages, injectNotificationManager } from '@modrinth/ui'
import { IntlFormatted } from '@vintl/vintl/components' import { IntlFormatted } from '@vintl/vintl/components'
import HCaptcha from '@/components/ui/HCaptcha.vue' import HCaptcha from '@/components/ui/HCaptcha.vue'
import { getAuthUrl } from '@/composables/auth.js'
const { addNotification } = injectNotificationManager() const { addNotification } = injectNotificationManager()
const { formatMessage } = useVIntl() const { formatMessage } = useVIntl()

View File

@@ -149,6 +149,7 @@ import { Checkbox, commonMessages, injectNotificationManager } from '@modrinth/u
import { IntlFormatted } from '@vintl/vintl/components' import { IntlFormatted } from '@vintl/vintl/components'
import HCaptcha from '@/components/ui/HCaptcha.vue' import HCaptcha from '@/components/ui/HCaptcha.vue'
import { getAuthUrl } from '@/composables/auth.js'
const { addNotification } = injectNotificationManager() const { addNotification } = injectNotificationManager()
const { formatMessage } = useVIntl() const { formatMessage } = useVIntl()

View File

@@ -52,6 +52,8 @@ import { RightArrowIcon, WavingRinthbot } from '@modrinth/assets'
import { Checkbox, commonMessages } from '@modrinth/ui' import { Checkbox, commonMessages } from '@modrinth/ui'
import { IntlFormatted } from '@vintl/vintl/components' import { IntlFormatted } from '@vintl/vintl/components'
import { normalizeChildren } from '@/utils/vue-children.ts'
const route = useRoute() const route = useRoute()
const { formatMessage } = useVIntl() const { formatMessage } = useVIntl()

View File

@@ -410,6 +410,8 @@ import { isAdmin } from '@modrinth/utils'
import { IntlFormatted } from '@vintl/vintl/components' import { IntlFormatted } from '@vintl/vintl/components'
import UpToDate from 'assets/images/illustrations/up_to_date.svg' import UpToDate from 'assets/images/illustrations/up_to_date.svg'
import { getProjectTypeMessage } from '@/utils/i18n-project-type'
import { normalizeChildren } from '@/utils/vue-children.ts'
import AdPlaceholder from '~/components/ui/AdPlaceholder.vue' import AdPlaceholder from '~/components/ui/AdPlaceholder.vue'
import NavRow from '~/components/ui/NavRow.vue' import NavRow from '~/components/ui/NavRow.vue'
import ProjectCard from '~/components/ui/ProjectCard.vue' import ProjectCard from '~/components/ui/ProjectCard.vue'

View File

@@ -154,7 +154,7 @@ import { formatDate } from '@modrinth/utils'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { computed } from 'vue' import { computed } from 'vue'
import { removeAuthProvider } from '~/composables/auth.js' import { getAuthUrl, removeAuthProvider } from '~/composables/auth.js'
const { addNotification, handleError } = injectNotificationManager() const { addNotification, handleError } = injectNotificationManager()
const auth = await useAuth() const auth = await useAuth()

View File

@@ -89,6 +89,8 @@ import { HeartIcon, ModrinthPlusIcon, SettingsIcon, SparklesIcon, StarIcon } fro
import { injectNotificationManager, PurchaseModal } from '@modrinth/ui' import { injectNotificationManager, PurchaseModal } from '@modrinth/ui'
import { calculateSavings, formatPrice, getCurrency } from '@modrinth/utils' import { calculateSavings, formatPrice, getCurrency } from '@modrinth/utils'
import { useBaseFetch } from '@/composables/fetch.js'
import { isPermission } from '@/utils/permissions.ts'
import { products } from '~/generated/state.json' import { products } from '~/generated/state.json'
const { addNotification } = injectNotificationManager() const { addNotification } = injectNotificationManager()

View File

@@ -648,6 +648,7 @@ import { formatPrice } from '@modrinth/utils'
import { useVIntl } from '@vintl/vintl' import { useVIntl } from '@vintl/vintl'
import { computed } from 'vue' import { computed } from 'vue'
import { useBaseFetch } from '@/composables/fetch.js'
import OptionGroup from '~/components/ui/OptionGroup.vue' import OptionGroup from '~/components/ui/OptionGroup.vue'
import LoaderIcon from '~/components/ui/servers/icons/LoaderIcon.vue' import LoaderIcon from '~/components/ui/servers/icons/LoaderIcon.vue'
import ServerPlanSelector from '~/components/ui/servers/marketing/ServerPlanSelector.vue' import ServerPlanSelector from '~/components/ui/servers/marketing/ServerPlanSelector.vue'

View File

@@ -432,7 +432,7 @@ import SteamIcon from 'assets/icons/auth/sso-steam.svg'
import QrcodeVue from 'qrcode.vue' import QrcodeVue from 'qrcode.vue'
import Modal from '~/components/ui/Modal.vue' import Modal from '~/components/ui/Modal.vue'
import { removeAuthProvider } from '~/composables/auth.js' import { getAuthUrl, removeAuthProvider } from '~/composables/auth.js'
useHead({ useHead({
title: 'Account settings - Modrinth', title: 'Account settings - Modrinth',

View File

@@ -585,12 +585,13 @@ import {
import { calculateSavings, formatPrice, getCurrency } from '@modrinth/utils' import { calculateSavings, formatPrice, getCurrency } from '@modrinth/utils'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { useBaseFetch } from '@/composables/fetch.js'
import ModrinthServersIcon from '~/components/ui/servers/ModrinthServersIcon.vue' import ModrinthServersIcon from '~/components/ui/servers/ModrinthServersIcon.vue'
import ServerListing from '~/components/ui/servers/ServerListing.vue' import ServerListing from '~/components/ui/servers/ServerListing.vue'
import { useServersFetch } from '~/composables/servers/servers-fetch.ts' import { useServersFetch } from '~/composables/servers/servers-fetch.ts'
import { products } from '~/generated/state.json' import { products } from '~/generated/state.json'
const { addNotification } = injectNotificationManager() const { addNotification, handleError } = injectNotificationManager()
definePageMeta({ definePageMeta({
middleware: 'auth', middleware: 'auth',
}) })

View File

@@ -210,6 +210,7 @@ import { formatProjectType } from '@modrinth/utils'
import { defineMessages, useVIntl } from '@vintl/vintl' import { defineMessages, useVIntl } from '@vintl/vintl'
import { IntlFormatted } from '@vintl/vintl/components' import { IntlFormatted } from '@vintl/vintl/components'
import { normalizeChildren } from '@/utils/vue-children.ts'
import MessageBanner from '~/components/ui/MessageBanner.vue' import MessageBanner from '~/components/ui/MessageBanner.vue'
import type { DisplayLocation } from '~/plugins/cosmetics' import type { DisplayLocation } from '~/plugins/cosmetics'
import { isDarkTheme, type Theme } from '~/plugins/theme/index.ts' import { isDarkTheme, type Theme } from '~/plugins/theme/index.ts'

View File

@@ -39,6 +39,7 @@ export const configurationNuxtToAppend = [
], ],
}, },
], ],
'vue/no-undef-properties': 'warn',
}, },
languageOptions: { languageOptions: {
parserOptions: { parserOptions: {