This commit is contained in:
1 parent
ede28e0062
commit
64f2f85607
4 files changed
+49
-43
No files matched your search
@@ -3,7 +3,10 @@ import { HeartIcon, SpinnerIcon } from '@modrinth/assets'
|
||||
import { defineMessages, useVIntl } from '@modrinth/ui'
|
||||
import { onMounted, ref } from 'vue'
|
||||
|
||||
import { type SkinSiteDonationSummary, skinSiteDonationSummary } from '@/helpers/skin-site-api'
|
||||
import {
|
||||
type SkinSitePublicDonationSummary,
|
||||
skinSitePublicDonationSummary,
|
||||
} from '@/helpers/skin-site-api'
|
||||
|
||||
const { formatMessage } = useVIntl()
|
||||
|
||||
@@ -18,13 +21,13 @@ const messages = defineMessages({
|
||||
loading: { id: 'app.skin-site.home.donation.loading', defaultMessage: 'Loading…' },
|
||||
})
|
||||
|
||||
const summary = ref<SkinSiteDonationSummary | null>(null)
|
||||
const summary = ref<SkinSitePublicDonationSummary | null>(null)
|
||||
const loading = ref(true)
|
||||
const failed = ref(false)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const result = await skinSiteDonationSummary()
|
||||
const result = await skinSitePublicDonationSummary()
|
||||
if (result.success) summary.value = result.payload
|
||||
else failed.value = true
|
||||
} catch {
|
||||
|
||||
@@ -4,11 +4,11 @@ import { defineMessages, injectNotificationManager, useVIntl } from '@modrinth/u
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
|
||||
import {
|
||||
skinSiteDownloadCategories,
|
||||
type SkinSiteDownloadCategory,
|
||||
type SkinSiteDownloadItem,
|
||||
skinSiteDownloadList,
|
||||
type SkinSiteDownloadStatus,
|
||||
skinSitePublicDownloadCategories,
|
||||
type SkinSitePublicDownloadCategory,
|
||||
type SkinSitePublicDownloadItem,
|
||||
skinSitePublicDownloadList,
|
||||
type SkinSitePublicDownloadStatus,
|
||||
} from '@/helpers/skin-site-api'
|
||||
|
||||
const { formatMessage } = useVIntl()
|
||||
@@ -36,8 +36,8 @@ const messages = defineMessages({
|
||||
|
||||
const emit = defineEmits<{ (e: 'back'): void }>()
|
||||
|
||||
const items = ref<SkinSiteDownloadItem[]>([])
|
||||
const categories = ref<SkinSiteDownloadCategory[]>([])
|
||||
const items = ref<SkinSitePublicDownloadItem[]>([])
|
||||
const categories = ref<SkinSitePublicDownloadCategory[]>([])
|
||||
const selectedCategory = ref<string | null>(null)
|
||||
const loading = ref(true)
|
||||
const failed = ref(false)
|
||||
@@ -48,7 +48,7 @@ const filtered = computed(() =>
|
||||
: items.value,
|
||||
)
|
||||
|
||||
function statusLabel(status: SkinSiteDownloadStatus): string {
|
||||
function statusLabel(status: SkinSitePublicDownloadStatus): string {
|
||||
switch (status) {
|
||||
case 'NEW':
|
||||
return formatMessage(messages.statusNew)
|
||||
@@ -68,7 +68,7 @@ async function openUrl(url: string) {
|
||||
await open(url)
|
||||
}
|
||||
|
||||
function download(item: SkinSiteDownloadItem) {
|
||||
function download(item: SkinSitePublicDownloadItem) {
|
||||
const route = item.routes?.[0]
|
||||
void openUrl(route?.url ?? item.url)
|
||||
}
|
||||
@@ -78,8 +78,8 @@ async function load() {
|
||||
failed.value = false
|
||||
try {
|
||||
const [listResult, categoryResult] = await Promise.all([
|
||||
skinSiteDownloadList(),
|
||||
skinSiteDownloadCategories(),
|
||||
skinSitePublicDownloadList(),
|
||||
skinSitePublicDownloadCategories(),
|
||||
])
|
||||
if (!listResult.success) throw new Error(listResult.errorMessage)
|
||||
items.value = listResult.payload ?? []
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ExternalIcon, SpinnerIcon } from '@modrinth/assets'
|
||||
import { defineMessages, injectNotificationManager, useVIntl } from '@modrinth/ui'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
|
||||
import { type SkinSiteMapServer, skinSiteMapServers } from '@/helpers/skin-site-api'
|
||||
import { type SkinSitePublicMapServer, skinSitePublicMapServers } from '@/helpers/skin-site-api'
|
||||
|
||||
const { formatMessage } = useVIntl()
|
||||
const { handleError } = injectNotificationManager()
|
||||
@@ -23,7 +23,7 @@ const messages = defineMessages({
|
||||
|
||||
const emit = defineEmits<{ (e: 'back'): void }>()
|
||||
|
||||
const servers = ref<SkinSiteMapServer[]>([])
|
||||
const servers = ref<SkinSitePublicMapServer[]>([])
|
||||
const internal = ref(false)
|
||||
const serverIndex = ref(0)
|
||||
const mapIndex = ref(0)
|
||||
@@ -52,7 +52,7 @@ async function load() {
|
||||
loading.value = true
|
||||
failed.value = false
|
||||
try {
|
||||
const result = await skinSiteMapServers()
|
||||
const result = await skinSitePublicMapServers()
|
||||
if (!result.success) throw new Error(result.errorMessage)
|
||||
servers.value = result.payload ?? []
|
||||
if (!servers.value.some((s) => !s.internal)) internal.value = true
|
||||
|
||||
Reference in new issue
Block a user