Skip to content

Commit c882656

Browse files
authored
Merge pull request #32 from ioaiaaii/feat/improve-image-loading
chore(deploy): bump chart appversion
2 parents 2240b8f + 8c28ebc commit c882656

File tree

3 files changed

+28
-25
lines changed

3 files changed

+28
-25
lines changed

deploy/helm/ioaiaaii/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ annotations:
33
licenses: Apache-2.0
44
type: application
55
apiVersion: v2
6-
appVersion: v1.1.1
6+
appVersion: v1.1.2
77
dependencies:
88
- name: common
99
repository: oci://registry-1.docker.io/bitnamicharts

web/src/components/Live.vue

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<template>
22
<div
3-
class="relative w-full overflow-hidden bg-cover bg-center"
4-
:style="{ height: 'calc(var(--vh) * 100)' }"
5-
style="background-image: url('https://storage.googleapis.com/ioaiaaii-website-static-content/assets/images/live/studio_2024_3000_v1.jpg');"
3+
class="relative w-full overflow-hidden bg-cover bg-center transition-opacity duration-700"
4+
:class="{ 'opacity-0': !backgroundLoaded, 'opacity-100': backgroundLoaded }"
5+
:style="backgroundLoaded ? { backgroundImage: `url(${backgroundUrl})`, height: 'calc(var(--vh) * 100)' } : {}"
66
>
7+
<!-- Hidden image to trigger loading -->
8+
<img
9+
:src="backgroundUrl"
10+
@load="backgroundLoaded = true"
11+
class="hidden"
12+
alt="Background"
13+
/>
14+
715
<div class="min-h-12 h-16 sm:h-20 md:h-24 lg:h-28 xl:h-32 max-h-40"></div>
816

917
<div class="relative h-full flex flex-col items-start justify-start p-4">
@@ -45,19 +53,19 @@
4553
</div>
4654
</template>
4755

48-
4956
<script>
5057
export default {
5158
data() {
5259
return {
53-
performances: [], // Holds the fetched performances
60+
performances: [],
61+
backgroundUrl: 'https://storage.googleapis.com/ioaiaaii-website-static-content/assets/images/live/studio_2024_3000_v1.jpg',
62+
backgroundLoaded: false, // Track if background image has loaded
5463
};
5564
},
5665
created() {
5766
this.fetchLive();
5867
},
5968
mounted() {
60-
// Set the viewport height variable for mobile Safari
6169
const setViewportHeight = () => {
6270
document.documentElement.style.setProperty('--vh', `${window.innerHeight * 0.01}px`);
6371
};
@@ -69,15 +77,10 @@ export default {
6977
fetch('/api/v1/live')
7078
.then((response) => response.json())
7179
.then((data) => {
72-
console.log('Fetched data:', data); // Debugging log to confirm data fetching
7380
this.performances = data;
7481
})
7582
.catch((error) => console.error('Error fetching live performances:', error));
7683
},
7784
},
7885
};
7986
</script>
80-
81-
<style scoped>
82-
83-
</style>

web/src/components/Releases.vue

+13-13
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
<div class="relative w-full overflow-hidden">
1111
<div class="flex transition-transform duration-500 ease-in-out"
1212
:style="{ transform: `translateX(-${release.currentImageIndex * 100}%)` }">
13-
<img
14-
v-for="(imgSrc, imgIndex) in release.image"
15-
:key="imgIndex"
16-
:src="imgSrc"
17-
class="w-full object-cover aspect-square lg:h-screen"
18-
loading="lazy"
19-
/>
13+
<img
14+
v-for="(imgSrc, imgIndex) in release.image"
15+
:key="imgIndex"
16+
:src="imgSrc"
17+
:class="{ 'opacity-0': !release.imagesLoaded[imgIndex], 'opacity-100 transition-opacity duration-700': release.imagesLoaded[imgIndex] }"
18+
@load="release.imagesLoaded.splice(imgIndex, 1, true)"
19+
class="w-full object-cover aspect-square lg:h-screen"
20+
loading="lazy"
21+
/>
2022
</div>
2123

2224
<!-- Navigation Controls -->
@@ -26,15 +28,15 @@
2628
class="absolute top-1/2 left-2 transform -translate-y-1/2 text-4xl lg:text-5xl text-gray-400 hover:scale-110 focus:outline-none animate-pulse"
2729
aria-label="Previous image"
2830
>
29-
<
31+
&#9664; <!-- Unicode for left arrow (◀) -->
3032
</button>
3133
<button
3234
v-if="release.image && release.image.length > 1"
3335
@click="nextImage(releaseIndex)"
3436
class="absolute top-1/2 right-2 transform -translate-y-1/2 text-4xl lg:text-5xl text-gray-400 hover:scale-110 focus:outline-none animate-pulse"
3537
aria-label="Next image"
3638
>
37-
>
39+
&#9654; <!-- Unicode for right arrow (▶) -->
3840
</button>
3941
</div>
4042

@@ -78,14 +80,13 @@ export default {
7880
};
7981
},
8082
created() {
81-
// Fetch releases data on component creation
8283
fetch('/api/v1/releases')
8384
.then((response) => response.json())
8485
.then((data) => {
85-
// Initialize each release with a currentImageIndex
8686
this.releases = data.map(release => ({
8787
...release,
88-
currentImageIndex: 0, // Start with the first image
88+
currentImageIndex: 0,
89+
imagesLoaded: Array(release.image.length).fill(false), // Track load state for each image
8990
}));
9091
})
9192
.catch((error) => console.error('Error fetching releases:', error));
@@ -111,5 +112,4 @@ export default {
111112
</script>
112113

113114
<style scoped>
114-
/* No additional custom styles required, as Tailwind classes handle the transition */
115115
</style>

0 commit comments

Comments
 (0)