mirror of
https://github.com/modrinth/code.git
synced 2026-08-26 17:44:50 +00:00
chore: reduce frontend server memory & tracing (#7014)
* chore: reduce memory usage * feat: worker tracing * fix: eslint * fix: remove compat flag * fix: prettier
This commit is contained in:
@@ -96,7 +96,7 @@ import {
|
||||
import { capitalizeString } from '@modrinth/utils'
|
||||
import { Tooltip } from 'floating-vue'
|
||||
|
||||
import { useGeneratedState } from '~/composables/generated'
|
||||
import { tremendousIdMap } from '~/generated/state.json'
|
||||
import { findRail } from '~/utils/muralpay-rails'
|
||||
|
||||
type Transaction = Labrinth.Payout.v3.TransactionItem
|
||||
@@ -110,7 +110,6 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const { addNotification } = injectNotificationManager()
|
||||
const generatedState = useGeneratedState()
|
||||
|
||||
const isIncome = computed(() => props.transaction.type === 'payout_available')
|
||||
|
||||
@@ -120,7 +119,7 @@ const methodIconUrl = computed(() => {
|
||||
const methodId = props.transaction.method_id
|
||||
|
||||
if (method === 'tremendous' && methodId) {
|
||||
const methodInfo = generatedState.value.tremendousIdMap?.[methodId]
|
||||
const methodInfo = tremendousIdMap?.[methodId]
|
||||
if (methodInfo?.name?.toLowerCase()?.includes('paypal')) return null
|
||||
return methodInfo?.image_url ?? null
|
||||
}
|
||||
@@ -137,7 +136,7 @@ const methodIconComponent = computed(() => {
|
||||
case 'tremendous': {
|
||||
const methodId = props.transaction.method_id
|
||||
if (methodId) {
|
||||
const info = generatedState.value.tremendousIdMap?.[methodId]
|
||||
const info = tremendousIdMap?.[methodId]
|
||||
if (info?.name?.toLowerCase()?.includes('paypal')) {
|
||||
return PayPalColorIcon
|
||||
}
|
||||
@@ -187,7 +186,7 @@ function formatMethodName(method: string | undefined, method_id: string | undefi
|
||||
return 'Venmo'
|
||||
case 'tremendous':
|
||||
if (method_id) {
|
||||
const info = generatedState.value.tremendousIdMap?.[method_id]
|
||||
const info = tremendousIdMap?.[method_id]
|
||||
if (info) return `${info.name}`
|
||||
}
|
||||
return 'Tremendous'
|
||||
|
||||
@@ -248,13 +248,12 @@ import { computed, ref, watch } from 'vue'
|
||||
|
||||
import RevenueInputField from '@/components/ui/dashboard/RevenueInputField.vue'
|
||||
import WithdrawFeeBreakdown from '@/components/ui/dashboard/WithdrawFeeBreakdown.vue'
|
||||
import { useGeneratedState } from '@/composables/generated'
|
||||
import { useWithdrawContext } from '@/providers/creator-withdraw.ts'
|
||||
import { getRailConfig } from '@/utils/muralpay-rails'
|
||||
import { muralBankDetails } from '~/generated/state.json'
|
||||
|
||||
const { withdrawData, maxWithdrawAmount, availableMethods, calculateFees } = useWithdrawContext()
|
||||
const { formatMessage } = useVIntl()
|
||||
const generatedState = useGeneratedState()
|
||||
|
||||
const selectedRail = computed(() => {
|
||||
const railId = withdrawData.value.selection.method
|
||||
@@ -285,7 +284,7 @@ const availableBankNames = computed(() => {
|
||||
const rail = selectedRail.value
|
||||
if (!rail || !rail.railCode) return []
|
||||
|
||||
const bankDetails = generatedState.value.muralBankDetails?.[rail.railCode]
|
||||
const bankDetails = muralBankDetails?.[rail.railCode as keyof typeof muralBankDetails]
|
||||
return bankDetails?.bankNames || []
|
||||
})
|
||||
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
ref="wrapperRef"
|
||||
:stripe-publishable-key="config.public.stripePublishableKey"
|
||||
:site-url="config.public.siteUrl"
|
||||
:products="generatedState.products || []"
|
||||
:products="(products ?? []) as Labrinth.Billing.Internal.Product[]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Labrinth } from '@modrinth/api-client'
|
||||
// TODO: Remove this wrapper when we figure out how to do cross platform state + stripe
|
||||
import { ServersUpgradeModalWrapper as ServersUpgradeModalWrapperBase } from '@modrinth/ui'
|
||||
|
||||
import { useGeneratedState } from '~/composables/generated'
|
||||
import { products } from '~/generated/state.json'
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const generatedState = useGeneratedState()
|
||||
|
||||
const wrapperRef = ref<InstanceType<typeof ServersUpgradeModalWrapperBase> | null>(null)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user