fix image paths for production (use AWS URLs)
This commit is contained in:
parent
60cbc03edf
commit
e5dec76a84
5 changed files with 31 additions and 13 deletions
|
|
@ -15,7 +15,7 @@
|
||||||
import { useDeleteCollectionArtifact } from '$lib/api/mutations/artifact.mutations'
|
import { useDeleteCollectionArtifact } from '$lib/api/mutations/artifact.mutations'
|
||||||
import { usePaneStack, type PaneConfig, type ElementType } from '$lib/stores/paneStack.svelte'
|
import { usePaneStack, type PaneConfig, type ElementType } from '$lib/stores/paneStack.svelte'
|
||||||
import { sidebar } from '$lib/stores/sidebar.svelte'
|
import { sidebar } from '$lib/stores/sidebar.svelte'
|
||||||
import { getArtifactImage } from '$lib/utils/images'
|
import { getArtifactImage, getBasePath } from '$lib/utils/images'
|
||||||
import DetailsSection from '$lib/components/sidebar/details/DetailsSection.svelte'
|
import DetailsSection from '$lib/components/sidebar/details/DetailsSection.svelte'
|
||||||
import DetailRow from '$lib/components/sidebar/details/DetailRow.svelte'
|
import DetailRow from '$lib/components/sidebar/details/DetailRow.svelte'
|
||||||
import ElementLabel from '$lib/components/labels/ElementLabel.svelte'
|
import ElementLabel from '$lib/components/labels/ElementLabel.svelte'
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
// Wide image for header
|
// Wide image for header
|
||||||
const wideImageUrl = $derived(getArtifactImage(artifact.artifact?.granblueId, 'wide'))
|
const wideImageUrl = $derived(getArtifactImage(artifact.artifact?.granblueId, 'wide'))
|
||||||
|
const reliefBackgroundUrl = `${getBasePath()}/relief.png`
|
||||||
|
|
||||||
// Artifact properties
|
// Artifact properties
|
||||||
const isQuirk = $derived(isQuirkArtifact(artifact.artifact))
|
const isQuirk = $derived(isQuirkArtifact(artifact.artifact))
|
||||||
|
|
@ -125,7 +126,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="artifact-detail-pane">
|
<div class="artifact-detail-pane">
|
||||||
<div class="artifact-header">
|
<div class="artifact-header" style:background="url({reliefBackgroundUrl}), linear-gradient(to right, #000, #484440, #000)">
|
||||||
<img src={wideImageUrl} alt="" class="artifact-image" />
|
<img src={wideImageUrl} alt="" class="artifact-image" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -189,7 +190,6 @@
|
||||||
min-height: 120px;
|
min-height: 120px;
|
||||||
margin: 0 $unit-2x;
|
margin: 0 $unit-2x;
|
||||||
border-radius: $card-corner;
|
border-radius: $card-corner;
|
||||||
background: url('/images/relief.png'), linear-gradient(to right, #000, #484440, #000);
|
|
||||||
background-size: 420px 731px;
|
background-size: 420px 731px;
|
||||||
background-position: -20px -20px;
|
background-position: -20px -20px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
isSkillSlotAvailable,
|
isSkillSlotAvailable,
|
||||||
isSkillSlotLocked
|
isSkillSlotLocked
|
||||||
} from '$lib/utils/jobUtils'
|
} from '$lib/utils/jobUtils'
|
||||||
import { getAccessoryImage } from '$lib/utils/images'
|
import { getAccessoryImage, getBasePath } from '$lib/utils/images'
|
||||||
import Icon from '$lib/components/Icon.svelte'
|
import Icon from '$lib/components/Icon.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
const slotCount = $derived(getJobSkillSlotCount(job))
|
const slotCount = $derived(getJobSkillSlotCount(job))
|
||||||
const jobIconUrl = $derived(job ? getJobIconUrl(job.granblueId) : '')
|
const jobIconUrl = $derived(job ? getJobIconUrl(job.granblueId) : '')
|
||||||
const jobImageUrl = $derived(job ? getJobFullImageUrl(job, gender) : '')
|
const jobImageUrl = $derived(job ? getJobFullImageUrl(job, gender) : '')
|
||||||
|
const jobBackgroundUrl = `${getBasePath()}/background_a.jpg`
|
||||||
|
|
||||||
function handleSelectSkill(slot: number) {
|
function handleSelectSkill(slot: number) {
|
||||||
if (onSelectSkill) {
|
if (onSelectSkill) {
|
||||||
|
|
@ -57,7 +58,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="job-section">
|
<div class="job-section">
|
||||||
<div class="job-image-container">
|
<div class="job-image-container" style:background-image="url({jobBackgroundUrl})">
|
||||||
{#if job}
|
{#if job}
|
||||||
<img class="job-portrait" src={jobImageUrl} alt={job.name.en} />
|
<img class="job-portrait" src={jobImageUrl} alt={job.name.en} />
|
||||||
<div class="overlay"></div>
|
<div class="overlay"></div>
|
||||||
|
|
@ -205,7 +206,6 @@
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
height: 252px;
|
height: 252px;
|
||||||
aspect-ratio: 7/4;
|
aspect-ratio: 7/4;
|
||||||
background: url('/images/background_a.jpg');
|
|
||||||
background-size: 500px 281px;
|
background-size: 500px 281px;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
border-radius: layout.$item-corner;
|
border-radius: layout.$item-corner;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@
|
||||||
getCharacterDetailImage,
|
getCharacterDetailImage,
|
||||||
getWeaponBaseImage,
|
getWeaponBaseImage,
|
||||||
getSummonDetailImage,
|
getSummonDetailImage,
|
||||||
getCharacterPose
|
getCharacterPose,
|
||||||
|
getBasePath
|
||||||
} from '$lib/utils/images'
|
} from '$lib/utils/images'
|
||||||
import UncapIndicator from '$lib/components/uncap/UncapIndicator.svelte'
|
import UncapIndicator from '$lib/components/uncap/UncapIndicator.svelte'
|
||||||
|
|
||||||
|
|
@ -65,10 +66,12 @@
|
||||||
|
|
||||||
// Special characters have different star counts (SR characters, etc.)
|
// Special characters have different star counts (SR characters, etc.)
|
||||||
const special = $derived(type === 'character' && (itemData?.rarity ?? 3) < 3)
|
const special = $derived(type === 'character' && (itemData?.rarity ?? 3) < 3)
|
||||||
|
|
||||||
|
const reliefBackgroundUrl = `${getBasePath()}/relief.png`
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="item-header-container">
|
<div class="item-header-container">
|
||||||
<div class="item-header">
|
<div class="item-header" style:background="url({reliefBackgroundUrl}), linear-gradient(to right, #000, #484440, #000)">
|
||||||
<div class="uncap-overlay">
|
<div class="uncap-overlay">
|
||||||
<UncapIndicator
|
<UncapIndicator
|
||||||
{type}
|
{type}
|
||||||
|
|
@ -99,7 +102,6 @@
|
||||||
border-radius: layout.$card-corner;
|
border-radius: layout.$card-corner;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: url('/images/relief.png'), linear-gradient(to right, #000, #484440, #000);
|
|
||||||
background-size: 420px 731px;
|
background-size: 420px 731px;
|
||||||
background-position: -20px -20px;
|
background-position: -20px -20px;
|
||||||
transition: background 0.3s ease;
|
transition: background 0.3s ease;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Checkbox from '$lib/components/ui/checkbox/Checkbox.svelte'
|
import Checkbox from '$lib/components/ui/checkbox/Checkbox.svelte'
|
||||||
|
import { getBasePath } from '$lib/utils/images'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
/** Whether perpetuity is enabled */
|
/** Whether perpetuity is enabled */
|
||||||
|
|
@ -16,6 +17,8 @@
|
||||||
|
|
||||||
let localValue = $state(value)
|
let localValue = $state(value)
|
||||||
|
|
||||||
|
const perpetuityImageUrl = `${getBasePath()}/perpetuity.png`
|
||||||
|
|
||||||
function handleChange(checked: boolean) {
|
function handleChange(checked: boolean) {
|
||||||
localValue = checked
|
localValue = checked
|
||||||
onChange?.(checked)
|
onChange?.(checked)
|
||||||
|
|
@ -32,7 +35,7 @@
|
||||||
/>
|
/>
|
||||||
<div class="toggle-content">
|
<div class="toggle-content">
|
||||||
<img
|
<img
|
||||||
src="/images/perpetuity.png"
|
src={perpetuityImageUrl}
|
||||||
alt="Perpetuity Ring"
|
alt="Perpetuity Ring"
|
||||||
class="perpetuity-icon"
|
class="perpetuity-icon"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { getImageBaseUrl } from '$lib/api/adapters/config'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures a filename has a .png extension
|
* Ensures a filename has a .png extension
|
||||||
*/
|
*/
|
||||||
|
|
@ -12,11 +14,21 @@ export function to2x(name: string): string {
|
||||||
return /\.png$/i.test(name) ? name.replace(/\.png$/i, '@2x.png') : `${name}@2x.png`
|
return /\.png$/i.test(name) ? name.replace(/\.png$/i, '@2x.png') : `${name}@2x.png`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the base path for profile images
|
||||||
|
* Uses AWS URL in production, local /profile path in development
|
||||||
|
*/
|
||||||
|
function getProfileBasePath(): string {
|
||||||
|
const remoteUrl = getImageBaseUrl()
|
||||||
|
return remoteUrl ? `${remoteUrl}/profile` : '/profile'
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the avatar source path
|
* Gets the avatar source path
|
||||||
*/
|
*/
|
||||||
export function getAvatarSrc(avatarFile: string | undefined | null): string {
|
export function getAvatarSrc(avatarFile: string | undefined | null): string {
|
||||||
return avatarFile ? `/profile/${ensurePng(avatarFile)}` : ''
|
if (!avatarFile) return ''
|
||||||
|
return `${getProfileBasePath()}/${ensurePng(avatarFile)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -24,6 +36,7 @@ export function getAvatarSrc(avatarFile: string | undefined | null): string {
|
||||||
*/
|
*/
|
||||||
export function getAvatarSrcSet(avatarFile: string | undefined | null): string {
|
export function getAvatarSrcSet(avatarFile: string | undefined | null): string {
|
||||||
if (!avatarFile) return ''
|
if (!avatarFile) return ''
|
||||||
const src = `/profile/${ensurePng(avatarFile)}`
|
const basePath = getProfileBasePath()
|
||||||
return `${src} 1x, /profile/${to2x(avatarFile)} 2x`
|
const src = `${basePath}/${ensurePng(avatarFile)}`
|
||||||
|
return `${src} 1x, ${basePath}/${to2x(avatarFile)} 2x`
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue