|
1 | 1 | <script lang="ts"> |
2 | 2 | import type { TopVaults } from '$lib/top-vaults/schemas'; |
3 | 3 | import { fetchAllVaultData, hasVaultCache } from '$lib/top-vaults/client-cache'; |
4 | | - import { isManuallyMappedUnknownProtocolSlug, isUnsupportedProtocolSlug } from '$lib/top-vaults/helpers'; |
| 4 | + import { isUnknownVaultProtocol, UNKNOWN_VAULT_PROTOCOL_SLUG } from '$lib/top-vaults/helpers'; |
5 | 5 | import { getVaultProtocolLogoUrl } from '$lib/vault-protocol/helpers.js'; |
6 | 6 | import { resolve } from '$app/paths'; |
7 | 7 | import { page } from '$app/state'; |
|
12 | 12 |
|
13 | 13 | let { data } = $props(); |
14 | 14 | let { protocolSlug, protocolName, protocolMetadata, core3 } = $derived(data); |
15 | | - let isUnknownVaultProtocol = $derived(isManuallyMappedUnknownProtocolSlug(protocolSlug)); |
| 15 | + let isUnknownVaultProtocolGroup = $derived(protocolSlug === UNKNOWN_VAULT_PROTOCOL_SLUG); |
16 | 16 |
|
17 | 17 | let topVaults = $state<TopVaults>(); |
18 | 18 | let loading = $state(!hasVaultCache(page.data.generatedAt)); |
|
22 | 22 | .then((allData) => { |
23 | 23 | topVaults = { |
24 | 24 | ...allData, |
25 | | - vaults: allData.vaults.filter((v) => v.protocol_slug === protocolSlug) |
| 25 | + vaults: allData.vaults.filter((vault) => |
| 26 | + isUnknownVaultProtocolGroup ? isUnknownVaultProtocol(vault) : vault.protocol_slug === protocolSlug |
| 27 | + ) |
26 | 28 | }; |
27 | 29 | }) |
28 | 30 | .catch((e) => console.error('Failed to load vault data:', e)) |
|
31 | 33 |
|
32 | 34 | const unknownVaultDescription = 'These vaults are not yet mapped out. Contact us to have your vaults listed.'; |
33 | 35 |
|
34 | | - let title = $derived(isUnknownVaultProtocol ? 'Unknown vaults' : `${protocolName} vaults and yields`); |
35 | | - let heroTitle = $derived(isUnknownVaultProtocol ? 'Unknown vaults' : `${protocolName} powered stablecoin vaults`); |
| 36 | + let title = $derived(isUnknownVaultProtocolGroup ? 'Unknown vaults' : `${protocolName} vaults and yields`); |
| 37 | + let heroTitle = $derived( |
| 38 | + isUnknownVaultProtocolGroup ? 'Unknown vaults' : `${protocolName} powered stablecoin vaults` |
| 39 | + ); |
36 | 40 | let description = $derived( |
37 | | - isUnknownVaultProtocol |
| 41 | + isUnknownVaultProtocolGroup |
38 | 42 | ? unknownVaultDescription |
39 | 43 | : (protocolMetadata?.short_description ?? `Top stablecoin vaults on ${protocolName}`) |
40 | 44 | ); |
|
92 | 96 | {loading} |
93 | 97 | {protocolMetadata} |
94 | 98 | title={heroTitle} |
95 | | - subtitle={isUnknownVaultProtocol ? unknownVaultSubtitle : undefined} |
| 99 | + subtitle={isUnknownVaultProtocolGroup ? unknownVaultSubtitle : undefined} |
96 | 100 | showFilters |
97 | 101 | showUnknownFilter={false} |
98 | 102 | defaultTvlKey="10k" |
99 | | - defaultHideUnknown={isUnsupportedProtocolSlug(protocolSlug) ? 0 : 1} |
| 103 | + defaultHideUnknown={isUnknownVaultProtocolGroup ? 0 : 1} |
100 | 104 | > |
101 | 105 | {#snippet detailAside()} |
102 | 106 | <VaultGroupMiniChart |
|
0 commit comments