diff --git a/packages/ui/src/components/servers/marketing/MedalServerListing.vue b/packages/ui/src/components/servers/marketing/MedalServerListing.vue index d569f35f7..8ac6731bc 100644 --- a/packages/ui/src/components/servers/marketing/MedalServerListing.vue +++ b/packages/ui/src/components/servers/marketing/MedalServerListing.vue @@ -180,7 +180,7 @@ type MedalServerListingProps = { const props = defineProps() -const emit = defineEmits<{ (e: 'upgrade'): void }>() +const emit = defineEmits<{ (e: 'upgrade', serverId: string): void }>() const { formatMessage } = useVIntl() const client = injectModrinthClient() @@ -257,7 +257,7 @@ const expiryDate = computed(() => (props.medal_expires ? dayjs(props.medal_expir function handleUpgrade(event: Event) { event.stopPropagation() - emit('upgrade') + emit('upgrade', props.server_id) } function navigateToServer(event: MouseEvent | KeyboardEvent) { diff --git a/packages/ui/src/layouts/shared/browse-tab/layout.vue b/packages/ui/src/layouts/shared/browse-tab/layout.vue index 63e3ce4f9..63e84df34 100644 --- a/packages/ui/src/layouts/shared/browse-tab/layout.vue +++ b/packages/ui/src/layouts/shared/browse-tab/layout.vue @@ -251,7 +251,7 @@ const maxResultsOptions = computed[]>(() => -
+
+
| null>(null) const purchaseModal = ref | null>(null) +type UpgradeModalRef = ComponentPublicInstance<{ open: (id?: string) => void | Promise }> +const medalUpgradeModal = ref(null) const resubscribeModal = ref | null>(null) const affiliateCode = ref(null) const selectedCurrency = ref('USD') @@ -691,6 +701,10 @@ provideHostingPurchaseIntent(hostingPurchaseIntent) const { openPurchaseModal, handleGuestPlanContinue, clearPurchaseIntent } = hostingPurchaseIntent +function openMedalUpgradeModal(serverId: string) { + medalUpgradeModal.value?.open(serverId) +} + const { data: subscriptions } = useQuery({ queryKey: ['billing', 'subscriptions'], queryFn: () => client.labrinth.billing_internal.getSubscriptions(), diff --git a/packages/ui/src/utils/server-search.ts b/packages/ui/src/utils/server-search.ts index 6f88f905a..86a4e082b 100644 --- a/packages/ui/src/utils/server-search.ts +++ b/packages/ui/src/utils/server-search.ts @@ -1,7 +1,7 @@ import type { Labrinth } from '@modrinth/api-client' import { getCategoryIcon, GlobeIcon, SERVER_CATEGORY_ICON_MAP, UserIcon } from '@modrinth/assets' import { sortedCategories } from '@modrinth/utils' -import { computed, type Ref, ref } from 'vue' +import { computed, type Ref, ref, shallowRef } from 'vue' import { useRoute } from 'vue-router' import { defineMessage, LOCALES, useVIntl } from '../composables/i18n' @@ -138,7 +138,7 @@ export function useServerSearch(opts: { const route = useRoute() - const serverCurrentSortType = ref(SERVER_SORT_TYPES[0]) + const serverCurrentSortType = shallowRef(SERVER_SORT_TYPES[0]) const serverCurrentFilters = ref([{ type: 'server_status', option: 'online' }]) const serverToggledGroups = ref([])