Skip to content

Commit

Permalink
Merge branch 'main' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
Animeshdj committed Oct 16, 2024
2 parents fd5934f + 2ee8cf0 commit ab433d7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 30 deletions.
46 changes: 16 additions & 30 deletions app/shows/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,8 @@ const Shows = () => {
const eventImageRef = useRef(null);
const eventTitleRef = useRef(null);

const preloadImage = (src: string) => {
return fetch(src)
.then((res) => {
if (!res.ok) throw new Error(`Failed to load image: ${src}`);
return res.blob();
})
.then(() => {
// Image preloaded successfully
console.log(`Image preloaded: ${src}`);
})
.catch((error) => {
console.error(`Error preloading image: ${error}`);
});
};

const animate = async () => {
const nextID = (eventID + 1) % eventDetails.length;

try {
// Preload the next image before animation
await preloadImage(eventDetails[nextID].image.src);
} catch (error) {
console.error("Failed to preload image", error);
}

// After the image is preloaded, run the GSAP animation
const tl = gsap.timeline();
tl.to(
[
Expand Down Expand Up @@ -204,12 +180,22 @@ const Shows = () => {
{eventDetails[eventID].date}
</div>
</div>
<Image
src={eventDetails[eventID].image}
alt="event image"
className={`${styles.eventImage} ${styles[`eventImage${eventID}`]}`}
ref={eventImageRef}
></Image>
{eventDetails.map((event, index) => (
<div
key={index}
className={styles.eventImageWrapper}
style={{ display: index === eventID ? "block" : "none" }}
>
<Image
src={event.image}
alt={event.name}
className={`${styles.eventImage} ${
styles[`eventImage${eventID}`]
}`}
ref={index === eventID ? eventImageRef : null}
/>
</div>
))}
<div className={styles.eventSelector}>
<svg
width="42"
Expand Down
5 changes: 5 additions & 0 deletions app/shows/profshow.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
mix-blend-mode: difference;
user-select: none;

@media screen and (max-height: 900px) {
font-size: 240px !important;
line-height: 150px !important;
}

@media screen and (max-width: 4000px) {
font-size: 644px;
line-height: 400px;
Expand Down

0 comments on commit ab433d7

Please sign in to comment.