Skip to content

Commit

Permalink
feat: updated base path
Browse files Browse the repository at this point in the history
  • Loading branch information
Tahasun authored and Tahasun committed Jan 27, 2024
1 parent 217c9ea commit 748eea6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lerna-debug.log*
node_modules
dist-ssr
*.local
.env

# Editor directories and files
.vscode/*
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/icons/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Stories of Our Land</title>
</head>
Expand Down
Binary file added public/icons/favicon.ico
Binary file not shown.
7 changes: 6 additions & 1 deletion src/components/gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled from "styled-components";
import { IImage } from "../utils/types";

const SCROLL_TIME = 5 * 1000;
export const BASE_URL = "stories-of-our-land";

interface GalleryProps {
images: IImage[];
Expand Down Expand Up @@ -68,9 +69,13 @@ const Gallery = (props: GalleryProps) => {
setActiveTab(index);
};

const imgSrc = import.meta.env.PROD
? BASE_URL + props.images[activeTab]?.src
: props.images[activeTab]?.src;

return (
<Wrapper>
<Image src={props.images[activeTab]?.src ?? ""} />
<Image src={imgSrc ?? ""} />
<Link href={props.images[activeTab]?.link ?? ""}>
©{props.images[activeTab]?.attribution ?? ""}
</Link>
Expand Down
7 changes: 4 additions & 3 deletions src/components/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as landmarkData from "../data/landmarks.json";
import { useMemo, useReducer, useState } from "react";
import Profile from "./profile";
import { getLandmarksById } from "../utils/utils";
import ProfilePreview from "./preview";
// import ProfilePreview from "./preview";
import { ILandmark, ViewState } from "../utils/types";
import { Wrapper, HoverInfo, CopyrightLicense, Link } from "./map.style";
import { MapController } from "./mapController";
Expand All @@ -20,6 +20,7 @@ import {
MapContext,
} from "../utils/mapContext";
import { TopBar } from "./topBar";
import { BASE_URL } from "./gallery";

const ICON_MAPPING = {
marker: { x: 0, y: 0, width: 260, height: 280, anchor: 260, mask: true },
Expand Down Expand Up @@ -130,7 +131,7 @@ export const Map = () => {
id: "icon-layer",
data: data,
pickable: true,
iconAtlas: "/StoriesOfOurLand/icons/pin.png",
iconAtlas: `/${BASE_URL}/icons/pin.png`,
iconMapping: ICON_MAPPING,
getIcon: () => "marker",
sizeScale: 10,
Expand Down Expand Up @@ -178,7 +179,7 @@ export const Map = () => {
top: hoverInfo.y,
}}
>
<ProfilePreview landmark={hoverInfo.object} />
{/* <ProfilePreview landmark={hoverInfo.object} /> */}
</HoverInfo>
)}

Expand Down
7 changes: 6 additions & 1 deletion src/components/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styled from "styled-components";
import { ILandmark } from "../utils/types";
import { BASE_URL } from "./gallery";

const Container = styled.div`
background-color: white;
Expand All @@ -23,10 +24,14 @@ const Img = styled.img`
`;

const ProfilePreview = ({ landmark }: { landmark: ILandmark }) => {
const imgSrc = import.meta.env.PROD
? BASE_URL + landmark.images[0].src
: landmark.images[0].src;

return (
<Container>
<h2>{landmark.name}</h2>
<Img src={landmark.images[0].src ?? ""} />
<Img src={imgSrc} />
</Container>
);
};
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
base: "/StoriesOfOurLand/",
base: "/stories-of-our-land/",
server: {
port: 3006,
}
Expand Down

0 comments on commit 748eea6

Please sign in to comment.