Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phs miha map icon - Further fix #47

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5ec9a8a
feat(map): adds preview component, updates UI
oahnh Dec 2, 2023
1d0b079
styling the popup
miha-bhaskaran Mar 4, 2024
29be540
lato not working
miha-bhaskaran Mar 6, 2024
71c7a5b
done with popup styling
miha-bhaskaran Mar 6, 2024
f967673
working on styling category
miha-bhaskaran Mar 11, 2024
b002c7b
styling r1 done with map popups
miha-bhaskaran Mar 16, 2024
1dcbdfc
rendering virtual or exhibits
miha-bhaskaran Mar 17, 2024
b005a09
virutal map and exihibits are displayed now toggle works - need to fi…
miha-bhaskaran Mar 17, 2024
9832c85
colors not working, and when selceticng its turning white
miha-bhaskaran Mar 17, 2024
b987997
finished color coding
miha-bhaskaran Mar 19, 2024
21ba28d
done with maps lol
miha-bhaskaran Mar 19, 2024
1945aee
fixed auto zoom
miha-bhaskaran Mar 19, 2024
3e1cb8e
feat(map): adds preview component, updates UI
oahnh Dec 2, 2023
47c98ee
styling the popup
miha-bhaskaran Mar 4, 2024
ff3e423
lato not working
miha-bhaskaran Mar 6, 2024
7798e2d
done with popup styling
miha-bhaskaran Mar 6, 2024
4c16a2b
working on styling category
miha-bhaskaran Mar 11, 2024
73fbd65
styling r1 done with map popups
miha-bhaskaran Mar 16, 2024
9e60342
Continuing rebase for pr
sarahhpeng Apr 5, 2024
6aed8a8
virutal map and exihibits are displayed now toggle works - need to fi…
miha-bhaskaran Mar 17, 2024
68c47c6
rebase part 2
sarahhpeng Apr 5, 2024
6ff6efd
rebase part 3
sarahhpeng Apr 5, 2024
4306330
done with maps lol
miha-bhaskaran Mar 19, 2024
be4f4ca
fixed auto zoom
miha-bhaskaran Mar 19, 2024
ec9e005
rebase part 4
sarahhpeng Apr 5, 2024
a35a569
updated package lock for npm install
sarahhpeng Apr 5, 2024
89a2eb9
god the colors to work again
miha-bhaskaran Apr 6, 2024
acbf50c
fixed toggle bar styling
miha-bhaskaran Apr 6, 2024
c85f37c
Merge branch 'phs_miha_map_icon' of github.com:calblueprint/phs into …
miha-bhaskaran Apr 6, 2024
102f70a
fixed toggle updated with figma design
miha-bhaskaran Apr 6, 2024
00c0ba5
fixed exhibit display card
miha-bhaskaran Apr 6, 2024
7debdd6
done with changing tour display card
miha-bhaskaran Apr 6, 2024
183c2ef
Merge branch 'main' into phs_miha_map_icon
miha-bhaskaran Apr 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,20 @@ export default function RootLayout({
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossOrigin=""
/>
<link
href="https://fonts.googleapis.com/css?family=Lato:200,300,400,700"
rel="stylesheet"
integrity="sha384-S/0sPWyivHb0nXEN1JbIZoAHSDK4PQv0Zdl6399sbd0mYRatVZsKWdfflTIgipPy"
crossOrigin=""
/>
<link
           href='https://fonts.googleapis.com/css?family=Lato:400,700'
          rel='stylesheet'
          integrity="sha384-DelNu+PL/74bL4pHGH8gPG8J5Q6wrLpZiiVttBSvpOibBVQf3EOXerhZlmHcnZsI"
          type='text/css'
          crossOrigin=""
        />
<script
src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossOrigin=""
/>
<script src="html5-qrcode.min.js" />

</head>

<body className={inter.className}>{children}</body>
Expand Down
56 changes: 36 additions & 20 deletions src/app/siteMapPage/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import dynamic from 'next/dynamic';
import NavBar from '../../components/userComponents/navBar/navBar';
import FilterButton from '../../components/userComponents/FilterButton/FilterButton';

const filterButtonContent: string[] = ['Virtual Tour Map', 'Exhibits Map'];

const filterButtonContent: string[] = [
'Virtual Tour Map',
'Exhibits Map',
];


const SiteMap = dynamic(
() => import('../../components/userComponents/SiteMap/SiteMap'),
Expand All @@ -16,51 +21,62 @@ const SiteMap = dynamic(
);
type ModeState = 'tours' | 'exhibits';


/**
* @returns Page for the interactive map
*/
function MapPage() {


const [selectedMap, setSelectedMap] = useState(filterButtonContent[0]); // "Virtual Tour Map" by default
const [mode, setMode] = useState<ModeState>('tours');

// move tour logic here: need to share state between filter
const handleFilter = mapName => {
// move tour logic here: need to share state between filter
const handleFilter = (mapName) => {
setSelectedMap(mapName);
if (mapName === 'Virtual Tour Map') {
setMode('tours');
} else if (mapName === 'Exhibits Map') {
setMode('exhibits');
if (mapName === "Virtual Tour Map") {
setMode("tours");
} else if (mapName === "Exhibits Map") {
setMode("exhibits");

}
};

const renderFilterContainer = () => (
<div className="mb-6 w-full pl-0 pr-0 ">
<div className="pt-9 pr-2 pl-2">
<p className="text-night font-lato text-2xl font-semibold">
Wildlife Care Center Maps
</p>

<div className="container mb-6 pl-0 pr-0 ">
<div className='pt-9 pr-2 pl-2 pb-7'>
<p className="text-night font-lato text-2xl font-semibold">Wildlife Care Center Maps</p>
</div>
<div className="flex flex-row items-center gap-x-0 justify-center text-scary-forest text-center font-lato text-base font-medium pt-7 pr-2 pl-2 w-full">
<div className="flex flex-row items-center gap-x-0 pr-1 pl-1 w-full rounded-lg bg-mint-cream border-mint-cream border-[5px]">


{filterButtonContent &&
filterButtonContent.map(text => (
<FilterButton
key={text}
content={text}
onClick={() => handleFilter(text)} // Fixed here
isSelected={selectedMap === text}
/>

<FilterButton
key={text}
content={text}
onClick={() => handleFilter(text)} // Fixed here
isSelected={selectedMap === text}/>

))}


</div>
</div>
);

return (
<>

<NavBar />
<div className="pt-0 pl-2 pr-2 bg-ivory">
{renderFilterContainer()}
<div className=" w-full pr-2 pl-2 flex h-2/3 mb-8">
<SiteMap mode={mode} />

<SiteMap mode={mode} />

</div>
</div>
</>
Expand Down
9 changes: 4 additions & 5 deletions src/app/spotlightPage/[spotlightId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import Link from 'next/link';
import React, { useEffect, useState } from 'react';

import { TourRow, DisplayRow } from '../../../types/types';
import {
fetchRecommendedSpotlights,
fetchTour,
} from '../../../supabase/tours/queries';

import { fetchTour } from '../../../supabase/tours/queries';
import NavBar from '../../../components/userComponents/navBar/navBar';
import { fetchDisplayfromSpotlight } from '../../../supabase/tour_displays/queries';
import { fetchDisplayfromSpotlight, fetchRelatedSpotlightIdsFromSpotlight } from '../../../supabase/tour_displays/queries';


/**
* @param root0 -
Expand Down
19 changes: 16 additions & 3 deletions src/components/userComponents/FilterButton/FilterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,31 @@ interface FilterButtonProps {
* @param onClick.onClick
*/





/**
*
*/
function FilterButton({ content, onClick, isSelected }: FilterButtonProps) {
const selectedStyle = 'bg-mint-cream text-scary-forest';
const selectedStyle = 'bg-hunterGreen text-white font-lato text-base font-medium rounded-lg';


const buttonClass = `py-2 px-6 whitespace-nowrap border-solid text-scary-forest flex-grow font-lato text-base font-medium ${

const buttonClass = `py-2 px-6 whitespace-nowrap border-[0.8px] border-scary-forest border-solid text-night flex-grow ${
isSelected ? selectedStyle : ''
}`;

return (
<button type="button" className={buttonClass} onClick={onClick}>

<button
type="button"
className={buttonClass}
onClick={onClick}
style={{ outline: 'none' }}
>

{content}
</button>
);
Expand Down
125 changes: 66 additions & 59 deletions src/components/userComponents/SiteMap/DisplayPreviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ function DisplayPreviewCard({
const [loading, setLoading] = useState<boolean>(false);
const [previewImage, setPreviewImage] = useState<string>('');
const [name1, setname1] = useState<string>('');

const [tourType, setTourType] = useState<string>('');

const { id, description, coordinates, category } = tour;
// name, for tour title for exhibit

Expand All @@ -49,103 +52,107 @@ function DisplayPreviewCard({
const fetchDetails = async () => {
setLoading(true);

let imageUrl = '';
let displayName = '';

if ('name' in tour) {

let imageUrl = '';
let displayName = '';

if ('name' in tour) { // because title is name for type TourExhibit
// Fetch images for a tour
const images = await fetchImagesForTour(tour.id);
if (images && images.length > 0) {
imageUrl = images[0].url;
imageUrl = images[0].url;
}
displayName = tour.name;
displayName = tour.name;
setTourType('tour');
} else {
// Handle as an ExhibitRow
const imageObj = await fetchExhibitImage(tour.id);
const imageObj = await fetchExhibitImage(tour.id);
if (imageObj) {
imageUrl = imageObj.image;
imageUrl = imageObj.image;
}
displayName = tour.title;
setTourType('exhibit');
}


// Set state variables
setPreviewImage(imageUrl);
setname1(displayName);
setLoading(false);
};


fetchDetails();
}, [tour]);
}, [tour]);



/** route this to spotlights */

return (
<div className="flex flex-col items-center justify-center w-[25rem] h-[8.25rem] max-w-xs sm:max-w-sm md:max-w-md lg:max-w-lg mx-auto p-4 pb-[2.87rem] pr-[1.19rem] pl-[1.19rem] rounded-md">
<div
className="flex flex-row items-center rounded-md overflow-hidden bg-ivory cursor-pointer w-full sm:w-4/4 md:w-5/5 lg:w-2/2 xl:w-5/5 flex-shrink-0 shadow-xl"
aria-hidden="true"
>
{!loading && (

<div className="flex flex-col items-center justify-center w-[25rem] h-[8.25rem] max-w-xs sm:max-w-sm md:max-w-md lg:max-w-lg mx-auto p-4 pb-[2.87rem] pr-[1.19rem] pl-[1.19rem] rounded-md">
<div
className="flex flex-row items-center rounded-md overflow-hidden bg-ivory cursor-pointer w-full sm:w-4/4 md:w-5/5 lg:w-2/2 xl:w-5/5 flex-shrink-0 shadow-xl"
aria-hidden="true"
>
{!loading &&
<div className="relative w-[7.8125rem] z-10 h-[8.25rem] shrink-0 rounded-tl-md rounded-tr-none rounded-br-none rounded-bl-md">

<Image

src={previewImage}
alt="placeholder"
alt='placeholder'
layout="fill"
objectFit="cover"
/>
</div>
)}
<div
className="justify-items-center align-middle z-20 overflow-hidden w-full h-full"
onClick={handleClick}
onKeyDown={e => {
if (handleClick && e.key === 'Enter') {
handleClick();
}
}}
role="button"
tabIndex={0}
>
<div className="">
<div
className="flex justify-end items-center pt-2 pr-2"
onClick={e => {
e.stopPropagation(); // This prevents the click from propagating to the parent link
handleClose(); // Then, your handleClose function is called
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="14"
height="15"
viewBox="0 0 14 15"
fill="none"
>
<path
d="M10.0523 11.0274L3.35083 4.32596M10.0524 4.32596L3.35083 11.0275"
stroke="#272929"
strokeWidth="1.11692"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
/>
</div>
<Link href={`/spotlightPage/${id}`}>
<h3 className="relative truncate text-asparagus pr-[0.31rem] pl-[0.75rem] pt-[0rem] uppercase font-light text-xs leading-normal">
}
<div
className="justify-items-center align-middle z-20 overflow-hidden w-full h-full"
onClick={handleClick}
onKeyDown={e => {
if (handleClick && e.key === 'Enter') {
handleClick();
}
}}
role="button"
tabIndex={0}
>
<div className="">
<div className="flex justify-end items-center pt-2 pr-2" onClick={(e) => {
e.stopPropagation(); // prevents the click from propagating to the parent link
handleClose();
}}>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="15" viewBox="0 0 14 15" fill="none">
<path d="M10.0523 11.0274L3.35083 4.32596M10.0524 4.32596L3.35083 11.0275" stroke="#272929" stroke-width="1.11692" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<Link href={`/spotlightPage/${id}`}>
<h3
className="relative truncate text-asparagus pr-[0.31rem] pl-[0.75rem] pt-[0rem] uppercase font-light text-xs leading-normal"

>
{category}
</h3>
<h3 className="relative truncate font-medium font-lato text-night pr-[0.31rem] pl-[0.75rem] pt-[0.30rem] pb-[0rem] text-base leading-normal">
<h3
className="relative truncate font-medium font-lato text-night pr-[0.31rem] pl-[0.75rem] pt-[0.30rem] pb-[0rem] text-base leading-normal"

>
{name1}
</h3>

<h4 className="relative font-lato h-[2rem] pr-[0.31rem] pt-[0rem] pl-[0.75rem] pb-[2.4rem] text-shadow line-clamp-2 text-sm">
{description}
</h4>
</Link>
</Link>
</div>
</div>
</div>
</div>
</div>



);
}

Expand Down
Loading