From a694efdb80da3ce36faf258f1be075a2d952a0fa Mon Sep 17 00:00:00 2001 From: David Qing <41662609+davidqing6432@users.noreply.github.com> Date: Wed, 22 May 2024 10:32:33 -0700 Subject: [PATCH 1/6] change useWebScreenDetection to useWebDeviceDetection (#68) --- src/app/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index baf2a07d..3fa71985 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -7,7 +7,7 @@ import VisitorResources from '../components/userComponents/HomePageComponents/Vi import WelcomeGraphic from '../components/userComponents/HomePageComponents/WelcomeGraphic/WelcomeGraphic'; import HomeVirtualTours from '../components/userComponents/HomePageComponents/HomeVirtualTours/HomeVirtualTours'; import HomeNewsFeed from '../components/userComponents/HomePageComponents/HomeNewsFeed/HomeNewsFeed'; -import { useWebScreenDetection } from '../context/WindowWidthContext/WindowWidthContext'; +import { useWebDeviceDetection } from '../context/WindowWidthContext/WindowWidthContext'; /** * @returns - Home page for PHS/SPCA. Buttons are available for the major flows of the application from this page. @@ -22,7 +22,7 @@ function Home() { // window.removeEventListener('resize', handleResize); // }; // }, []); - const isWebDevice = useWebScreenDetection(); + const isWebDevice = useWebDeviceDetection(); return (
From 6b1cef2a0df253abee45f34662574deee199b59c Mon Sep 17 00:00:00 2001 From: David Qing <41662609+davidqing6432@users.noreply.github.com> Date: Wed, 22 May 2024 11:02:05 -0700 Subject: [PATCH 2/6] fixed some linting errors, mostly jsdocs (#69) --- package-lock.json | 6 - src/app/hoursAdmissionPage/page.tsx | 2 +- src/app/spotlightPage/page.tsx | 18 +-- .../ExhibitDisplay/ExhibitDisplay.tsx | 14 ++ .../ExhibitPreview/ExhibitPreview 2.tsx | 135 ------------------ .../ExhibitPreview.module 2.css | 132 ----------------- .../ExhibitPreview/ExhibitPreview.tsx | 13 ++ .../FilterButton/FilterButton.tsx | 9 +- .../VisitorResources/VisitorResources.tsx | 3 +- .../userComponents/QrScanner/QrScanner.tsx | 44 ------ .../SiteMap/ExhibitPreviewCard.tsx | 8 +- .../SiteMap/MapInteractionHandler.tsx | 6 +- src/types/types.ts | 1 - 13 files changed, 51 insertions(+), 340 deletions(-) delete mode 100644 src/components/userComponents/ExhibitPreview/ExhibitPreview 2.tsx delete mode 100644 src/components/userComponents/ExhibitPreview/ExhibitPreview.module 2.css delete mode 100644 src/components/userComponents/QrScanner/QrScanner.tsx diff --git a/package-lock.json b/package-lock.json index 60db15b2..1850a882 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3461,12 +3461,6 @@ "jiti": "bin/jiti.js" } }, - "node_modules/jquery": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", - "peer": true - }, "node_modules/js-tokens": { "version": "4.0.0", "license": "MIT" diff --git a/src/app/hoursAdmissionPage/page.tsx b/src/app/hoursAdmissionPage/page.tsx index 58b80e23..2b686234 100644 --- a/src/app/hoursAdmissionPage/page.tsx +++ b/src/app/hoursAdmissionPage/page.tsx @@ -64,7 +64,7 @@ export default function HoursAdmissionPage() {

- If you've found a wild animal that appears to be sick, injured, or + If you've found a wild animal that appears to be sick, injured, or orphaned, safely contain it and either bring it to our nearest shelter or contact us for guidance.

diff --git a/src/app/spotlightPage/page.tsx b/src/app/spotlightPage/page.tsx index 6ce6be29..2828023d 100644 --- a/src/app/spotlightPage/page.tsx +++ b/src/app/spotlightPage/page.tsx @@ -82,25 +82,25 @@ function App() { className="w-[24.375rem] h-[13.375rem] rounded-lg" key={ media.find( - m => - m.id === - allTourMedia.find(m => m.tour_id === spotlight.id) + mediaElement => + mediaElement.id === + allTourMedia.find(allTourMediaElement => allTourMediaElement.tour_id === spotlight.id) ?.media_id, )?.id } src={ media.find( - m => - m.id === - allTourMedia.find(m => m.tour_id === spotlight.id) + mediaElement => + mediaElement.id === + allTourMedia.find(allTourMediaElement => allTourMediaElement.tour_id === spotlight.id) ?.media_id, )?.url ?? '' } alt={ media.find( - m => - m.id === - allTourMedia.find(m => m.tour_id === spotlight.id) + mediaElement => + mediaElement.id === + allTourMedia.find(allTourMediaElement => allTourMediaElement.tour_id === spotlight.id) ?.media_id, )?.text ?? '' } diff --git a/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx b/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx index 8a063bf2..087d0be3 100644 --- a/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx +++ b/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx @@ -2,6 +2,20 @@ import React from 'react'; import Image from 'next/image'; import styles from './ExhibitDisplay.module.css'; +/** + * ExhibitDisplay component + * @param props - props for the ExhibitDisplay component + * @param props.name - name of the exhibit + * @param props.location - location of the exhibit + * @param props.information - information about the exhibit + * @param props.description - description of the exhibit + * @param props.relatednews - related news of the exhibit + * @param props.topimage - top image of the exhibit + * @param props.media - media of the exhibit + * @param props.bottomimage - bottom image of the exhibit + * @param props.moretext - more text of the exhibit + * @returns JSX.Element + */ export default function ExhibitDisplay({ name, location, diff --git a/src/components/userComponents/ExhibitPreview/ExhibitPreview 2.tsx b/src/components/userComponents/ExhibitPreview/ExhibitPreview 2.tsx deleted file mode 100644 index 59fc6523..00000000 --- a/src/components/userComponents/ExhibitPreview/ExhibitPreview 2.tsx +++ /dev/null @@ -1,135 +0,0 @@ -'use client'; - -import React, { Fragment, useState } from 'react'; -import { Dialog, Transition } from '@headlessui/react'; -import Image from 'next/image'; -import styles from './ExhibitPreview.module.css'; - -export default function ExhibitPreview({ - name, - location, - description, - about, - topimage, - bottomimage, -}: { - name: string; - location: string; - description: string; - about: string; - topimage: string; - bottomimage: string; -}) { - const [isOpen, setIsOpen] = useState(false); - - const closeModal = () => { - setIsOpen(false); - }; - - const openModal = () => { - setIsOpen(true); - }; - - return ( - <> -
- -
- - - -
- - - - - {/* This element is to trick the browser into centering the modal contents. */} - - -
-
- -
- -
-
-

{name}

-
- -
-

{location}

-
- -
-

{description}

-
- -
-

{about}

-
- -
- exhibit display -
-
- -
- exhibit display -
-
-
-
-
-
- - ); -} diff --git a/src/components/userComponents/ExhibitPreview/ExhibitPreview.module 2.css b/src/components/userComponents/ExhibitPreview/ExhibitPreview.module 2.css deleted file mode 100644 index fc66f20a..00000000 --- a/src/components/userComponents/ExhibitPreview/ExhibitPreview.module 2.css +++ /dev/null @@ -1,132 +0,0 @@ -.outercontainer { - display: flex; - justify-content: center; - align-items: center; -} - -.buttonbox { - display: flex; - justify-content: flex-end; - padding-right: 18px; - padding-bottom: 156px; - padding-top: 10px; -} - -.roundedbackground { - background-color: white; - width: 398px; - height: 730px; - display: flex; - flex-direction: column; - justify-content: flex-end; - vertical-align: bottom; - width: 100%; - max-width: 398px; - overflow: hidden; - text-align: left; - position: fixed; - transition-property: all; - transition-duration: 0.3s; /* Adjust the duration as needed */ - transition-timing-function: ease; - transform: translate(0); - box-shadow: 0 0 1rem rgba(0, 0, 0, 0.2); - border-radius: 2rem; - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); -} - -.rectangle { - background-color: white; - width: 398px; - height: 497px; - flex-shrink: 0; - padding-right: 22px; - padding-left: 22px; - justify-content: flex-start; - align-content: flex-start; - position: relative; -} - -.titlebox { - width: 354px; - padding-top: 46px; - justify-content: flex-start; -} - -.titletext { - color: black; - font-family: Inter; - font-size: 24px; - font-style: normal; - font-weight: 700; - line-height: normal; - letter-spacing: -0.5px; -} - -.locationbox { - width: 354px; - padding-top: 8px; - justify-content: flex-start; -} - -.locationtext { - color: #0d0b0b; - font-family: Inter; - font-size: 14px; - font-style: italic; - font-weight: 400; - line-height: 20px; - letter-spacing: -0.5px; -} - -.descriptionbox { - width: 354px; - padding-top: 20px; - padding-bottom: 20px; - justify-content: flex-start; -} - -.descriptiontext { - color: #0d0b0b; - font-family: Arial, Helvetica, sans-serif; - font-size: 16px; - font-style: normal; - font-weight: 400; - line-height: 20px; - letter-spacing: -0.5px; -} - -.aboutbox { - width: 354px; - padding-top: 17px; - padding-bottom: 17px; - justify-content: flex-start; -} - -.abouttext { - color: #0d0b0b; - font-family: sans-serif; - font-size: 20px; - font-style: normal; - font-weight: 500; - line-height: normal; - letter-spacing: -0.5px; -} - -.picturebox { - width: 354px; - height: 190px; - flex-shrink: 0; -} - -.topimagebox { - display: flex; - flex-direction: column; - justify-content: flex-start; - position: absolute; - top: 0; - left: 0; - z-index: -1; -} diff --git a/src/components/userComponents/ExhibitPreview/ExhibitPreview.tsx b/src/components/userComponents/ExhibitPreview/ExhibitPreview.tsx index bc997332..aeeb0315 100644 --- a/src/components/userComponents/ExhibitPreview/ExhibitPreview.tsx +++ b/src/components/userComponents/ExhibitPreview/ExhibitPreview.tsx @@ -6,6 +6,19 @@ import Image from 'next/image'; import Link from 'next/link'; import styles from './ExhibitPreview.module.css'; + +/** + * + * @param props - props for the ExhibitPreview component + * @param props.name - name of the exhibit + * @param props.location - location of the exhibit + * @param props.description - description of the exhibit + * @param props.about - about the exhibit + * @param props.topimage - top image of the exhibit + * @param props.bottomimage - bottom image of the exhibit + * @param props.href - href of the exhibit + * @returns JSX.Element + */ export default function ExhibitPreview({ name, location, diff --git a/src/components/userComponents/FilterButton/FilterButton.tsx b/src/components/userComponents/FilterButton/FilterButton.tsx index 8b35c30c..cddb24cc 100644 --- a/src/components/userComponents/FilterButton/FilterButton.tsx +++ b/src/components/userComponents/FilterButton/FilterButton.tsx @@ -21,10 +21,11 @@ interface FilterButtonProps { /** * - * @param root0 - * @param root0.content - * @param root0.onClick - * @param root0.isSelected + * @param props - props for the FilterButton component + * @param props.content - content of the button + * @param props.onClick - function to handle the functionality we want to tie to our filter buttons + * @param props.isSelected - boolean to determine if the button is selected + * @returns JSX.Element */ function FilterButton({ content, onClick, isSelected }: FilterButtonProps) { const selectedStyle = diff --git a/src/components/userComponents/HomePageComponents/VisitorResources/VisitorResources.tsx b/src/components/userComponents/HomePageComponents/VisitorResources/VisitorResources.tsx index c6f00eff..5f4fbba7 100644 --- a/src/components/userComponents/HomePageComponents/VisitorResources/VisitorResources.tsx +++ b/src/components/userComponents/HomePageComponents/VisitorResources/VisitorResources.tsx @@ -6,8 +6,7 @@ import AdmissionButton from './AdmissionButton'; /** * @returns - Visitor resources section of the home page. Users can reach the Site Map and QR flow from here. * These resources are mainly for in-person experiences - // eslint-disable-next-line jsdoc/check-tag-names - * @Note VisitorResources tag below uses padding to ensure relative consistency of text lining up with buttons. + * NOTE: VisitorResources tag below uses padding to ensure relative consistency of text lining up with buttons. * It will look slightly off on some screens. Motivation: it's better to be slightly wrong on many screens * than VERY wrong on a few. If solution found, @andreiTan */ diff --git a/src/components/userComponents/QrScanner/QrScanner.tsx b/src/components/userComponents/QrScanner/QrScanner.tsx deleted file mode 100644 index 17289129..00000000 --- a/src/components/userComponents/QrScanner/QrScanner.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { Html5QrcodeScanner, Html5QrcodeScanType } from 'html5-qrcode'; -import React, { useEffect } from 'react'; - -const qrcodeRegionId = 'html5qr-code-full-region'; - -/** - * - * @param root0 - * @param root0.setScanResult - * @param root0.updateScanResult - * @returns qr scanner - */ -function Html5QrcodePlugin() { - useEffect(() => { - const videoConstraints = { - facingMode: 'environment', - }; - - const html5QrcodeScanner = new Html5QrcodeScanner( - 'reader', - { - qrbox: { - width: 500, - height: 500, - }, - fps: 5, - supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA], - videoConstraints, - }, - false, - ); - html5QrcodeScanner.render( - () => {}, - () => {}, - ); - return () => { - html5QrcodeScanner.clear().catch(error => {}); - }; - }, []); - - return
; -} - -export default Html5QrcodePlugin; diff --git a/src/components/userComponents/SiteMap/ExhibitPreviewCard.tsx b/src/components/userComponents/SiteMap/ExhibitPreviewCard.tsx index 635f63a5..2a79e647 100644 --- a/src/components/userComponents/SiteMap/ExhibitPreviewCard.tsx +++ b/src/components/userComponents/SiteMap/ExhibitPreviewCard.tsx @@ -16,13 +16,10 @@ interface ExhibitCardProps { } /** - * @param ExhibitCardProps.display display to preview + * @param ExhibitCardProps - The props for the exhibit card component * @param ExhibitCardProps.handleClick function to handle actions when clicked * @param ExhibitCardProps.handleClose function to handle closing of preview card - * @param ExhibitCardProps.display.display - * @param ExhibitCardProps.display.handleClick - * @param ExhibitCardProps.display.handleClose - * @param ExhibitCardProps.display.tour + * @param ExhibitCardProps.tour the tour or exhibit to preview * @returns preview card component to display within leaflet map container */ function ExhibitPreviewCard({ @@ -100,6 +97,7 @@ function ExhibitPreviewCard({ tabIndex={0} >
+ {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
{ diff --git a/src/components/userComponents/SiteMap/MapInteractionHandler.tsx b/src/components/userComponents/SiteMap/MapInteractionHandler.tsx index 131a1c64..95619567 100644 --- a/src/components/userComponents/SiteMap/MapInteractionHandler.tsx +++ b/src/components/userComponents/SiteMap/MapInteractionHandler.tsx @@ -1,9 +1,13 @@ import { useMap } from 'react-leaflet'; import React, { useEffect, useState } from 'react'; +import { LatLngExpression } from 'leaflet'; /** * + * @param props - props for the RecenterMap component + * @param props.center - center of the map + * @returns null */ -function RecenterMap({ center }) { +function RecenterMap({ center } : { center: LatLngExpression }) { const map = useMap(); useEffect(() => { diff --git a/src/types/types.ts b/src/types/types.ts index bb39eacd..5de02824 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -12,7 +12,6 @@ export type TourDisplaysRow = Database['public']['Tables']['tour_displays']['Row']; export type TourMediaRow = Database['public']['Tables']['tour_media']['Row']; export type TourRow = Database['public']['Tables']['tours']['Row']; -export type SpotlightWithMediaRow = TourRow & { media_url: string }; export type TourWithMediaRow = TourRow & { media_url: string }; export type NewsRow = Database['public']['Tables']['news']['Row']; export type ExhibitRow = Database['public']['Tables']['exhibits']['Row']; From 320e6c563d9f9d0d23e2f162df3c8d438715c2b9 Mon Sep 17 00:00:00 2001 From: Justin Xue <67207128+jxmoose@users.noreply.github.com> Date: Wed, 22 May 2024 11:06:33 -0700 Subject: [PATCH 3/6] news feed web (#61) * news feed web * small change * added web screen, fixed styling when screen between certain sizes, fixed coloring using h-full (?), changed margins to padding, changed to rem * just used gradient for now for epic styling lol.. * changed bg to mint cream for now :( * changed web detection * removed text from web --------- Co-authored-by: sarahhpeng <137237272+sarahhpeng@users.noreply.github.com> --- src/app/newsFeedPage/page.tsx | 77 ++++++++++++++----- .../NewsDisplay/NewsDisplay.tsx | 2 +- 2 files changed, 60 insertions(+), 19 deletions(-) diff --git a/src/app/newsFeedPage/page.tsx b/src/app/newsFeedPage/page.tsx index 5aba744f..afb2c4f5 100644 --- a/src/app/newsFeedPage/page.tsx +++ b/src/app/newsFeedPage/page.tsx @@ -1,16 +1,20 @@ 'use client'; import React, { useEffect, useState } from 'react'; +import Link from 'next/link'; import BackButton from '../../components/userComponents/BackButton/page'; import NavBar from '../../components/userComponents/navBar/navBar'; import { NewsRow } from '../../types/types'; import { fetchAllNewsByDate } from '../../supabase/news/queries'; import NewsDisplay from '../../components/userComponents/NewsDisplay/NewsDisplay'; +import { useWebDeviceDetection } from '../../context/WindowWidthContext/WindowWidthContext'; /** - * @returns news feed page + * @description queries from the news table in supabase and fetches all the news rows to display + * @returns news feed page by querying from the news table in supabase */ export default function App() { + const isWebDevice = useWebDeviceDetection(); const [news, setNews] = useState([]); useEffect(() => { // Get news @@ -20,25 +24,62 @@ export default function App() { }; getNews(); }, [news]); - return ( -
+
-
- -

News

-
    - {news.map(article => ( - - ))} -
-
+ {!isWebDevice && ( +
+
+ +

+ News +

+
    + {news.map(article => ( + + ))} +
+
+
+ )} + {isWebDevice && ( +
+
+
+
+

+ {' '} + + {' '} + Home{' '} + {' '} + / News{' '} +

+

News

+
+
+
+
    + {news.map(article => ( + + ))} +
+
+
+
+ )}
); } diff --git a/src/components/userComponents/NewsDisplay/NewsDisplay.tsx b/src/components/userComponents/NewsDisplay/NewsDisplay.tsx index 02441dbb..284ac73a 100644 --- a/src/components/userComponents/NewsDisplay/NewsDisplay.tsx +++ b/src/components/userComponents/NewsDisplay/NewsDisplay.tsx @@ -25,7 +25,7 @@ export default function NewsDisplay({ // format to readable date const date = moment(createdAt).format('MMMM Do, YYYY'); return ( -
  • +
  • From 8d098d9cb2720d936dbc99328fb7b160eb6f28e4 Mon Sep 17 00:00:00 2001 From: Justin Xue <67207128+jxmoose@users.noreply.github.com> Date: Wed, 22 May 2024 11:17:54 -0700 Subject: [PATCH 4/6] Justin exhibit redo (#67) * added database and page * fixed lint errors lol... * style changes * prettier * added database and page * fixed lint errors lol... * update package-lock * small style * added exhibit component * adding comp * finished? * added to nav bar * removed cateogry for now * prettier changes * feat: disabling github actions until MPH / post-MPH * chore: prettier * chore: disabled only the tsc compiler for now * adding comp * finished? * prettier changes * removed category from table and small fixes * added linking from map * added database and page * fixed lint errors lol... * style changes * prettier * added database and page * fixed lint errors lol... * update package-lock * small style * added exhibit component * adding comp * finished? * added to nav bar * removed cateogry for now * prettier changes * feat: disabling github actions until MPH / post-MPH * chore: prettier * chore: disabled only the tsc compiler for now * adding comp * finished? * prettier changes * removed category from table and small fixes * added linking from map * design changes + adding active state to buttons * big database edits to make fun facts possible on map * supabase function change * documentation changes + tailwind changes * small styling changes * some wbe changes * maybe will make components equal heightsl ater if have time i cant figure it out lol fml * web resize changes * edit nav bar * added database and page * fixed lint errors lol... * style changes * prettier * added database and page * fixed lint errors lol... * update package-lock * small style * added exhibit component * adding comp * finished? * added to nav bar * removed cateogry for now * prettier changes * feat: disabling github actions until MPH / post-MPH * chore: prettier * chore: disabled only the tsc compiler for now * adding comp * finished? * prettier changes * removed category from table and small fixes * added linking from map * added database and page * fixed lint errors lol... * style changes * prettier * fixed lint errors lol... * update package-lock * small style * added exhibit component * adding comp * finished? * added to nav bar * removed cateogry for now * prettier changes * adding comp * finished? * prettier changes * removed category from table and small fixes * added linking from map * design changes + adding active state to buttons * big database edits to make fun facts possible on map * supabase function change * documentation changes + tailwind changes * small styling changes * some wbe changes * maybe will make components equal heightsl ater if have time i cant figure it out lol fml * web resize changes * edit nav bar * small post rebase fixes --------- Co-authored-by: Andrei Tan <73627326+andreisito@users.noreply.github.com> Co-authored-by: sarahhpeng <137237272+sarahhpeng@users.noreply.github.com> --- .github/workflows/lint.yml | 65 ++ src/app/exhibitsPage/page.tsx | 142 ++++ src/app/layout.tsx | 1 - .../userComponents/Exhibit/Exhibit.tsx | 65 ++ .../ExhibitDisplay/ExhibitDisplay.module.css | 124 --- .../SiteMap/DisplayPreviewCard.tsx | 1 - .../SiteMap/ExhibitPreviewCard.tsx | 2 +- .../userComponents/navBar/navBar.tsx | 6 + src/supabase/category/queries.tsx | 16 +- src/supabase/exhibits/queries.tsx | 2 +- src/supabase/tour_displays/queries.tsx | 5 +- src/types/supabase.ts | 767 +++++++++--------- tailwind.config.ts | 3 + 13 files changed, 682 insertions(+), 517 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 src/app/exhibitsPage/page.tsx create mode 100644 src/components/userComponents/Exhibit/Exhibit.tsx delete mode 100644 src/components/userComponents/ExhibitDisplay/ExhibitDisplay.module.css diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..4235a8f7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,65 @@ +--- +name: Lint + +############################# +# Start the job on push # +############################# +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +############### +# Set the Job # +############### +jobs: + build: + # Name the Job + name: Run ESLint, Prettier, and TypeScript compiler + # Set the agent to run on + runs-on: ubuntu-latest + + ################## + # Load all steps # + ################## + steps: + ########################## + # Checkout the code base # + ########################## + - name: Checkout Code + uses: actions/checkout@v3 + with: + # Full git history is needed to get a proper + # list of changed files within `super-linter` + fetch-depth: 0 + + ################################ + # Install packages # + ################################ + - name: Install packages + run: npm ci + ################################ + # Lint codebase # + ################################ + - name: Run ESLint + run: npx lint-staged + ################################ + # Check Prettier on codebase # + ################################ + - name: Run Prettier + run: npx prettier --check . + ################################ + # Check for TypeScript errors # + # TODO: Add this back once outstanding issues are resolved by all devs. + ################################ + # - name: Run TypeScript compiler (tsc) on staged files + # run: | + # # Get list of staged TypeScript files + # files=$(git diff --cached --name-only --diff-filter=d | grep '\.tsx\?$') + + # # Run tsc on each file + # for file in $files + # do + # npx tsc --noEmit $file || exit 1 + # done diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx new file mode 100644 index 00000000..ab4de68d --- /dev/null +++ b/src/app/exhibitsPage/page.tsx @@ -0,0 +1,142 @@ +'use client'; + +import React, { useEffect, useState } from 'react'; +import Link from 'next/link'; +import NavBar from '../../components/userComponents/navBar/navBar'; +import { CategoryRow } from '../../types/types'; +import { fetchAllCategories } from '../../supabase/category/queries'; +import Exhibit from '../../components/userComponents/Exhibit/Exhibit'; +import BackButton from '../../components/userComponents/BackButton/page'; +import { useWebDeviceDetection } from '../../context/WindowWidthContext/WindowWidthContext'; + +/** + * @returns exhibit page + */ +function App() { + const isWebDevice = useWebDeviceDetection(); + const [exhibits, setExhibits] = useState([]); + // fetches all the exhibits to display on the page + useEffect(() => { + // Get exhibits + const getExhibits = async () => { + const fetchedExhibits: CategoryRow[] = await fetchAllCategories(); + setExhibits(fetchedExhibits); + }; + getExhibits(); + // Detect the hash in URL and scroll to the element with the corresponding ID + }, [exhibits]); + + // activates whenever the page opens. + // checks if there's a "hash" which is an id of one of the exhibits to scroll to. + // scrolls down to corresponding exhibit with slight offset + useEffect(() => { + const { hash } = window.location; + if (hash) { + setTimeout(() => { + const element = document.querySelector(hash); + const yOffset = -200; + if (element) { + const y = + element.getBoundingClientRect().top + window.scrollY + yOffset; + // check on this offset later + window.scrollTo({ top: y, behavior: 'instant' }); + } + }, 1000); + } + }, []); + return ( +
    + {!isWebDevice && ( +
    + +
    + +
    +

    + Our Exhibits{' '} +

    +

    + The Bay Area is home to a wide variety of plant and animal life. + As you explore the exhibits, you will learn about threatened and + endangered species that are under careful monitoring by + biologists. Protective conservation efforts are in place for + these vulnerable plants and animals. We welcome you to learn + more about these important species throughout the exhibits. Scan + the QR codes on display for more information. +

    +
    + +
    +

    + Go to Map +

    +
    + +
      + {exhibits.map(exhibit => ( + + ))} +
    +
    +
    + )} + {isWebDevice && ( +
    + +
    +

    + {' '} + + {' '} + Home{' '} + {' '} + / Our Exhibits{' '} +

    +
    +

    + Our Exhibits{' '} +

    +

    + The Bay Area is home to a wide variety of plant and animal life. + As you explore the exhibits, you will learn about threatened and + endangered species that are under careful monitoring by + biologists. Protective conservation efforts are in place for + these vulnerable plants and animals. We welcome you to learn + more about these important species throughout the exhibits. Scan + the QR codes on display for more information. +

    +
    + +
    +

    + Go to Map +

    +
    + +
    + {exhibits.map(exhibit => ( + + ))} +
    +
    +
    + )} +
    + ); +} + +export default App; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index e041b26a..26910912 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -12,7 +12,6 @@ export const metadata: Metadata = { title: 'Create Next App', description: 'Generated by create next app', }; - /** * @param root0 - Destructured object containing the properties. * @param root0.children - The child elements to be rendered within the RootLayout component. diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx new file mode 100644 index 00000000..8a099efc --- /dev/null +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -0,0 +1,65 @@ +import React from 'react'; +import Image from 'next/image'; +import { useWebDeviceDetection } from '../../../context/WindowWidthContext/WindowWidthContext'; + +/** + * + * @param root0 passed in + * @param root0.title title of exhibit + * @param root0.description description of exhibit + * @param root0.image image + * @param root0.id id of exhibit + * @param root0.web + * @returns exhibit component + */ +export default function Exhibit({ + title, + description, + image, + id, +}: { + title: string; + description: string; + image: string; + id: number; +}) { + const isWebDevice = useWebDeviceDetection(); + return ( +
    + {!isWebDevice && ( +
  • +
    +
    +
    +

    + {title} +

    +
    +

    + {description} +

    + Exhibit +
    +
    +
  • + )} + {isWebDevice && ( +
    +
    +
    +

    + {' '} + {title} +

    +
    +

    + {description} +

    +
    + Exhibit +
    +
    + )} +
    + ); +} diff --git a/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.module.css b/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.module.css deleted file mode 100644 index 72391c8d..00000000 --- a/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.module.css +++ /dev/null @@ -1,124 +0,0 @@ -.outercontainer { - background-color: white; - width: 100%; - height: 100%; -} - -.logobox { - background-color: darkgray; - width: 100%; - height: 93px; - padding: 21px; - flex-shrink: 0; -} - -.logo { - background-color: white; - width: 141px; - height: 52px; - flex-shrink: 0; -} - -.imagebox { - width: 100%; - height: 224px; - flex-shrink: 0; - justify-content: center; -} - -.bottombox { - background-color: white; - width: 100%; - height: 1073px; - padding: 18px; -} - -.namebox { - width: 390x; - height: 77px; - padding-top: 37px; - padding-bottom: 11px; - justify-content: flex-start; -} - -.nametext { - color: #0d0b0b; - font-family: Inter; - font-size: 24px; - font-style: normal; - font-weight: 700; - line-height: normal; - letter-spacing: -0.5px; -} - -.locationtext { - color: #0d0b0b; - font-family: Inter; - font-size: 14px; - font-style: italic; - font-weight: 400; - line-height: 20px; /* 142.857% */ - letter-spacing: -0.5px; -} - -.informationbox { - width: 390x; - height: 62px; - padding-top: 27px; - padding-bottom: 11px; - justify-content: flex-start; -} - -.informationtext { - color: #0d0b0b; - font-family: Inter; - font-size: 20px; - font-style: normal; - font-weight: 500; - line-height: normal; - letter-spacing: -0.5px; -} - -.descriptiontext { - color: #0d0b0b; - font-family: Inter; - font-size: 16px; - font-style: normal; - font-weight: 400; - line-height: 20px; /* 125% */ - letter-spacing: -0.5px; - padding-bottom: 16px; -} - -.relatednewsbox { - width: 390x; - height: 78px; - padding-top: 32px; - padding-bottom: 22px; - justify-content: flex-start; -} - -.relatedtext { - color: #0d0b0b; - font-family: Inter; - font-size: 20px; - font-style: normal; - font-weight: 500; - line-height: normal; - letter-spacing: -0.5px; -} - -.newsbox { - width: 100%; - height: 120px; - display: flex; - flex-direction: row; /* Make the items stack vertically */ - justify-content: space-between; /* Distribute space between items vertically */ - align-items: center; - gap: 19px; -} - -.moretextbox { - width: 208px; - height: 120px; -} diff --git a/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx b/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx index eb2e6c49..8b0459af 100644 --- a/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx +++ b/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx @@ -62,7 +62,6 @@ function DisplayPreviewCard({ // const imageObj = await fetchExhibitImage(tour.id); // if (imageObj) { imageUrl = tour.image; - console.log(tour); // } displayName = tour.category; } diff --git a/src/components/userComponents/SiteMap/ExhibitPreviewCard.tsx b/src/components/userComponents/SiteMap/ExhibitPreviewCard.tsx index 2a79e647..f359e9d5 100644 --- a/src/components/userComponents/SiteMap/ExhibitPreviewCard.tsx +++ b/src/components/userComponents/SiteMap/ExhibitPreviewCard.tsx @@ -121,7 +121,7 @@ function ExhibitPreviewCard({ />
    - +

    {name1}

    diff --git a/src/components/userComponents/navBar/navBar.tsx b/src/components/userComponents/navBar/navBar.tsx index c2803076..46cbb9e9 100644 --- a/src/components/userComponents/navBar/navBar.tsx +++ b/src/components/userComponents/navBar/navBar.tsx @@ -74,6 +74,12 @@ export default function NavBar() { > Site Maps + + Exhibits +

    LEARN & EXPLORE diff --git a/src/supabase/category/queries.tsx b/src/supabase/category/queries.tsx index 16e83ac5..1624ba41 100644 --- a/src/supabase/category/queries.tsx +++ b/src/supabase/category/queries.tsx @@ -1,6 +1,6 @@ 'use client'; -import { DisplayRow } from '../../types/types'; +import { CategoryRow } from '../../types/types'; import supabase from '../client'; // eslint-disable-next-line jsdoc/require-returns @@ -22,6 +22,8 @@ import supabase from '../client'; // Assume this function is in `supabase/category/queries.js` /** * + * @param category which category to get color from + * @returns color of category */ // eslint-disable-next-line import/prefer-default-export export async function getCategoryColor1(category: string) { @@ -46,3 +48,15 @@ export async function getCategoryColor1(category: string) { return null; } } + +/** + * Fetches all categories from the database. + * @returns A promise that resolves to an array of ExhibitRow objects. + */ +export async function fetchAllCategories(): Promise { + const { data, error } = await supabase.from('categories').select('*'); + if (error) { + throw new Error(error.message); + } + return data; +} diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index 958b620a..a72d9566 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -40,7 +40,7 @@ export async function fetchExhibitImage( exhibitId: string, ): Promise<{ image: string }> { const { data, error } = await supabase - .from('exhibits') + .from('categories') .select('image') .eq('id', exhibitId) .single(); diff --git a/src/supabase/tour_displays/queries.tsx b/src/supabase/tour_displays/queries.tsx index 66f5522f..2dd16c73 100644 --- a/src/supabase/tour_displays/queries.tsx +++ b/src/supabase/tour_displays/queries.tsx @@ -41,9 +41,8 @@ export async function fetchMatchingTourDisplayIdsfromSpotlight(tourId: string) { * @returns given a spotlight ID, get all the displays */ export async function fetchDisplayfromSpotlight(spotlightId: string) { - const displayIds: string[] = await fetchMatchingTourDisplayIdsfromSpotlight( - spotlightId, - ); + const displayIds: string[] = + await fetchMatchingTourDisplayIdsfromSpotlight(spotlightId); const displays: DisplayRow[] = await fetchDisplaysfromIds(displayIds); return displays; } diff --git a/src/types/supabase.ts b/src/types/supabase.ts index 1b8b1f7f..d2ed141d 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,524 +4,521 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[]; + | Json[] export type Database = { public: { Tables: { categories: { Row: { - category: string | null; - color_hex: string; - created_at: string; - description: string | null; - id: number; - image: string | null; - }; + category: string | null + color_hex: string + created_at: string + description: string + id: number + image: string + } Insert: { - category?: string | null; - color_hex: string; - created_at?: string; - description?: string | null; - id?: number; - image?: string | null; - }; + category?: string | null + color_hex: string + created_at?: string + description: string + id?: number + image: string + } Update: { - category?: string | null; - color_hex?: string; - created_at?: string; - description?: string | null; - id?: number; - image?: string | null; - }; - Relationships: []; - }; + category?: string | null + color_hex?: string + created_at?: string + description?: string + id?: number + image?: string + } + Relationships: [] + } display_media: { Row: { - display_id: string; - media_id: string; - media_placement: string | null; - }; + display_id: string + media_id: string + media_placement: string | null + } Insert: { - display_id: string; - media_id: string; - media_placement?: string | null; - }; + display_id: string + media_id: string + media_placement?: string | null + } Update: { - display_id?: string; - media_id?: string; - media_placement?: string | null; - }; + display_id?: string + media_id?: string + media_placement?: string | null + } Relationships: [ { - foreignKeyName: 'display_media_display_id_fkey'; - columns: ['display_id']; - isOneToOne: false; - referencedRelation: 'displays'; - referencedColumns: ['id']; + foreignKeyName: "display_media_display_id_fkey" + columns: ["display_id"] + isOneToOne: false + referencedRelation: "displays" + referencedColumns: ["id"] }, { - foreignKeyName: 'display_media_media_id_fkey'; - columns: ['media_id']; - isOneToOne: false; - referencedRelation: 'media'; - referencedColumns: ['id']; + foreignKeyName: "display_media_media_id_fkey" + columns: ["media_id"] + isOneToOne: false + referencedRelation: "media" + referencedColumns: ["id"] }, - ]; - }; + ] + } displays: { Row: { - coordinates: Json | null; - created_at: string; - description: string; - id: string; - title: string; - updated_at: string | null; - }; + coordinates: Json | null + created_at: string + description: string + id: string + title: string + updated_at: string | null + } Insert: { - coordinates?: Json | null; - created_at?: string; - description?: string; - id?: string; - title?: string; - updated_at?: string | null; - }; + coordinates?: Json | null + created_at?: string + description?: string + id?: string + title?: string + updated_at?: string | null + } Update: { - coordinates?: Json | null; - created_at?: string; - description?: string; - id?: string; - title?: string; - updated_at?: string | null; - }; - Relationships: []; - }; + coordinates?: Json | null + created_at?: string + description?: string + id?: string + title?: string + updated_at?: string | null + } + Relationships: [] + } emails: { Row: { - emails: string | null; - first_name: string | null; - id: number; - }; + emails: string | null + id: number + } Insert: { - emails?: string | null; - first_name?: string | null; - id?: number; - }; + emails?: string | null + id?: number + } Update: { - emails?: string | null; - first_name?: string | null; - id?: number; - }; - Relationships: []; - }; + emails?: string | null + id?: number + } + Relationships: [] + } exhibits: { Row: { - category_id: number; - coordinates: Json | null; - id: string; - title: string; - }; + category_id: number + coordinates: Json | null + id: string + title: string + } Insert: { - category_id: number; - coordinates?: Json | null; - id?: string; - title: string; - }; + category_id: number + coordinates?: Json | null + id?: string + title: string + } Update: { - category_id?: number; - coordinates?: Json | null; - id?: string; - title?: string; - }; + category_id?: number + coordinates?: Json | null + id?: string + title?: string + } Relationships: [ { - foreignKeyName: 'public_exhibits_category_id_fkey'; - columns: ['category_id']; - isOneToOne: false; - referencedRelation: 'categories'; - referencedColumns: ['id']; + foreignKeyName: "public_exhibits_category_id_fkey" + columns: ["category_id"] + isOneToOne: false + referencedRelation: "categories" + referencedColumns: ["id"] }, - ]; - }; + ] + } media: { Row: { - created_at: string; - id: string; - text: string | null; - title: string | null; - type: string | null; - url: string; - }; + created_at: string + id: string + text: string | null + title: string | null + type: string | null + url: string + } Insert: { - created_at?: string; - id?: string; - text?: string | null; - title?: string | null; - type?: string | null; - url?: string; - }; + created_at?: string + id?: string + text?: string | null + title?: string | null + type?: string | null + url?: string + } Update: { - created_at?: string; - id?: string; - text?: string | null; - title?: string | null; - type?: string | null; - url?: string; - }; - Relationships: []; - }; + created_at?: string + id?: string + text?: string | null + title?: string | null + type?: string | null + url?: string + } + Relationships: [] + } news: { Row: { - content_link: string; - created_at: string; - id: string; - title: string; - updated_at: string | null; - }; + content_link: string + created_at: string + id: string + title: string + updated_at: string | null + } Insert: { - content_link: string; - created_at?: string; - id?: string; - title: string; - updated_at?: string | null; - }; + content_link: string + created_at?: string + id?: string + title: string + updated_at?: string | null + } Update: { - content_link?: string; - created_at?: string; - id?: string; - title?: string; - updated_at?: string | null; - }; - Relationships: []; - }; + content_link?: string + created_at?: string + id?: string + title?: string + updated_at?: string | null + } + Relationships: [] + } spotlight_recommendations: { Row: { - source_display_id: string; - target_display_id: string; - }; + source_display_id: string + target_display_id: string + } Insert: { - source_display_id: string; - target_display_id: string; - }; + source_display_id: string + target_display_id: string + } Update: { - source_display_id?: string; - target_display_id?: string; - }; + source_display_id?: string + target_display_id?: string + } Relationships: [ { - foreignKeyName: 'spotlight_recommendations_source_display_id_fkey'; - columns: ['source_display_id']; - isOneToOne: false; - referencedRelation: 'tours'; - referencedColumns: ['id']; + foreignKeyName: "spotlight_recommendations_source_display_id_fkey" + columns: ["source_display_id"] + isOneToOne: false + referencedRelation: "tours" + referencedColumns: ["id"] }, { - foreignKeyName: 'spotlight_recommendations_target_display_id_fkey'; - columns: ['target_display_id']; - isOneToOne: false; - referencedRelation: 'tours'; - referencedColumns: ['id']; + foreignKeyName: "spotlight_recommendations_target_display_id_fkey" + columns: ["target_display_id"] + isOneToOne: false + referencedRelation: "tours" + referencedColumns: ["id"] }, - ]; - }; + ] + } tour_displays: { Row: { - display_id: string; - display_order: number | null; - tour_id: string; - }; + display_id: string + display_order: number | null + tour_id: string + } Insert: { - display_id: string; - display_order?: number | null; - tour_id: string; - }; + display_id: string + display_order?: number | null + tour_id: string + } Update: { - display_id?: string; - display_order?: number | null; - tour_id?: string; - }; + display_id?: string + display_order?: number | null + tour_id?: string + } Relationships: [ { - foreignKeyName: 'tour_displays_display_id_fkey'; - columns: ['display_id']; - isOneToOne: false; - referencedRelation: 'displays'; - referencedColumns: ['id']; + foreignKeyName: "tour_displays_display_id_fkey" + columns: ["display_id"] + isOneToOne: false + referencedRelation: "displays" + referencedColumns: ["id"] }, { - foreignKeyName: 'tour_displays_tour_id_fkey'; - columns: ['tour_id']; - isOneToOne: false; - referencedRelation: 'tours'; - referencedColumns: ['id']; + foreignKeyName: "tour_displays_tour_id_fkey" + columns: ["tour_id"] + isOneToOne: false + referencedRelation: "tours" + referencedColumns: ["id"] }, - ]; - }; + ] + } tour_media: { Row: { - media_id: string; - tour_id: string; - }; + media_id: string + tour_id: string + } Insert: { - media_id: string; - tour_id: string; - }; + media_id: string + tour_id: string + } Update: { - media_id?: string; - tour_id?: string; - }; + media_id?: string + tour_id?: string + } Relationships: [ { - foreignKeyName: 'tour_media_media_id_fkey'; - columns: ['media_id']; - isOneToOne: false; - referencedRelation: 'media'; - referencedColumns: ['id']; + foreignKeyName: "tour_media_media_id_fkey" + columns: ["media_id"] + isOneToOne: false + referencedRelation: "media" + referencedColumns: ["id"] }, { - foreignKeyName: 'tour_media_tour_id_fkey'; - columns: ['tour_id']; - isOneToOne: false; - referencedRelation: 'tours'; - referencedColumns: ['id']; + foreignKeyName: "tour_media_tour_id_fkey" + columns: ["tour_id"] + isOneToOne: false + referencedRelation: "tours" + referencedColumns: ["id"] }, - ]; - }; + ] + } tours: { Row: { - category: Database['public']['Enums']['tour_category']; - coordinates: Json | null; - created_at: string; - description: string | null; - id: string; - name: string; - preview_text: string | null; - spotlight: boolean; - stop_count: number | null; - }; + category: Database["public"]["Enums"]["tour_category"] + coordinates: Json | null + created_at: string + description: string | null + id: string + name: string + preview_text: string | null + spotlight: boolean + stop_count: number | null + } Insert: { - category?: Database['public']['Enums']['tour_category']; - coordinates?: Json | null; - created_at?: string; - description?: string | null; - id?: string; - name: string; - preview_text?: string | null; - spotlight?: boolean; - stop_count?: number | null; - }; + category?: Database["public"]["Enums"]["tour_category"] + coordinates?: Json | null + created_at?: string + description?: string | null + id?: string + name: string + preview_text?: string | null + spotlight?: boolean + stop_count?: number | null + } Update: { - category?: Database['public']['Enums']['tour_category']; - coordinates?: Json | null; - created_at?: string; - description?: string | null; - id?: string; - name?: string; - preview_text?: string | null; - spotlight?: boolean; - stop_count?: number | null; - }; - Relationships: []; - }; - }; + category?: Database["public"]["Enums"]["tour_category"] + coordinates?: Json | null + created_at?: string + description?: string | null + id?: string + name?: string + preview_text?: string | null + spotlight?: boolean + stop_count?: number | null + } + Relationships: [] + } + } Views: { - [_ in never]: never; - }; + [_ in never]: never + } Functions: { fetch_recommended_spotlights: { Args: { - source_spotlight_id: string; - }; + source_spotlight_id: string + } Returns: { - id: string; - name: string; - description: string; - created_at: string; - stop_count: number; - spotlight: boolean; - preview_text: string; - coordinates: Json; - category: Database['public']['Enums']['tour_category']; - }[]; - }; + id: string + name: string + description: string + created_at: string + stop_count: number + spotlight: boolean + preview_text: string + coordinates: Json + category: Database["public"]["Enums"]["tour_category"] + }[] + } fetchimagesfordisplay: { Args: { - displayid: string; - }; + displayid: string + } Returns: { - id: string; - url: string; - type: string; - title: string; - text: string; - created_at: string; - }[]; - }; + id: string + url: string + type: string + title: string + text: string + created_at: string + }[] + } fetchimagesfortour: { Args: { - tourid: string; - }; + tourid: string + } Returns: { - id: string; - url: string; - type: string; - title: string; - text: string; - created_at: string; - }[]; - }; + id: string + url: string + type: string + title: string + text: string + created_at: string + }[] + } get_category_color: { Args: { - category_in: string; - }; - Returns: string; - }; + category_in: string + } + Returns: string + } get_exhibit_details: { - Args: Record; + Args: Record Returns: { - coordinates: Json; - id: number; - category: string; - description: string; - image: string; - }[]; - }; + coordinates: Json + category_id: number + category: string + description: string + image: string + }[] + } get_non_spotlight_tours: { - Args: Record; + Args: Record Returns: { - id: string; - name: string; - description: string; - created_at: string; - stop_count: number; - spotlight: boolean; - preview_text: string; - coordinates: Json; - category: Database['public']['Enums']['tour_category']; - }[]; - }; + id: string + name: string + description: string + created_at: string + stop_count: number + spotlight: boolean + preview_text: string + coordinates: Json + category: Database["public"]["Enums"]["tour_category"] + }[] + } join_all_spotlights_with_media: { - Args: Record; + Args: Record Returns: { - id: string; - name: string; - description: string; - created_at: string; - stop_count: number; - spotlight: boolean; - preview_text: string; - coordinates: Json; - category: Database['public']['Enums']['tour_category']; - media_url: string; - }[]; - }; + id: string + name: string + description: string + created_at: string + stop_count: number + spotlight: boolean + preview_text: string + coordinates: Json + category: Database["public"]["Enums"]["tour_category"] + media_url: string + }[] + } join_all_tours_with_media: { - Args: Record; + Args: Record Returns: { - id: string; - name: string; - description: string; - created_at: string; - stop_count: number; - spotlight: boolean; - preview_text: string; - coordinates: Json; - category: Database['public']['Enums']['tour_category']; - media_url: string; - }[]; - }; - }; + id: string + name: string + description: string + created_at: string + stop_count: number + spotlight: boolean + preview_text: string + coordinates: Json + category: Database["public"]["Enums"]["tour_category"] + media_url: string + }[] + } + } Enums: { - media_type: 'image' | 'video' | 'link'; + media_type: "image" | "video" | "link" tour_category: - | 'BuildingsAndServices' - | 'ParksAviariesEnclosures' - | 'SiteFeatures'; - }; + | "BuildingsAndServices" + | "ParksAviariesEnclosures" + | "SiteFeatures" + } CompositeTypes: { - [_ in never]: never; - }; - }; -}; + [_ in never]: never + } + } +} -type PublicSchema = Database[Extract]; +type PublicSchema = Database[Extract] export type Tables< PublicTableNameOrOptions extends - | keyof (PublicSchema['Tables'] & PublicSchema['Views']) + | keyof (PublicSchema["Tables"] & PublicSchema["Views"]) | { schema: keyof Database }, TableName extends PublicTableNameOrOptions extends { schema: keyof Database } - ? keyof (Database[PublicTableNameOrOptions['schema']]['Tables'] & - Database[PublicTableNameOrOptions['schema']]['Views']) + ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"]) : never = never, > = PublicTableNameOrOptions extends { schema: keyof Database } - ? (Database[PublicTableNameOrOptions['schema']]['Tables'] & - Database[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends { - Row: infer R; + ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends { + Row: infer R } ? R : never - : PublicTableNameOrOptions extends keyof (PublicSchema['Tables'] & - PublicSchema['Views']) - ? (PublicSchema['Tables'] & - PublicSchema['Views'])[PublicTableNameOrOptions] extends { - Row: infer R; - } - ? R + : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & + PublicSchema["Views"]) + ? (PublicSchema["Tables"] & + PublicSchema["Views"])[PublicTableNameOrOptions] extends { + Row: infer R + } + ? R + : never : never - : never; export type TablesInsert< PublicTableNameOrOptions extends - | keyof PublicSchema['Tables'] + | keyof PublicSchema["Tables"] | { schema: keyof Database }, TableName extends PublicTableNameOrOptions extends { schema: keyof Database } - ? keyof Database[PublicTableNameOrOptions['schema']]['Tables'] + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] : never = never, > = PublicTableNameOrOptions extends { schema: keyof Database } - ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { - Insert: infer I; + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Insert: infer I } ? I : never - : PublicTableNameOrOptions extends keyof PublicSchema['Tables'] - ? PublicSchema['Tables'][PublicTableNameOrOptions] extends { - Insert: infer I; - } - ? I + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never : never - : never; export type TablesUpdate< PublicTableNameOrOptions extends - | keyof PublicSchema['Tables'] + | keyof PublicSchema["Tables"] | { schema: keyof Database }, TableName extends PublicTableNameOrOptions extends { schema: keyof Database } - ? keyof Database[PublicTableNameOrOptions['schema']]['Tables'] + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] : never = never, > = PublicTableNameOrOptions extends { schema: keyof Database } - ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { - Update: infer U; + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Update: infer U } ? U : never - : PublicTableNameOrOptions extends keyof PublicSchema['Tables'] - ? PublicSchema['Tables'][PublicTableNameOrOptions] extends { - Update: infer U; - } - ? U + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Update: infer U + } + ? U + : never : never - : never; export type Enums< PublicEnumNameOrOptions extends - | keyof PublicSchema['Enums'] + | keyof PublicSchema["Enums"] | { schema: keyof Database }, EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } - ? keyof Database[PublicEnumNameOrOptions['schema']]['Enums'] + ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] : never = never, > = PublicEnumNameOrOptions extends { schema: keyof Database } - ? Database[PublicEnumNameOrOptions['schema']]['Enums'][EnumName] - : PublicEnumNameOrOptions extends keyof PublicSchema['Enums'] - ? PublicSchema['Enums'][PublicEnumNameOrOptions] - : never; + ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] + : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] + ? PublicSchema["Enums"][PublicEnumNameOrOptions] + : never diff --git a/tailwind.config.ts b/tailwind.config.ts index c8caf550..89c4f6ea 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -28,6 +28,9 @@ const config: Config = { 'gradient-conic': 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))', }, + screens: { + web: '1024px', + }, /** Default font is Lato */ fontFamily: { sans: ['Lato'], From 12de2a26bf6cd91bfd2a0529dce687dcbd4bca99 Mon Sep 17 00:00:00 2001 From: David Qing <41662609+davidqing6432@users.noreply.github.com> Date: Wed, 22 May 2024 11:34:07 -0700 Subject: [PATCH 5/6] fixed all eslint errors, still some warnings, introduced some ignores (#70) Co-authored-by: sarahhpeng <137237272+sarahhpeng@users.noreply.github.com> --- .../userComponents/emailPopup/page.tsx | 36 ++++++++++--------- .../userComponents/navBar/navBar.tsx | 2 +- src/supabase/category/queries.ts | 4 +-- src/supabase/category/queries.tsx | 4 +-- src/supabase/displays/queries.tsx | 10 +++--- tailwind.config.ts | 1 + 6 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/components/userComponents/emailPopup/page.tsx b/src/components/userComponents/emailPopup/page.tsx index e9c1518d..b1e40683 100644 --- a/src/components/userComponents/emailPopup/page.tsx +++ b/src/components/userComponents/emailPopup/page.tsx @@ -1,6 +1,6 @@ 'use client'; -import React, { Fragment, useState } from 'react'; +import React, { ChangeEventHandler, Fragment, useState } from 'react'; import { Dialog, Transition } from '@headlessui/react'; import { PiPaperPlaneTiltBold, PiSealCheck } from 'react-icons/pi'; import { VscClose } from 'react-icons/vsc'; @@ -10,8 +10,9 @@ import supabase from '../../../supabase/client'; /** * - * @param root0 - * @param root0.backLink + * @param props - props + * @param props.backLink - the link to the page the user will be directed to after they subscribe + * @returns an email pop up. */ function EmailSuccess({ backLink }: { backLink: string }) { return ( @@ -47,7 +48,9 @@ function EmailSuccess({ backLink }: { backLink: string }) { type EmailInputProps = { inputValue: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any handleChange: (e: any) => void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any handleSubmit: (e: any) => void; showError: boolean; errorMsg: string; @@ -55,12 +58,13 @@ type EmailInputProps = { /** * - * @param root0 - * @param root0.inputValue - * @param root0.handleChange - * @param root0.handleSubmit - * @param root0.showError - * @param root0.errorMsg + * @param props - props + * @param props.inputValue - the value of the email input + * @param props.handleChange - the function that handles the change of the email input + * @param props.handleSubmit - the function that handles the submission of the email input + * @param props.showError - a boolean that determines if the error message should be shown + * @param props.errorMsg - the error message that will be shown if showError is true + * @returns an email pop up. */ function EmailInput({ inputValue, @@ -125,10 +129,8 @@ function EmailInput({ } /** - * @param root0 - * @param root0.backLink - * @param root0 - * @param root0.backLink + * @param props - props + * @param props.backLink - the link to the page the user will be directed to after they subscribe * @returns an email pop up. * if no email is entered and the user clicks the submit button, an error message will pop up. * if an invalid email is entered and the user clicks the submit button, another error message will pop up. @@ -145,19 +147,21 @@ export default function EmailPopup({ backLink }: { backLink: string }) { setIsOpen(false); }; - const handleChange = e => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const handleChange = (e : any) => { setInputValue(e.target.value); setShowError(false); }; // const { error } = await supabase.from('emails').insert({ id: 1, name: 'Denmark' }) - const isValidEmail = email => { + const isValidEmail = (email : string) => { const emailRegex = /^[^\s@]+@[^\s@]+\.(com|ca)$/; return emailRegex.test(email); }; - const handleSubmit = async e => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any, consistent-return + const handleSubmit = async (e : any) => { e.preventDefault(); if (!inputValue.trim()) { diff --git a/src/components/userComponents/navBar/navBar.tsx b/src/components/userComponents/navBar/navBar.tsx index 46cbb9e9..c524076f 100644 --- a/src/components/userComponents/navBar/navBar.tsx +++ b/src/components/userComponents/navBar/navBar.tsx @@ -100,7 +100,7 @@ export default function NavBar() { href="/newsFeedPage" className="text-night font-lato text-lg font-bold block relative left-4 mt-[1.25rem]" > - News Feed + News

    diff --git a/src/supabase/category/queries.ts b/src/supabase/category/queries.ts index 4a81885a..392f6f85 100644 --- a/src/supabase/category/queries.ts +++ b/src/supabase/category/queries.ts @@ -5,9 +5,7 @@ import { CategoryRow } from '../../types/types'; // Assume this function is in `supabase/category/queries.js` /** * - * @param category category to retreive color - - * @param id + * @param id category id to retreive color for * @returns color for category, else null */ // eslint-disable-next-line import/prefer-default-export diff --git a/src/supabase/category/queries.tsx b/src/supabase/category/queries.tsx index 1624ba41..94dd2157 100644 --- a/src/supabase/category/queries.tsx +++ b/src/supabase/category/queries.tsx @@ -22,8 +22,8 @@ import supabase from '../client'; // Assume this function is in `supabase/category/queries.js` /** * - * @param category which category to get color from - * @returns color of category + * @param category - The category for which you want to fetch the color + * @returns The color for the category */ // eslint-disable-next-line import/prefer-default-export export async function getCategoryColor1(category: string) { diff --git a/src/supabase/displays/queries.tsx b/src/supabase/displays/queries.tsx index 6b3fbd7d..ce7e37db 100644 --- a/src/supabase/displays/queries.tsx +++ b/src/supabase/displays/queries.tsx @@ -4,7 +4,7 @@ import { DisplayRow } from '../../types/types'; import supabase from '../client'; /** - * + * @returns all displays from the database */ export async function fetchAllDisplays() { const { data, error } = await supabase.from('displays').select('*'); @@ -16,7 +16,8 @@ export async function fetchAllDisplays() { /** * - * @param id + * @param id - display id + * @returns a display from the database */ export async function fetchDisplay(id: string) { const { data, error } = await supabase @@ -32,7 +33,7 @@ export async function fetchDisplay(id: string) { /** * - * @param id + * @param id - display id */ export async function deleteDisplay(id: string) { const { error } = await supabase.from('displays').delete().eq('id', id); @@ -46,7 +47,8 @@ export async function deleteDisplay(id: string) { /** * - * @param displayData + * @param displayData - the display row to create + * @returns the new display row */ export async function createDisplay(displayData: DisplayRow) { const { data, error } = await supabase.from('displays').upsert([displayData]); diff --git a/tailwind.config.ts b/tailwind.config.ts index 89c4f6ea..d2cbeddb 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -57,6 +57,7 @@ const config: Config = { }, }, }, + // eslint-disable-next-line import/no-extraneous-dependencies, global-require plugins: [require('daisyui')], }; export default config; From bf76b4c6dd012b4ea2e2c9913e0d39526476b58b Mon Sep 17 00:00:00 2001 From: David Qing <41662609+davidqing6432@users.noreply.github.com> Date: Wed, 22 May 2024 12:06:23 -0700 Subject: [PATCH 6/6] fixed remaining errors (#71) --- src/components/userComponents/Exhibit/Exhibit.tsx | 1 - src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 8a099efc..579d7770 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -9,7 +9,6 @@ import { useWebDeviceDetection } from '../../../context/WindowWidthContext/Windo * @param root0.description description of exhibit * @param root0.image image * @param root0.id id of exhibit - * @param root0.web * @returns exhibit component */ export default function Exhibit({ diff --git a/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx b/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx index 087d0be3..5845cb96 100644 --- a/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx +++ b/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx @@ -1,5 +1,6 @@ import React from 'react'; import Image from 'next/image'; +// eslint-disable-next-line import/no-unresolved import styles from './ExhibitDisplay.module.css'; /**