Skip to content

Commit

Permalink
style: fix eslint and prettier issues
Browse files Browse the repository at this point in the history
  • Loading branch information
christophertorres1 committed May 25, 2024
1 parent 90884d2 commit fbc64a5
Show file tree
Hide file tree
Showing 21 changed files with 268 additions and 209 deletions.
1 change: 0 additions & 1 deletion src/app/hours-and-location/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import React, { useEffect, useState } from 'react';
import Image from 'next/image';
import { FiCalendar, FiCompass } from 'react-icons/fi';
import Link from 'next/link';
import NavBar from '../../components/userComponents/NavBar/NavBar';
Expand Down
5 changes: 1 addition & 4 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ export default function RootLayout({
crossOrigin=""
/>
<script src="html5-qrcode.min.js" />

</head>

<body
className={`${inter.className} ${lato.className}`}
>
<body className={`${inter.className} ${lato.className}`}>
<WindowWidthProvider>{children}</WindowWidthProvider>
</body>
</html>
Expand Down
91 changes: 44 additions & 47 deletions src/app/site-maps/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import NavBar from '../../components/userComponents/NavBar/NavBar';
import FilterButton from '../../components/userComponents/FilterButton/FilterButton';
import { useWebDeviceDetection } from '../../context/WindowWidthContext/WindowWidthContext';

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 @@ -24,17 +21,16 @@ 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');
const isWebDevice = useWebDeviceDetection();

const handleFilter = (mapName: string) => {
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');
}
};

Expand All @@ -55,17 +51,15 @@ function MapPage() {
);
const renderFilterContainerWide = () => (
<div className="flex justify-end w-[23.875rem] h-[3.25rem]">
<div className="flex flex-row items-center rounded-lg bg-mint-cream border-mint-cream border-[8px] mx-auto w-full">

<div className="flex flex-row items-center rounded-lg bg-mint-cream border-mint-cream border-[8px] mx-auto w-full">
{filterButtonContent &&
filterButtonContent.map(text => (
<FilterButton
key={text}
content={text}
onClick={() => handleFilter(text)}
isSelected={selectedMap === text}
<FilterButton
key={text}
content={text}
onClick={() => handleFilter(text)}
isSelected={selectedMap === text}
/>

))}
</div>
</div>
Expand All @@ -74,44 +68,47 @@ function MapPage() {
return isWebDevice ? (
<>
<NavBar />
<div className='justify-center mx-auto w-[70%]'>
<div className="justify-center mx-auto w-[70%]">
<div className="pt-0 pl-2 pr-2 bg-ivory">

<div className="pt-20 pb-6 pl-2 ">
<text className="text-scary-forest font-lato text-sm font-normal">
Home <text className='text-night'> / Wildlife Care Center Maps </text>
</text>
</div>
<div className="flex items-center pb-4">
<div className='flex-initial pr-2 pl-2'>
<p className="text-night font-lato font-normal text-3xl">Wildlife Care Center Maps</p>
</div>
<div className="flex-grow flex justify-end pr-2 pl-2 pb-3">
{renderFilterContainerWide()}
<div className="pt-20 pb-6 pl-2 ">
<text className="text-scary-forest font-lato text-sm font-normal">
Home{' '}
<text className="text-night"> / Wildlife Care Center Maps </text>
</text>
</div>
<div className="flex items-center pb-4">
<div className="flex-initial pr-2 pl-2">
<p className="text-night font-lato font-normal text-3xl">
Wildlife Care Center Maps
</p>
</div>
<div className="flex-grow flex justify-end pr-2 pl-2 pb-3">
{renderFilterContainerWide()}
</div>
</div>
<div className="w-full pr-2 pl-2 flex h-2/3 mb-8">
<SiteMap mode={mode} />
</div>
</div>
</div>
<div className="w-full pr-2 pl-2 flex h-2/3 mb-8">
<SiteMap mode={mode} />
</div>
</div>
</div>

</>
) : (
<>
<NavBar />
<div className='pt-6.25 pr-2 pl-2 pb-2 bg-ivory'>
<div className="p-4">
<p className="text-night font-lato text-2xl font-normal">Wildlife Care Center Maps</p>
</div>
<NavBar />
<div className="pt-6.25 pr-2 pl-2 pb-2 bg-ivory">
<div className="p-4">
<p className="text-night font-lato text-2xl font-normal">
Wildlife Care Center Maps
</p>
</div>

{renderFilterContainer()}
<div className="pt-0 pl-2 pr-2 bg-ivory">
<div className="w-full pr-2 pl-2 flex h-2/3 mb-8">
<SiteMap mode={mode} />
{renderFilterContainer()}
<div className="pt-0 pl-2 pr-2 bg-ivory">
<div className="w-full pr-2 pl-2 flex h-2/3 mb-8">
<SiteMap mode={mode} />
</div>
</div>
</div>
</div>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/virtual-tours/[tourId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {

import BackButton from '../../../components/userComponents/BackButton/BackButton';
import NavBar from '../../../components/userComponents/NavBar/NavBar';
import ButtonWithText from '@/components/userComponents/ButtonWithText/ButtonWithText';
import ButtonWithText from '../../../components/userComponents/ButtonWithText/ButtonWithText';

/**
* @param params -
Expand Down
7 changes: 1 addition & 6 deletions src/app/virtual-tours/[tourId]/tour-end/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import Link from 'next/link';
import React, { useEffect, useState } from 'react';

import NavBar from '../../../../components/userComponents/NavBar/NavBar';
import {
MediaRow,
TourRow,
TourMediaRow,
TourDisplaysRow,
} from '../../../../types/types';
import { TourRow, TourDisplaysRow } from '../../../../types/types';
import { fetchTour } from '../../../../supabase/tours/queries';
import { fetchTourDisplays } from '../../../../supabase/tour_displays/queries';
import { BackArrow, Congratulations } from '../../../../../public/icons';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Page({

fetchData();
fetchDisplayMedia();
}, []);
}, [params.displayId, params.spotlightId]);

useEffect(() => {
if (window) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/wildlife-spotlights/[spotlightId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function Page({ params }: { params: { spotlightId: string } }) {
getTourMedia();
getMedia();
getAllTourMedia();
}, []);
}, [params.spotlightId]);

useEffect(() => {
if (window) {
Expand Down
56 changes: 32 additions & 24 deletions src/app/wildlife-spotlights/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ export default function WildlifeSpotlightsPage() {
* @returns spotlight data
*/
async function fetchData() {
try {
const responseData: TourRow[] = await fetchAllSpotlights();
setSpotlights(responseData);
} catch (error) {
console.error(error);
}
const responseData: TourRow[] = await fetchAllSpotlights();
setSpotlights(responseData);
}

// Get all tour media
Expand Down Expand Up @@ -95,28 +91,34 @@ export default function WildlifeSpotlightsPage() {
<img
key={
media.find(
m =>
m.id ===
mediaElement =>
mediaElement.id ===
allTourMedia.find(
m => m.tour_id === spotlight.id,
allTourMediaElement =>
allTourMediaElement.tour_id ===
spotlight.id,
)?.media_id,
)?.id
}
src={
media.find(
m =>
m.id ===
mediaElement =>
mediaElement.id ===
allTourMedia.find(
m => m.tour_id === spotlight.id,
allTourMediaElement =>
allTourMediaElement.tour_id ===
spotlight.id,
)?.media_id,
)?.url ?? ''
}
alt={
media.find(
m =>
m.id ===
mediaElement =>
mediaElement.id ===
allTourMedia.find(
m => m.tour_id === spotlight.id,
allTourMediaElement =>
allTourMediaElement.tour_id ===
spotlight.id,
)?.media_id,
)?.text ?? ''
}
Expand Down Expand Up @@ -167,28 +169,34 @@ export default function WildlifeSpotlightsPage() {
<img
key={
media.find(
m =>
m.id ===
mediaElement =>
mediaElement.id ===
allTourMedia.find(
m => m.tour_id === spotlight.id,
allTourMediaElement =>
allTourMediaElement.tour_id ===
spotlight.id,
)?.media_id,
)?.id
}
src={
media.find(
m =>
m.id ===
mediaElement =>
mediaElement.id ===
allTourMedia.find(
m => m.tour_id === spotlight.id,
allTourMediaElement =>
allTourMediaElement.tour_id ===
spotlight.id,
)?.media_id,
)?.url ?? ''
}
alt={
media.find(
m =>
m.id ===
mediaElement =>
mediaElement.id ===
allTourMedia.find(
m => m.tour_id === spotlight.id,
allTourMediaElement =>
allTourMediaElement.tour_id ===
spotlight.id,
)?.media_id,
)?.text ?? ''
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Image from 'next/image';
import Link from 'next/link';
import styles from './ExhibitPreview.module.css';


/**
*
* @param props - props for the ExhibitPreview component
Expand Down
7 changes: 5 additions & 2 deletions src/components/userComponents/FilterButton/FilterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ interface FilterButtonProps {
* @returns JSX.Element
*/
function FilterButton({ content, onClick, isSelected }: FilterButtonProps) {
const baseStyle = 'py-2.5 px-3 whitespace-nowrap font-lato text-base font-normal rounded-lg flex-grow text-center';
const baseStyle =
'py-2.5 px-3 whitespace-nowrap font-lato text-base font-normal rounded-lg flex-grow text-center';
const selectedStyle = 'bg-hunter-green text-white';
const unselectedStyle = 'bg-mint-cream text-scary-forest';

const buttonClass = `${baseStyle} ${isSelected ? selectedStyle : unselectedStyle}`;
const buttonClass = `${baseStyle} ${
isSelected ? selectedStyle : unselectedStyle
}`;

return (
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';

import { LinksRow } from '../../../types/types';

import { fetchAllLinks } from '../../../supabase/links/queries';
import fetchAllLinks from '../../../supabase/links/queries';
import { ExternalLinkIcon } from '../../../../public/icons';

/**
Expand Down
Loading

0 comments on commit fbc64a5

Please sign in to comment.