asset path correction
This commit is contained in:
+21
-19
@@ -1,4 +1,6 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
|
||||
const BASE = import.meta.env.BASE_URL;
|
||||
import { motion, useScroll, useTransform, useMotionValueEvent, useReducedMotion } from 'framer-motion';
|
||||
import { useContent } from './context/ContentContext';
|
||||
import { usePreviewMode } from './context/PreviewContext';
|
||||
@@ -564,7 +566,7 @@ export default function App({ previewMode = false }) {
|
||||
borderBottom: activeSection === 'products' ? '1px solid rgba(15, 23, 42, 0.08)' : '1px solid rgba(255, 255, 255, 0.05)'
|
||||
}}>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<img src="/assets/cavin_logo.svg" alt="Cavin Infotech Logo" style={{ height: isMobile ? '38px' : '50px', display: 'block' }} />
|
||||
<img src={`${BASE}assets/cavin_logo.svg`} alt="Cavin Infotech Logo" style={{ height: isMobile ? '38px' : '50px', display: 'block' }} />
|
||||
</div>
|
||||
|
||||
{!isMobile && (
|
||||
@@ -606,7 +608,7 @@ export default function App({ previewMode = false }) {
|
||||
);
|
||||
})}
|
||||
<div className="btn-sparkle-wrapper">
|
||||
<img src="/assets/button_hover_effect.png" className="btn-sparkles" alt="" />
|
||||
<img src={`${BASE}assets/button_hover_effect.png`} className="btn-sparkles" alt="" />
|
||||
<button className="btn-talk" onClick={() => setIsStrategyOpen(true)}>
|
||||
Book a Strategy Call
|
||||
</button>
|
||||
@@ -935,7 +937,7 @@ export default function App({ previewMode = false }) {
|
||||
{/* Globe Visual */}
|
||||
<div style={{ position: 'relative', width: '280px', height: '280px', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
||||
<img
|
||||
src="/assets/GlobeVector.svg"
|
||||
src={`${BASE}assets/GlobeVector.svg`}
|
||||
alt="Globe Map"
|
||||
style={{ width: '100%', height: '100%', objectFit: 'contain', opacity: 0.3 }}
|
||||
/>
|
||||
@@ -980,7 +982,7 @@ export default function App({ previewMode = false }) {
|
||||
|
||||
{/* Globe in background - Increased Size & Brightness */}
|
||||
<img
|
||||
src="/assets/GlobeVector.svg"
|
||||
src={`${BASE}assets/GlobeVector.svg`}
|
||||
alt="Globe Map"
|
||||
style={{
|
||||
position: 'absolute',
|
||||
@@ -1043,18 +1045,18 @@ export default function App({ previewMode = false }) {
|
||||
|
||||
{/* orbital logos with smooth continuous motion in horizontally elongated oval paths - No Skewing */}
|
||||
{/* Outer Orbit - Increased size further to radiusX=520, radiusY=320 */}
|
||||
<OrbitalLogo src="/assets/Frame 33.svg" alt="MRF Logo" radiusX={520} radiusY={320} startAngle={0} duration={60} clockwise={true} size={170} />
|
||||
<OrbitalLogo src="/assets/Frame 31.svg" alt="ACA Global Logo" radiusX={520} radiusY={320} startAngle={78} duration={60} clockwise={true} size={175} />
|
||||
<OrbitalLogo src="/assets/Frame 30.svg" alt="Polyhose Logo" radiusX={520} radiusY={320} startAngle={144} duration={60} clockwise={true} size={170} />
|
||||
<OrbitalLogo src="/assets/Frame 32.svg" alt="Dawn Pictures Logo" radiusX={520} radiusY={320} startAngle={216} duration={60} clockwise={true} size={180} />
|
||||
<OrbitalLogo src="/assets/Frame 35.svg" alt="Hero Logo" radiusX={520} radiusY={320} startAngle={282} duration={60} clockwise={true} size={170} />
|
||||
<OrbitalLogo src={`${BASE}assets/Frame 33.svg`} alt="MRF Logo" radiusX={520} radiusY={320} startAngle={0} duration={60} clockwise={true} size={170} />
|
||||
<OrbitalLogo src={`${BASE}assets/Frame 31.svg`} alt="ACA Global Logo" radiusX={520} radiusY={320} startAngle={78} duration={60} clockwise={true} size={175} />
|
||||
<OrbitalLogo src={`${BASE}assets/Frame 30.svg`} alt="Polyhose Logo" radiusX={520} radiusY={320} startAngle={144} duration={60} clockwise={true} size={170} />
|
||||
<OrbitalLogo src={`${BASE}assets/Frame 32.svg`} alt="Dawn Pictures Logo" radiusX={520} radiusY={320} startAngle={216} duration={60} clockwise={true} size={180} />
|
||||
<OrbitalLogo src={`${BASE}assets/Frame 35.svg`} alt="Hero Logo" radiusX={520} radiusY={320} startAngle={282} duration={60} clockwise={true} size={170} />
|
||||
|
||||
{/* Inner Orbit - Adjusted size to radiusX=360, radiusY=225 */}
|
||||
<OrbitalLogo src="/assets/Frame 28.svg" alt="Valeo Logo" radiusX={360} radiusY={225} startAngle={36} duration={40} clockwise={false} size={170} />
|
||||
<OrbitalLogo src="/assets/Frame 36.svg" alt="BorgWarner Logo" radiusX={360} radiusY={225} startAngle={108} duration={40} clockwise={false} size={170} />
|
||||
<OrbitalLogo src="/assets/kone.png" alt="KONE Logo" radiusX={360} radiusY={225} startAngle={180} duration={40} clockwise={false} size={160} />
|
||||
<OrbitalLogo src="/assets/Frame 34.svg" alt="Chola MS Logo" radiusX={360} radiusY={225} startAngle={252} duration={40} clockwise={false} size={170} />
|
||||
<OrbitalLogo src="/assets/Frame 27.svg" alt="CavinKare Logo" radiusX={360} radiusY={225} startAngle={324} duration={40} clockwise={false} size={180} />
|
||||
<OrbitalLogo src={`${BASE}assets/Frame 28.svg`} alt="Valeo Logo" radiusX={360} radiusY={225} startAngle={36} duration={40} clockwise={false} size={170} />
|
||||
<OrbitalLogo src={`${BASE}assets/Frame 36.svg`} alt="BorgWarner Logo" radiusX={360} radiusY={225} startAngle={108} duration={40} clockwise={false} size={170} />
|
||||
<OrbitalLogo src={`${BASE}assets/kone.png`} alt="KONE Logo" radiusX={360} radiusY={225} startAngle={180} duration={40} clockwise={false} size={160} />
|
||||
<OrbitalLogo src={`${BASE}assets/Frame 34.svg`} alt="Chola MS Logo" radiusX={360} radiusY={225} startAngle={252} duration={40} clockwise={false} size={170} />
|
||||
<OrbitalLogo src={`${BASE}assets/Frame 27.svg`} alt="CavinKare Logo" radiusX={360} radiusY={225} startAngle={324} duration={40} clockwise={false} size={180} />
|
||||
|
||||
</div>
|
||||
)}
|
||||
@@ -1367,7 +1369,7 @@ export default function App({ previewMode = false }) {
|
||||
<div className="glass-card" style={{
|
||||
padding: '2rem 1.8rem',
|
||||
borderRadius: '20px',
|
||||
background: 'linear-gradient(to bottom, rgba(2, 7, 16, 0.95) 0%, rgba(2, 7, 16, 0.6) 45%, rgba(2, 7, 16, 0) 85%), url(/assets/whyus_hologram.jpg)',
|
||||
background: `linear-gradient(to bottom, rgba(2, 7, 16, 0.95) 0%, rgba(2, 7, 16, 0.6) 45%, rgba(2, 7, 16, 0) 85%), url(${BASE}assets/whyus_hologram.jpg)`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
border: '1px solid rgba(255, 255, 255, 0.06)',
|
||||
@@ -1429,7 +1431,7 @@ export default function App({ previewMode = false }) {
|
||||
height: '100%'
|
||||
}}>
|
||||
<img
|
||||
src="/assets/whyus_arab_meeting.jpg"
|
||||
src={`${BASE}assets/whyus_arab_meeting.jpg`}
|
||||
alt="Corporate collaboration"
|
||||
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
||||
/>
|
||||
@@ -1499,7 +1501,7 @@ export default function App({ previewMode = false }) {
|
||||
height: '100%'
|
||||
}}>
|
||||
<img
|
||||
src="/assets/whyus_vr_man.jpg"
|
||||
src={`${BASE}assets/whyus_vr_man.jpg`}
|
||||
alt="Sunset boardroom"
|
||||
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
||||
/>
|
||||
@@ -1513,7 +1515,7 @@ export default function App({ previewMode = false }) {
|
||||
border: '1px solid rgba(255, 255, 255, 0.06)',
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
backgroundImage: 'linear-gradient(to bottom, rgba(2, 7, 16, 0.95) 0%, rgba(2, 7, 16, 0.6) 45%, rgba(2, 7, 16, 0) 85%), url(/assets/whyus_hologram.jpg)',
|
||||
backgroundImage: `linear-gradient(to bottom, rgba(2, 7, 16, 0.95) 0%, rgba(2, 7, 16, 0.6) 45%, rgba(2, 7, 16, 0) 85%), url(${BASE}assets/whyus_hologram.jpg)`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
display: 'flex',
|
||||
@@ -1773,7 +1775,7 @@ export default function App({ previewMode = false }) {
|
||||
padding: '4rem 0 0 0',
|
||||
}}>
|
||||
<img
|
||||
src="/assets/citp_footer_design.png"
|
||||
src={`${BASE}assets/citp_footer_design.png`}
|
||||
alt="Cavin Infotech Logo Divider"
|
||||
style={{
|
||||
width: '100%',
|
||||
|
||||
+4
-2
@@ -1,4 +1,6 @@
|
||||
import { useEffect, useRef, useState, Component } from 'react';
|
||||
|
||||
const BASE = import.meta.env.BASE_URL;
|
||||
import {
|
||||
LayoutDashboard,
|
||||
Sparkles,
|
||||
@@ -93,7 +95,7 @@ function LoginPreview() {
|
||||
return (
|
||||
<div className="login-preview">
|
||||
<div className="login-preview-intro">
|
||||
<img src="/assets/cavin_logo.svg" alt="Cavin Infotech" />
|
||||
<img src={`${BASE}assets/cavin_logo.svg`} alt="Cavin Infotech" />
|
||||
<div>
|
||||
<h1>Content <span>Manager</span></h1>
|
||||
<p>Preview the live website before you sign in. Edits publish instantly after login.</p>
|
||||
@@ -501,7 +503,7 @@ export default function App() {
|
||||
|
||||
<aside className={`admin-sidebar ${sidebarOpen ? 'open' : ''}`}>
|
||||
<div className="admin-sidebar-brand">
|
||||
<img src="/assets/cavin_logo.svg" alt="Cavin Infotech" />
|
||||
<img src={`${BASE}assets/cavin_logo.svg`} alt="Cavin Infotech" />
|
||||
<h2>Content Manager</h2>
|
||||
<p>Cavin Infotech Website</p>
|
||||
</div>
|
||||
|
||||
@@ -4,9 +4,24 @@ import defaultContent from '../../server/seed/default-content.json';
|
||||
const ContentContext = createContext(null);
|
||||
|
||||
const API_BASE = import.meta.env.VITE_API_URL || '';
|
||||
const BASE = import.meta.env.BASE_URL;
|
||||
|
||||
// Recursively prefix /assets/ paths with the Vite base URL
|
||||
function prefixAssets(obj) {
|
||||
if (typeof obj === 'string') {
|
||||
return obj.startsWith('/assets/') ? `${BASE}${obj.slice(1)}` : obj;
|
||||
}
|
||||
if (Array.isArray(obj)) return obj.map(prefixAssets);
|
||||
if (obj && typeof obj === 'object') {
|
||||
const out = {};
|
||||
for (const k in obj) out[k] = prefixAssets(obj[k]);
|
||||
return out;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
export function ContentProvider({ children, previewMode = false }) {
|
||||
const [content, setContent] = useState(defaultContent);
|
||||
const [content, setContent] = useState(prefixAssets(defaultContent));
|
||||
const [loading, setLoading] = useState(!previewMode);
|
||||
const [error, setError] = useState(null);
|
||||
const [updatedAt, setUpdatedAt] = useState(null);
|
||||
@@ -21,7 +36,7 @@ export function ContentProvider({ children, previewMode = false }) {
|
||||
})
|
||||
.then((data) => {
|
||||
const { _updatedAt, ...rest } = data;
|
||||
setContent(rest);
|
||||
setContent(prefixAssets(rest));
|
||||
setUpdatedAt(_updatedAt);
|
||||
setError(null);
|
||||
})
|
||||
@@ -41,7 +56,7 @@ export function ContentProvider({ children, previewMode = false }) {
|
||||
if (event.origin !== window.location.origin) return;
|
||||
if (event.data?.type !== 'ADMIN_PREVIEW' || !event.data.fullContent) return;
|
||||
|
||||
setContent(event.data.fullContent);
|
||||
setContent(prefixAssets(event.data.fullContent));
|
||||
setLoading(false);
|
||||
|
||||
const anchor = event.data.anchor;
|
||||
|
||||
Reference in New Issue
Block a user