@@ -6,12 +6,39 @@ import heroVideoPoster from '../assets/video/hero-video-poster.svg';
66import cyberBrutalLogo from '../assets/logo/cyber-brutal-logo.svg' ;
77import cyberDistrictMap from '../assets/map/cyber-district-map.svg' ;
88
9+ // Import gallery images
10+ import futuristicTechnology from '../assets/gallery/futuristic-technology.png' ;
11+ import cyberArchitecture from '../assets/gallery/cyber-architecture.png' ;
12+ import neonLightsCity from '../assets/gallery/neon-lights-city.png' ;
13+ import digitalArtAbstract from '../assets/gallery/digital-art-abstract.png' ;
14+ import cyberpunkAesthetic from '../assets/gallery/cyberpunk-aesthetic.png' ;
15+ import holographicDisplay from '../assets/gallery/holographic-display.png' ;
16+
17+ // Utility function to convert snake_case/kebab-case to camelCase
18+ const toCamelCase = ( str : string ) : string => {
19+ return str
20+ . toLowerCase ( )
21+ . replace ( / [ ^ a - z A - Z 0 - 9 ] + ( .) / g, ( _ , chr ) => chr . toUpperCase ( ) ) ;
22+ } ;
23+
924// Image and video utility functions for handling placeholders and fallbacks
1025
1126export const getGalleryImagePath = ( query : string ) : string => {
12- // Convert query to filename format
13- const filename = query . replace ( / \s + / g, '-' ) . toLowerCase ( ) ;
14- return `/src/assets/gallery/${ filename } .png` ;
27+ // Convert query to camelCase and dynamically access the imported image
28+ const camelCaseQuery = toCamelCase ( query ) ;
29+
30+ // Create an object with all imported images for dynamic access
31+ const images = {
32+ futuristicTechnology,
33+ cyberArchitecture,
34+ neonLightsCity,
35+ digitalArtAbstract,
36+ cyberpunkAesthetic,
37+ holographicDisplay,
38+ } ;
39+
40+ // Dynamically access the image using the camelCase key
41+ return ( images as any ) [ camelCaseQuery ] || futuristicTechnology ; // fallback to first image
1542} ;
1643
1744export const getMapImagePath = ( ) : string => {
@@ -22,14 +49,6 @@ export const getLogoPath = (): string => {
2249 return cyberBrutalLogo ;
2350} ;
2451
25- export const getHeroVideoPath = ( ) : string => {
26- return heroBackgroundMp4 ;
27- } ;
28-
29- export const getHeroVideoWebmPath = ( ) : string => {
30- return heroBackgroundWebm ;
31- } ;
32-
3352export const getHeroVideoPosterPath = ( ) : string => {
3453 return heroVideoPoster ;
3554} ;
0 commit comments