Skip to content

Commit

Permalink
Merge pull request #30 from Vizzuality/feature/changed-basepath
Browse files Browse the repository at this point in the history
fixed path for assets
  • Loading branch information
davidsingal authored Dec 5, 2023
2 parents 7a635fc + 3416fa8 commit 3d12065
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 13 deletions.
5 changes: 4 additions & 1 deletion client/.env.default
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ NEXT_PUBLIC_GA_TRACKING_ID=UA-000000-2

# Recoil: Remove warnings about duplicate atoms due to hot-reloading
# Development
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false

# URL to setup a directory
NEXT_PUBLIC_BASE_PATH=''
4 changes: 2 additions & 2 deletions client/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import('./src/env.mjs');

/** @type {import('next').NextConfig} */
const nextConfig = {
basePath: '/impact-sphere',
basePath: process.env.NEXT_PUBLIC_BASE_PATH || '',
transpilePackages: ['@esa/types'],
images: {
domains: ['api.mapbox.com', 'localhost', 'esa-gda-comms-staging-mfafc.ondigitalocean.app'],
domains: ['api.mapbox.com', 'localhost', process.env.NEXT_PUBLIC_API_URL],
},
env: {
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED: 'false',
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ui/story-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const StorySummary = ({ story }: StorySummaryProps) => {
<div className="shrink-0">
<Image
alt={story.attributes?.title || 'Story image'}
src="/images/story-card-image.png"
src={`${process.env.NEXT_PUBLIC_BASE_PATH}/images/story-card-image.png`}
width={72}
height={72}
/>
Expand Down
2 changes: 1 addition & 1 deletion client/src/constants/mapbox-style.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
"bearing": 0,
"pitch": 0,
"fog": {
"color": "rgba(225, 244, 237, 0.07)",
"color": "rgba(0, 50, 71, 0.8)",
"range": [
"interpolate",
[
Expand Down
14 changes: 12 additions & 2 deletions client/src/containers/home/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,20 @@ const Header = () => {
</div>
<div className="flex items-center space-x-3">
<a href="https://gda.esa.int/" target="_blank" rel="noreferrer">
<Image src="/images/logos/GDA-logo.png" alt="Impact Sphere" width={50} height={50} />
<Image
src={`${process.env.NEXT_PUBLIC_BASE_PATH}/images/logos/GDA-logo.png`}
alt="Impact Sphere"
width={50}
height={50}
/>
</a>
<a href="https://www.esa.int/" target="_blank" rel="noreferrer">
<Image src="/images/logos/esa-logo.png" alt="Impact Sphere" width={69} height={32} />
<Image
src={`${process.env.NEXT_PUBLIC_BASE_PATH}/images/logos/esa-logo.png`}
alt="Impact Sphere"
width={69}
height={32}
/>
</a>
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion client/src/containers/home/top-stories/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ const TopStoriesItem = ({ story }: TopStoriesItemProps) => {
return (
<div className="flex gap-2">
<div className="shrink-0">
<Image alt={story.title} src="/images/story-card-image.png" width={72} height={72} />
<Image
alt={story.title}
src={`${process.env.NEXT_PUBLIC_BASE_PATH}/images/story-card-image.png`}
width={72}
height={72}
/>
</div>
<div className="space-y-1 text-gray-300">
<h3 className="text-sm font-bold leading-4 text-gray-300">{story.title}</h3>
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/map/markers/home-markers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const StoryMarkers = () => {

useMapImage({
name: 'story-marker',
url: '/images/map/story-marker.png',
url: `${process.env.NEXT_PUBLIC_BASE_PATH}/images/map/story-marker.png`,
});

return (
Expand Down
6 changes: 3 additions & 3 deletions client/src/containers/map/markers/story-markers/marker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ type StoryMarkerProps = {
const MOCK_IMAGES = [
{
id: 0,
img: '/images/mock/carousel.png',
img: `${process.env.NEXT_PUBLIC_BASE_PATH}/images/mock/carousel.png`,
legend: 'Summary of GDA Urban EO Information and Use Cases 1',
},
{
id: 1,
img: '/images/mock/carousel.png',
img: `${process.env.NEXT_PUBLIC_BASE_PATH}/images/mock/carousel.png`,
legend: 'Summary of GDA Urban EO Information and Use Cases 2',
},
{
id: 2,
img: '/images/mock/carousel.png',
img: `${process.env.NEXT_PUBLIC_BASE_PATH}/images/mock/carousel.png`,
legend: 'Summary of GDA Urban EO Information and Use Cases 3',
},
];
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/map/markers/story-markers/media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const StoryMarker = ({ media, name, isFullScreen, onClickExpand }: StoryMarkerMe

// MOCKUP IMAGE FOR STORY 1 STEP 1 !! REMOVE WHEN REAL IMAGE IS AVAILABLE
const mediaSrc = mediaMime.includes('image')
? '/images/story-1-image-mockup.png'
? `${process.env.NEXT_PUBLIC_BASE_PATH}/images/story-1-image-mockup.png`
: `${apiBaseUrl}${media?.url}`;

const handlePlayVideo = useCallback(
Expand Down
2 changes: 2 additions & 0 deletions client/src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const env = createEnv({
NEXT_PUBLIC_API_URL: z.string().url(),
NEXT_PUBLIC_MAPBOX_API_TOKEN: z.string(),
NEXT_PUBLIC_GA_TRACKING_ID: z.string().optional(),
NEXT_PUBLIC_BASE_PATH: z.string().optional(),
},
/*
* Due to how Next.js bundles environment variables on Edge and Client,
Expand All @@ -44,6 +45,7 @@ export const env = createEnv({
NEXT_PUBLIC_GA_TRACKING_ID: process.env.NEXT_PUBLIC_GA_TRACKING_ID,
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED:
process.env.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED,
NEXT_PUBLIC_BASE_PATH: process.env.NEXT_PUBLIC_BASE_PATH,
},
});

Expand Down

0 comments on commit 3d12065

Please sign in to comment.