fix placeholder images to use CDN url
This commit is contained in:
parent
42f7722e50
commit
b2f4cf5246
4 changed files with 10 additions and 18 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Icon from '$lib/components/Icon.svelte'
|
import Icon from '$lib/components/Icon.svelte'
|
||||||
|
import { getPlaceholderImage } from '$lib/utils/images'
|
||||||
|
|
||||||
export interface EntityTab {
|
export interface EntityTab {
|
||||||
wikiPage: string
|
wikiPage: string
|
||||||
|
|
@ -22,16 +23,7 @@
|
||||||
let { entities, selectedWikiPage, onSelect, entityType }: Props = $props()
|
let { entities, selectedWikiPage, onSelect, entityType }: Props = $props()
|
||||||
|
|
||||||
// Get placeholder image based on entity type
|
// Get placeholder image based on entity type
|
||||||
const placeholderImage = $derived(() => {
|
const placeholderImage = $derived(getPlaceholderImage(entityType, 'square'))
|
||||||
switch (entityType) {
|
|
||||||
case 'character':
|
|
||||||
return '/images/placeholders/placeholder-character-square.png'
|
|
||||||
case 'weapon':
|
|
||||||
return '/images/placeholders/placeholder-weapon-square.png'
|
|
||||||
case 'summon':
|
|
||||||
return '/images/placeholders/placeholder-summon-square.png'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="entity-selector">
|
<div class="entity-selector">
|
||||||
|
|
@ -48,7 +40,7 @@
|
||||||
disabled={entity.saved}
|
disabled={entity.saved}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src={entity.granblueId ? entity.imageUrl : placeholderImage()}
|
src={entity.granblueId ? entity.imageUrl : placeholderImage}
|
||||||
alt={entity.wikiPage}
|
alt={entity.wikiPage}
|
||||||
class="entity-image"
|
class="entity-image"
|
||||||
class:placeholder={!entity.granblueId}
|
class:placeholder={!entity.granblueId}
|
||||||
|
|
@ -60,7 +52,7 @@
|
||||||
</span>
|
</span>
|
||||||
{:else if entity.status === 'error'}
|
{:else if entity.status === 'error'}
|
||||||
<span class="status-overlay error">
|
<span class="status-overlay error">
|
||||||
<Icon name="alert-circle" size={20} />
|
<Icon name="close" size={20} />
|
||||||
</span>
|
</span>
|
||||||
{:else if entity.saved}
|
{:else if entity.saved}
|
||||||
<span class="status-overlay saved">
|
<span class="status-overlay saved">
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { entityAdapter, type CharacterSuggestions } from '$lib/api/adapters/entity.adapter'
|
import { entityAdapter, type CharacterSuggestions } from '$lib/api/adapters/entity.adapter'
|
||||||
import { getCharacterImage } from '$lib/utils/images'
|
import { getCharacterImage, getPlaceholderImage } from '$lib/utils/images'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import CharacterUncapSection from '$lib/features/database/characters/sections/CharacterUncapSection.svelte'
|
import CharacterUncapSection from '$lib/features/database/characters/sections/CharacterUncapSection.svelte'
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
status: entity.status,
|
status: entity.status,
|
||||||
imageUrl: entity.granblueId
|
imageUrl: entity.granblueId
|
||||||
? getCharacterImage(entity.granblueId, 'square')
|
? getCharacterImage(entity.granblueId, 'square')
|
||||||
: '/images/placeholders/placeholder-character-square.png',
|
: getPlaceholderImage('character', 'square'),
|
||||||
error: entity.error,
|
error: entity.error,
|
||||||
saved: savedEntities.has(wikiPage)
|
saved: savedEntities.has(wikiPage)
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { entityAdapter, type SummonSuggestions } from '$lib/api/adapters/entity.adapter'
|
import { entityAdapter, type SummonSuggestions } from '$lib/api/adapters/entity.adapter'
|
||||||
import { getSummonImage } from '$lib/utils/images'
|
import { getSummonImage, getPlaceholderImage } from '$lib/utils/images'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import SummonUncapSection from '$lib/features/database/summons/sections/SummonUncapSection.svelte'
|
import SummonUncapSection from '$lib/features/database/summons/sections/SummonUncapSection.svelte'
|
||||||
|
|
@ -80,7 +80,7 @@
|
||||||
status: entity.status,
|
status: entity.status,
|
||||||
imageUrl: entity.granblueId
|
imageUrl: entity.granblueId
|
||||||
? getSummonImage(entity.granblueId, 'square')
|
? getSummonImage(entity.granblueId, 'square')
|
||||||
: '/images/placeholders/placeholder-summon-square.png',
|
: getPlaceholderImage('summon', 'square'),
|
||||||
error: entity.error,
|
error: entity.error,
|
||||||
saved: savedEntities.has(wikiPage)
|
saved: savedEntities.has(wikiPage)
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { entityAdapter, type WeaponSuggestions } from '$lib/api/adapters/entity.adapter'
|
import { entityAdapter, type WeaponSuggestions } from '$lib/api/adapters/entity.adapter'
|
||||||
import { getWeaponImage } from '$lib/utils/images'
|
import { getWeaponImage, getPlaceholderImage } from '$lib/utils/images'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import WeaponUncapSection from '$lib/features/database/weapons/sections/WeaponUncapSection.svelte'
|
import WeaponUncapSection from '$lib/features/database/weapons/sections/WeaponUncapSection.svelte'
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
status: entity.status,
|
status: entity.status,
|
||||||
imageUrl: entity.granblueId
|
imageUrl: entity.granblueId
|
||||||
? getWeaponImage(entity.granblueId, 'square')
|
? getWeaponImage(entity.granblueId, 'square')
|
||||||
: '/images/placeholders/placeholder-weapon-square.png',
|
: getPlaceholderImage('weapon', 'square'),
|
||||||
error: entity.error,
|
error: entity.error,
|
||||||
saved: savedEntities.has(wikiPage)
|
saved: savedEntities.has(wikiPage)
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue