From 93c450f35e395a445f8cb396a5afc47b361e6c78 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 10 Mar 2024 17:57:20 -0700 Subject: [PATCH 001/103] added database and page --- database.types.ts | 0 src/app/exhibitsPage/page.tsx | 30 ++++++++++++++ src/supabase/exhibits/queries.tsx | 65 +++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 database.types.ts create mode 100644 src/app/exhibitsPage/page.tsx diff --git a/database.types.ts b/database.types.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx new file mode 100644 index 00000000..5d604ba5 --- /dev/null +++ b/src/app/exhibitsPage/page.tsx @@ -0,0 +1,30 @@ +'use client'; + +import React, { useEffect, useState} from 'react'; +import NavBar from '../../components/userComponents/navBar/navBar'; +import { ExhibitRow } from '../../types/types'; +import { fetchAllExhibits } from '../../supabase/exhibits/queries'; + +function App() { + const [exhibits, setExhibits] = useState([]); + useEffect(() => { + // Get exhibits + const getExhibits = async () => { + const fetchedExhibits: ExhibitRow[] = await fetchAllExhibits(); + setExhibits(fetchedExhibits); + }; + getExhibits(); + }, [exhibits]); + return ( +
+ +
+

+ Exhibits +

+
+
+ ); +} + +export default App; \ No newline at end of file diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index 7277c03b..cd63690d 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -1,5 +1,6 @@ 'use client'; +<<<<<<< HEAD import supabase from '../client'; import { ExhibitRow } from '../../types/types'; @@ -11,10 +12,23 @@ export async function fetchAllExhibits(): Promise { const { data, error } = await supabase.from('exhibits').select('*'); if (error) { throw new Error(error.message); +======= +import { ExhibitRow } from '../../types/types'; +import supabase from '../client'; + +/** + * + */ +export async function fetchAllExhibits() { + const { data, error } = await supabase.from('exhibits').select('*'); + if (error) { + throw new Error(`An error occurred trying to read exhibits: ${error}`); +>>>>>>> b191485 (added database and page) } return data; } +<<<<<<< HEAD /** @@ -114,3 +128,54 @@ export async function deleteExhibit(exhibitId: string): Promise>>>>>> b191485 (added database and page) From c5666c0aa8328f1f7eb93c0c7ebe803ddd67c5ba Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 10 Mar 2024 18:10:33 -0700 Subject: [PATCH 002/103] fixed lint errors lol... --- src/supabase/exhibits/queries.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index cd63690d..a6b239bb 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -17,7 +17,8 @@ import { ExhibitRow } from '../../types/types'; import supabase from '../client'; /** - * + * @params nothing + * @returns all exhibits */ export async function fetchAllExhibits() { const { data, error } = await supabase.from('exhibits').select('*'); @@ -132,6 +133,7 @@ export async function deleteExhibit(exhibitId: string): Promise Date: Sun, 10 Mar 2024 18:25:13 -0700 Subject: [PATCH 003/103] style changes --- src/supabase/exhibits/queries.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index a6b239bb..31809df5 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -17,7 +17,6 @@ import { ExhibitRow } from '../../types/types'; import supabase from '../client'; /** - * @params nothing * @returns all exhibits */ export async function fetchAllExhibits() { @@ -132,7 +131,7 @@ export async function deleteExhibit(exhibitId: string): Promise Date: Sun, 10 Mar 2024 18:41:09 -0700 Subject: [PATCH 004/103] prettier --- src/app/exhibitsPage/page.tsx | 8 ++++---- src/supabase/exhibits/queries.tsx | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 5d604ba5..4900fd04 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -1,19 +1,19 @@ 'use client'; -import React, { useEffect, useState} from 'react'; +import React, { useEffect, useState } from 'react'; import NavBar from '../../components/userComponents/navBar/navBar'; import { ExhibitRow } from '../../types/types'; import { fetchAllExhibits } from '../../supabase/exhibits/queries'; function App() { - const [exhibits, setExhibits] = useState([]); + const [exhibits, setExhibits] = useState([]); useEffect(() => { // Get exhibits const getExhibits = async () => { const fetchedExhibits: ExhibitRow[] = await fetchAllExhibits(); setExhibits(fetchedExhibits); }; - getExhibits(); + getExhibits(); }, [exhibits]); return (
@@ -27,4 +27,4 @@ function App() { ); } -export default App; \ No newline at end of file +export default App; diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index 31809df5..b7269a3c 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -180,4 +180,7 @@ export async function updateExhibit(id: number, updatedInfo: ExhibitRow) { const newExhibit = data; return newExhibit; } +<<<<<<< HEAD >>>>>>> b191485 (added database and page) +======= +>>>>>>> 7599b67 (prettier) From 9e249e31228e58707deac8bd4d0b8e287e500fa1 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 10 Mar 2024 17:57:20 -0700 Subject: [PATCH 005/103] added database and page --- src/app/exhibitsPage/page.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 4900fd04..9e4903c5 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -5,6 +5,9 @@ import NavBar from '../../components/userComponents/navBar/navBar'; import { ExhibitRow } from '../../types/types'; import { fetchAllExhibits } from '../../supabase/exhibits/queries'; +/** + * + */ function App() { const [exhibits, setExhibits] = useState([]); useEffect(() => { From 531641dfdec898553b4499b9e5c50a5aa1ac221d Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 10 Mar 2024 18:10:33 -0700 Subject: [PATCH 006/103] fixed lint errors lol... --- src/supabase/exhibits/queries.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index b7269a3c..14e6ddf5 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -17,6 +17,7 @@ import { ExhibitRow } from '../../types/types'; import supabase from '../client'; /** + * @params nothing * @returns all exhibits */ export async function fetchAllExhibits() { @@ -131,7 +132,7 @@ export async function deleteExhibit(exhibitId: string): Promise Date: Sun, 10 Mar 2024 18:13:47 -0700 Subject: [PATCH 007/103] update package-lock --- src/supabase/exhibits/queries.tsx | 70 ++++++++++++++----------------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index 14e6ddf5..90e6b8b5 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -14,13 +14,12 @@ export async function fetchAllExhibits(): Promise { throw new Error(error.message); ======= import { ExhibitRow } from '../../types/types'; -import supabase from '../client'; /** - * @params nothing - * @returns all exhibits + * Fetches all tours from the database. + * @returns A promise that resolves to an array of ExhibitRow objects. */ -export async function fetchAllExhibits() { +export async function fetchAllExhibits(): Promise { const { data, error } = await supabase.from('exhibits').select('*'); if (error) { throw new Error(`An error occurred trying to read exhibits: ${error}`); @@ -131,57 +130,50 @@ export async function deleteExhibit(exhibitId: string): Promise { + const { data, error } = await supabase + .from('exhibits') + .update(newExhibitData) + .eq('id', newExhibitData.id); if (error) { - throw new Error(`An error occurred trying to delete displays: ${error}`); - } else { - fetchAllExhibits(); + throw new Error(error.message); } + return data; } /** - * - * @param exhibitData - * @returns new exhibit row + * Upserts a single exhibit into the database. + * @param exhibitData - The exhibit to upsert. + * @returns A promise that resolves to a ExhibitRow object. */ -export async function createExhibit(exhibitData: ExhibitRow) { - const { data, error } = await supabase.from('exhibits').upsert([exhibitData]); - +export async function upsertTour(exhibitData: ExhibitRow): Promise { + const { data, error } = await supabase.from('exhibits').upsert(exhibitData); if (error) { - throw new Error( - `An error occurred trying to create displays: ${error.message}`, - ); + throw new Error(error.message); } - const newExhibit = data; - return newExhibit; + return data; } /** - * - * @param id - id number - * @param updatedInfo - the exhibit row to update - * @returns - updates that given exhibit row + * Deletes a single exhibit from the database. + * @param exhibitId - The id of the exhibit to delete. + * @returns A promise that resolves to a ExhibitRow object. */ -export async function updateExhibit(id: number, updatedInfo: ExhibitRow) { +export async function deleteExhibit(exhibitId: string): Promise { const { data, error } = await supabase .from('exhibits') - .update(updatedInfo) - .eq('id', updatedInfo.id); - + .delete() + .eq('id', exhibitId); if (error) { - throw new Error(`Error updating exhibit data: ${error.message}`); + throw new Error(error.message); } - - const newExhibit = data; - return newExhibit; + return data; } -<<<<<<< HEAD + >>>>>>> b191485 (added database and page) -======= ->>>>>>> 7599b67 (prettier) From f870a0b2a8f70991120f3dd8fc46d9bd6aa761f3 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 10 Mar 2024 19:17:59 -0700 Subject: [PATCH 008/103] small style --- src/app/exhibitsPage/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 9e4903c5..5086a0cf 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -6,7 +6,7 @@ import { ExhibitRow } from '../../types/types'; import { fetchAllExhibits } from '../../supabase/exhibits/queries'; /** - * + * @returns exhibit page */ function App() { const [exhibits, setExhibits] = useState([]); From 6acd1b9a459491bbb2dff480bbc3488dba731663 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sat, 16 Mar 2024 11:44:39 -0700 Subject: [PATCH 009/103] added exhibit component --- .../userComponents/Exhibit/Exhibit.tsx | 26 ++++ .../ExhibitDisplay/ExhibitDisplay.module.css | 124 ------------------ .../ExhibitDisplay/ExhibitDisplay.tsx | 13 ++ 3 files changed, 39 insertions(+), 124 deletions(-) create mode 100644 src/components/userComponents/Exhibit/Exhibit.tsx delete mode 100644 src/components/userComponents/ExhibitDisplay/ExhibitDisplay.module.css diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx new file mode 100644 index 00000000..499a2e68 --- /dev/null +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -0,0 +1,26 @@ +import React from 'react'; + +/** + * + * @param root0 + * @param root0.title + * @param root0.createdAt + * @param root0.contentLink + * @param root0.id + * @returns exhibit component + */ +export default function Exhibit({ + title, + createdAt, + contentLink, + id, + }: { + title: string; + createdAt: string; + contentLink: string; + id: string; + }) { + return ( +
  • + ); + } \ No newline at end of file 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/ExhibitDisplay/ExhibitDisplay.tsx b/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx index 8a063bf2..1c0db706 100644 --- a/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx +++ b/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx @@ -2,6 +2,19 @@ import React from 'react'; import Image from 'next/image'; import styles from './ExhibitDisplay.module.css'; +/** + * + * @param root0 + * @param root0.name + * @param root0.location + * @param root0.information + * @param root0.description + * @param root0.relatednews + * @param root0.topimage + * @param root0.media + * @param root0.bottomimage + * @param root0.moretext + */ export default function ExhibitDisplay({ name, location, From f0cf2086ae88fd40022b6c48f39281b1dab20ed9 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sat, 16 Mar 2024 12:24:26 -0700 Subject: [PATCH 010/103] adding comp --- src/app/exhibitsPage/page.tsx | 37 ++++++++++++++++--- .../userComponents/Exhibit/Exhibit.tsx | 33 +++++++++++++++++ 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 5086a0cf..4659101b 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -1,10 +1,33 @@ 'use client'; import React, { useEffect, useState } from 'react'; +import { IoIosArrowRoundBack } from 'react-icons/io'; import NavBar from '../../components/userComponents/navBar/navBar'; import { ExhibitRow } from '../../types/types'; import { fetchAllExhibits } from '../../supabase/exhibits/queries'; +/** + * @param evt on click of button + */ +function goBack(evt: React.SyntheticEvent) { + // ignore the native anchor action + evt.preventDefault(); + + window.history.back(); +} + +/** + * @returns back button + */ +function BackButton() { + return ( + + ); +} + /** * @returns exhibit page */ @@ -19,12 +42,14 @@ function App() { getExhibits(); }, [exhibits]); return ( -
    - -
    -

    - Exhibits -

    +
    + +
    + +
    +
    Our Exhibits
    +
    Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with protective efforts in place.
    +
    ); diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 499a2e68..28df4470 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { IoIosArrowRoundBack } from 'react-icons/io'; /** * @@ -9,6 +10,38 @@ import React from 'react'; * @param root0.id * @returns exhibit component */ + +/** + * @param evt on click of button + */ +function goBack(evt: React.SyntheticEvent) { + // ignore the native anchor action + evt.preventDefault(); + + window.history.back(); + } + + /** + * @returns back button + */ + function BackButton() { + return ( + + ); + } + +/** + * + * @param root0 + * @param root0.title + * @param root0.createdAt + * @param root0.contentLink + * @param root0.id + * @returns exhibit page + */ export default function Exhibit({ title, createdAt, From bd9d09fbfdb1e10e7bc39847e8014871497d091c Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sat, 16 Mar 2024 14:33:29 -0700 Subject: [PATCH 011/103] finished? --- src/app/exhibitsPage/page.tsx | 22 +- .../userComponents/Exhibit/Exhibit.tsx | 67 ++--- src/types/supabase.ts | 251 ++++++++++-------- 3 files changed, 173 insertions(+), 167 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 4659101b..ba54ab22 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -1,10 +1,12 @@ 'use client'; import React, { useEffect, useState } from 'react'; +import Link from 'next/link'; import { IoIosArrowRoundBack } from 'react-icons/io'; import NavBar from '../../components/userComponents/navBar/navBar'; import { ExhibitRow } from '../../types/types'; import { fetchAllExhibits } from '../../supabase/exhibits/queries'; +import Exhibit from '../../components/userComponents/Exhibit/Exhibit'; /** * @param evt on click of button @@ -21,7 +23,7 @@ function goBack(evt: React.SyntheticEvent) { */ function BackButton() { return ( - @@ -42,14 +44,22 @@ function App() { getExhibits(); }, [exhibits]); return ( -
    +
    -
    +
    -
    -
    Our Exhibits
    -
    Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with protective efforts in place.
    +
    +
    Our Exhibits
    +
    Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with protective efforts in place.
    + +
    +
    Go to Map
    +
    + + {exhibits.map(exhibit => ( + + ))}
    ); diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 28df4470..e9f14eba 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -1,59 +1,40 @@ import React from 'react'; -import { IoIosArrowRoundBack } from 'react-icons/io'; +import Image from 'next/image'; /** * - * @param root0 - * @param root0.title - * @param root0.createdAt - * @param root0.contentLink - * @param root0.id + * @param root0 passed in + * @param root0.title title of exhibit + * @param root0.description description of exhibit + * @param root0.category category of exhibit + * @param root0.image image + * @param root0.id id of exhibit * @returns exhibit component */ - -/** - * @param evt on click of button - */ -function goBack(evt: React.SyntheticEvent) { - // ignore the native anchor action - evt.preventDefault(); - - window.history.back(); - } - - /** - * @returns back button - */ - function BackButton() { - return ( - - ); - } - -/** - * - * @param root0 - * @param root0.title - * @param root0.createdAt - * @param root0.contentLink - * @param root0.id - * @returns exhibit page - */ export default function Exhibit({ title, - createdAt, - contentLink, + description, + category, + image, id, }: { title: string; - createdAt: string; - contentLink: string; + description: string; + category: string; + image: string; id: string; }) { return ( -
  • +
      +
      +
      +
      +
      {title}
      +
      +
      {description}
      + Exhibit +
      +
      +
    ); } \ No newline at end of file diff --git a/src/types/supabase.ts b/src/types/supabase.ts index a17849f5..d4a27bca 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,7 +4,7 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[]; + | Json[] export type Database = { public: { @@ -32,46 +32,46 @@ export type Database = { } 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; @@ -92,21 +92,21 @@ export type Database = { }; 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; @@ -119,97 +119,97 @@ export type Database = { }; 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"] @@ -272,12 +272,14 @@ export type Database = { }; }; Views: { - [_ in never]: never; - }; + [_ in never]: never + } Functions: { fetchimagesfordisplay: { Args: { displayid: string + } + displayid: string } Returns: { id: string @@ -287,6 +289,14 @@ export type Database = { text: string created_at: string }[] + } + id: string + url: string + type: string + title: string + text: string + created_at: string + }[] } fetchimagesfortour: { Args: { @@ -351,6 +361,7 @@ export type Database = { }[]; }; join_tours_with_media: { + Args: Record Args: Record Returns: { id: string @@ -412,6 +423,8 @@ export type TablesInsert< ? 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 } @@ -433,6 +446,8 @@ export type TablesUpdate< ? 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 } From 221e26de36569430b0661feecd8abbe7a098855f Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 17 Mar 2024 14:29:23 -0700 Subject: [PATCH 012/103] added to nav bar --- src/components/userComponents/navBar/navBar.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/userComponents/navBar/navBar.tsx b/src/components/userComponents/navBar/navBar.tsx index fa4c4d6c..3f0f0b84 100644 --- a/src/components/userComponents/navBar/navBar.tsx +++ b/src/components/userComponents/navBar/navBar.tsx @@ -96,6 +96,9 @@ function NavBar() { Site Map + + Exhibits + QR Code Tour From 0fea1024e59632386f6d337c59fb43d050e92878 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 17 Mar 2024 14:33:09 -0700 Subject: [PATCH 013/103] removed cateogry for now --- src/app/exhibitsPage/page.tsx | 2 +- src/components/userComponents/Exhibit/Exhibit.tsx | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index ba54ab22..7d31d84d 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -58,7 +58,7 @@ function App() {
  • {exhibits.map(exhibit => ( - + ))} diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index e9f14eba..0d354cb4 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -14,13 +14,11 @@ import Image from 'next/image'; export default function Exhibit({ title, description, - category, image, id, }: { title: string; description: string; - category: string; image: string; id: string; }) { From 66c5c9689469b6f3ab0115e5c6447c9e54b6eba2 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 17 Mar 2024 14:37:31 -0700 Subject: [PATCH 014/103] prettier changes --- src/app/exhibitsPage/page.tsx | 27 +- .../userComponents/Exhibit/Exhibit.tsx | 49 ++-- src/supabase/tour_displays/queries.tsx | 5 +- src/types/supabase.ts | 271 +++++++++--------- 4 files changed, 178 insertions(+), 174 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 7d31d84d..4d0450b5 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -45,20 +45,35 @@ function App() { }, [exhibits]); return (
    - +
    - +
    -
    Our Exhibits
    -
    Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with protective efforts in place.
    +
    + Our Exhibits{' '} +
    +
    + Saratoga is home to an abundance of plant and animal life. As you + explore these exhibits you will learn about species that are + endangered and being carefully monitored by scientists with + protective efforts in place. +
    -
    Go to Map
    +
    + Go to Map +
    {exhibits.map(exhibit => ( - + ))}
    diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 0d354cb4..1fe7752d 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -12,27 +12,32 @@ import Image from 'next/image'; * @returns exhibit component */ export default function Exhibit({ - title, - description, - image, - id, - }: { - title: string; - description: string; - image: string; - id: string; - }) { - return ( -
      -
      -
      -
      -
      {title}
      -
      -
      {description}
      - Exhibit + title, + description, + image, + id, +}: { + title: string; + description: string; + image: string; + id: string; +}) { + return ( +
        +
        +
        +
        +
        + {' '} + {title}
        +
        +
        + {description} +
        + Exhibit
        -
      - ); - } \ No newline at end of file +
      +
    + ); +} diff --git a/src/supabase/tour_displays/queries.tsx b/src/supabase/tour_displays/queries.tsx index 9f4eead4..a33d3705 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 d4a27bca..9189e806 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,7 +4,7 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[] + | Json[]; export type Database = { public: { @@ -48,30 +48,30 @@ export type Database = { } 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; @@ -92,21 +92,21 @@ export type Database = { }; 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; @@ -119,97 +119,97 @@ export type Database = { }; 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"] @@ -272,36 +272,26 @@ export type Database = { }; }; Views: { - [_ in never]: never - } + [_ in never]: never; + }; Functions: { fetchimagesfordisplay: { Args: { - displayid: string - } - 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 - }[] - } + id: string; + url: string; + type: string; + title: string; + text: string; + created_at: string; + }[]; + }; fetchimagesfortour: { Args: { - tourid: string - } + tourid: string; + }; Returns: { id: string url: string @@ -319,8 +309,8 @@ export type Database = { } get_spotlight_recommendations: { Args: { - source_display_id: string - } + source_display_id: string; + }; Returns: { id: string name: string @@ -361,8 +351,7 @@ export type Database = { }[]; }; join_tours_with_media: { - Args: Record - Args: Record + Args: Record; Returns: { id: string name: string @@ -399,9 +388,9 @@ export type 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 @@ -423,10 +412,8 @@ export type TablesInsert< ? 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 + ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { + Insert: infer I; } ? I : never @@ -446,10 +433,8 @@ export type TablesUpdate< ? 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 + ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { + Update: infer U; } ? U : never From 3eead25121c5af5d30baabbc6c073fa1338d3cde Mon Sep 17 00:00:00 2001 From: Andrei Tan <73627326+andreisito@users.noreply.github.com> Date: Sun, 10 Mar 2024 19:15:12 -0700 Subject: [PATCH 015/103] feat: disabling github actions until MPH / post-MPH --- .github/workflows/lint.yml | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..00ce51a9 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,66 @@ + +# TODO: Will bring this back once other TSC issues are dealt with. +# --- +# 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 # +# ################################ +# - 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 From 3a91e91ff27f40c22f83cdcdcd708a60aa7a2be1 Mon Sep 17 00:00:00 2001 From: Andrei Tan <73627326+andreisito@users.noreply.github.com> Date: Sun, 10 Mar 2024 19:15:38 -0700 Subject: [PATCH 016/103] chore: prettier --- .github/workflows/lint.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 00ce51a9..a104c7c5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,3 @@ - # TODO: Will bring this back once other TSC issues are dealt with. # --- # name: Lint From aeddf86f2febbe4119645fdff95760c1a1dfef5b Mon Sep 17 00:00:00 2001 From: Andrei Tan <73627326+andreisito@users.noreply.github.com> Date: Sun, 10 Mar 2024 19:17:07 -0700 Subject: [PATCH 017/103] chore: disabled only the tsc compiler for now --- .github/workflows/lint.yml | 120 ++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a104c7c5..4235a8f7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,65 +1,65 @@ -# TODO: Will bring this back once other TSC issues are dealt with. -# --- -# name: Lint +--- +name: Lint -# ############################# -# # Start the job on push # -# ############################# -# on: -# push: -# branches-ignore: [main] -# pull_request: -# branches: [main] +############################# +# 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 +############### +# 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 + ################## + # 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 # -# ################################ -# - 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\?$') + ################################ + # 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 + # # Run tsc on each file + # for file in $files + # do + # npx tsc --noEmit $file || exit 1 + # done From ce67e037225d4ab6652a96225531f524267abf7c Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sat, 16 Mar 2024 12:24:26 -0700 Subject: [PATCH 018/103] adding comp --- .../userComponents/Exhibit/Exhibit.tsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 1fe7752d..69d88f9b 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -1,6 +1,39 @@ import React from 'react'; import Image from 'next/image'; +/** + * + * @param root0 passed in + * @param root0.title title of exhibit + * @param root0.description description of exhibit + * @param root0.category category of exhibit + * @param root0.image image + * @param root0.id id of exhibit + * @returns exhibit component + */ + +/** + * @param evt on click of button + */ +function goBack(evt: React.SyntheticEvent) { + // ignore the native anchor action + evt.preventDefault(); + + window.history.back(); + } + + /** + * @returns back button + */ + function BackButton() { + return ( + + ); + } + /** * * @param root0 passed in From 63617e3d4be905651fcd45f5636ae53848706c42 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sat, 16 Mar 2024 14:33:29 -0700 Subject: [PATCH 019/103] finished? --- src/types/supabase.ts | 281 ++++++++++++++++++++++-------------------- 1 file changed, 147 insertions(+), 134 deletions(-) diff --git a/src/types/supabase.ts b/src/types/supabase.ts index 9189e806..b73a3ce0 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,7 +4,7 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[]; + | Json[] export type Database = { public: { @@ -48,38 +48,38 @@ export type Database = { } 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; @@ -92,21 +92,21 @@ export type Database = { }; 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; @@ -119,97 +119,97 @@ export type Database = { }; 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"] @@ -272,26 +272,39 @@ export type Database = { }; }; Views: { - [_ in never]: never; - }; + [_ in never]: never + } Functions: { 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 + }[] + } + get_spotlight_recommendations: { + Args: { + source_display_id: string + } Returns: { id: string url: string @@ -351,7 +364,7 @@ export type Database = { }[]; }; join_tours_with_media: { - Args: Record; + Args: Record Returns: { id: string name: string @@ -365,7 +378,7 @@ export type Database = { } }; Enums: { - media_type: 'image' | 'video' | 'link'; + media_type: "image" | "video" | "link" tour_category: | "BuildingsAndServices" | "ParksAviariesEnclosures" @@ -388,9 +401,9 @@ export type 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 @@ -412,8 +425,8 @@ export type TablesInsert< ? 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 @@ -433,8 +446,8 @@ export type TablesUpdate< ? 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 From 7f2851341370e055113d749c034142b925f99f7d Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 17 Mar 2024 14:37:31 -0700 Subject: [PATCH 020/103] prettier changes --- src/types/supabase.ts | 284 +++++++++++++++++++++--------------------- 1 file changed, 142 insertions(+), 142 deletions(-) diff --git a/src/types/supabase.ts b/src/types/supabase.ts index b73a3ce0..1819aeed 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,7 +4,7 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[] + | Json[]; export type Database = { public: { @@ -48,38 +48,38 @@ export type Database = { } 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; @@ -92,21 +92,21 @@ export type Database = { }; 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; @@ -119,97 +119,97 @@ export type Database = { }; 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"] @@ -272,35 +272,35 @@ export type Database = { }; }; Views: { - [_ in never]: never - } + [_ in never]: never; + }; Functions: { 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_spotlight_recommendations: { Args: { source_display_id: string @@ -364,7 +364,7 @@ export type Database = { }[]; }; join_tours_with_media: { - Args: Record + Args: Record; Returns: { id: string name: string @@ -378,7 +378,7 @@ export type Database = { } }; Enums: { - media_type: "image" | "video" | "link" + media_type: 'image' | 'video' | 'link'; tour_category: | "BuildingsAndServices" | "ParksAviariesEnclosures" @@ -401,9 +401,9 @@ export type 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 @@ -425,8 +425,8 @@ export type TablesInsert< ? 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 @@ -446,8 +446,8 @@ export type TablesUpdate< ? 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 From 1ba952eda9fe2b5be2cb2dfe3d0b4f355382a5e0 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Fri, 5 Apr 2024 03:20:59 -0700 Subject: [PATCH 021/103] removed category from table and small fixes --- database.types.ts | 0 src/app/exhibitsPage/page.tsx | 20 ++++++++++--------- .../userComponents/Exhibit/Exhibit.tsx | 12 +++++------ 3 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 database.types.ts diff --git a/database.types.ts b/database.types.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 4d0450b5..43c0a5c7 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -66,15 +66,17 @@ function App() { - {exhibits.map(exhibit => ( - - ))} +
      + {exhibits.map(exhibit => ( + + ))} +
    ); diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 69d88f9b..59003abe 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -56,21 +56,21 @@ export default function Exhibit({ id: string; }) { return ( -
      +
    • -
      +

      {' '} {title} -

      +
      -
      +

      {description} -

      +

      Exhibit
      -
    + ); } From fce682329dca11d6198095c2894fd9789e94c697 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Tue, 9 Apr 2024 23:36:27 -0700 Subject: [PATCH 022/103] added linking from map --- src/app/exhibitsPage/page.tsx | 22 +++- .../userComponents/Exhibit/Exhibit.tsx | 2 +- .../SiteMap/DisplayPreviewCard.tsx | 122 +++++++++--------- src/supabase/exhibits/queries.tsx | 107 ++++----------- 4 files changed, 108 insertions(+), 145 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 43c0a5c7..a8625104 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -1,3 +1,4 @@ + 'use client'; import React, { useEffect, useState } from 'react'; @@ -11,10 +12,9 @@ import Exhibit from '../../components/userComponents/Exhibit/Exhibit'; /** * @param evt on click of button */ -function goBack(evt: React.SyntheticEvent) { +function goBack(evt : React.SyntheticEvent) { // ignore the native anchor action evt.preventDefault(); - window.history.back(); } @@ -42,7 +42,21 @@ function App() { setExhibits(fetchedExhibits); }; getExhibits(); + // Detect the hash in URL and scroll to the element with the corresponding ID }, [exhibits]); + + useEffect(() => { + const { hash } = window.location; + if (hash) { + setTimeout(() => { + const element = document.querySelector(hash); + const yOffset = -50; + const y = + element.getBoundingClientRect().top + window.scrollY + yOffset; + window.scrollTo({ top: y, behavior: 'smooth' }); + }, 1000); + } + }, []); return (
    @@ -70,7 +84,7 @@ function App() { {exhibits.map(exhibit => ( +
  • diff --git a/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx b/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx index 19353bab..b6e5fb32 100644 --- a/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx +++ b/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx @@ -48,101 +48,105 @@ function DisplayPreviewCard({ useEffect(() => { const fetchDetails = async () => { setLoading(true); - - let imageUrl = ''; - let displayName = ''; - - if ('name' in tour) { + + let imageUrl = ''; + let displayName = ''; + + if ('name' in tour) { // 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; } 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; + displayName = tour.title; } - + // Set state variables setPreviewImage(imageUrl); setname1(displayName); setLoading(false); }; - + fetchDetails(); }, [tour]); - /** route this to spotlights */ return ( -
    -
  • + ); + } \ No newline at end of file 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/ExhibitDisplay/ExhibitDisplay.tsx b/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx index 8a063bf2..1c0db706 100644 --- a/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx +++ b/src/components/userComponents/ExhibitDisplay/ExhibitDisplay.tsx @@ -2,6 +2,19 @@ import React from 'react'; import Image from 'next/image'; import styles from './ExhibitDisplay.module.css'; +/** + * + * @param root0 + * @param root0.name + * @param root0.location + * @param root0.information + * @param root0.description + * @param root0.relatednews + * @param root0.topimage + * @param root0.media + * @param root0.bottomimage + * @param root0.moretext + */ export default function ExhibitDisplay({ name, location, From 6acf8c6f31696478217a4c698591584df696c42a Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sat, 16 Mar 2024 12:24:26 -0700 Subject: [PATCH 032/103] adding comp --- src/app/exhibitsPage/page.tsx | 37 ++++++++++++++++--- .../userComponents/Exhibit/Exhibit.tsx | 33 +++++++++++++++++ 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 5086a0cf..4659101b 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -1,10 +1,33 @@ 'use client'; import React, { useEffect, useState } from 'react'; +import { IoIosArrowRoundBack } from 'react-icons/io'; import NavBar from '../../components/userComponents/navBar/navBar'; import { ExhibitRow } from '../../types/types'; import { fetchAllExhibits } from '../../supabase/exhibits/queries'; +/** + * @param evt on click of button + */ +function goBack(evt: React.SyntheticEvent) { + // ignore the native anchor action + evt.preventDefault(); + + window.history.back(); +} + +/** + * @returns back button + */ +function BackButton() { + return ( + + ); +} + /** * @returns exhibit page */ @@ -19,12 +42,14 @@ function App() { getExhibits(); }, [exhibits]); return ( -
    - -
    -

    - Exhibits -

    +
    + +
    + +
    +
    Our Exhibits
    +
    Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with protective efforts in place.
    +
    ); diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 499a2e68..28df4470 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { IoIosArrowRoundBack } from 'react-icons/io'; /** * @@ -9,6 +10,38 @@ import React from 'react'; * @param root0.id * @returns exhibit component */ + +/** + * @param evt on click of button + */ +function goBack(evt: React.SyntheticEvent) { + // ignore the native anchor action + evt.preventDefault(); + + window.history.back(); + } + + /** + * @returns back button + */ + function BackButton() { + return ( + + ); + } + +/** + * + * @param root0 + * @param root0.title + * @param root0.createdAt + * @param root0.contentLink + * @param root0.id + * @returns exhibit page + */ export default function Exhibit({ title, createdAt, From 741b290d28c5ab4ff4fc2f111f89c6feb9bdfa0b Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sat, 16 Mar 2024 14:33:29 -0700 Subject: [PATCH 033/103] finished? --- src/app/exhibitsPage/page.tsx | 22 +- .../userComponents/Exhibit/Exhibit.tsx | 67 ++-- src/types/supabase.ts | 345 ++++++++---------- 3 files changed, 188 insertions(+), 246 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 4659101b..ba54ab22 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -1,10 +1,12 @@ 'use client'; import React, { useEffect, useState } from 'react'; +import Link from 'next/link'; import { IoIosArrowRoundBack } from 'react-icons/io'; import NavBar from '../../components/userComponents/navBar/navBar'; import { ExhibitRow } from '../../types/types'; import { fetchAllExhibits } from '../../supabase/exhibits/queries'; +import Exhibit from '../../components/userComponents/Exhibit/Exhibit'; /** * @param evt on click of button @@ -21,7 +23,7 @@ function goBack(evt: React.SyntheticEvent) { */ function BackButton() { return ( - @@ -42,14 +44,22 @@ function App() { getExhibits(); }, [exhibits]); return ( -
    +
    -
    +
    -
    -
    Our Exhibits
    -
    Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with protective efforts in place.
    +
    +
    Our Exhibits
    +
    Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with protective efforts in place.
    + +
    +
    Go to Map
    +
    + + {exhibits.map(exhibit => ( + + ))}
    ); diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 28df4470..e9f14eba 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -1,59 +1,40 @@ import React from 'react'; -import { IoIosArrowRoundBack } from 'react-icons/io'; +import Image from 'next/image'; /** * - * @param root0 - * @param root0.title - * @param root0.createdAt - * @param root0.contentLink - * @param root0.id + * @param root0 passed in + * @param root0.title title of exhibit + * @param root0.description description of exhibit + * @param root0.category category of exhibit + * @param root0.image image + * @param root0.id id of exhibit * @returns exhibit component */ - -/** - * @param evt on click of button - */ -function goBack(evt: React.SyntheticEvent) { - // ignore the native anchor action - evt.preventDefault(); - - window.history.back(); - } - - /** - * @returns back button - */ - function BackButton() { - return ( - - ); - } - -/** - * - * @param root0 - * @param root0.title - * @param root0.createdAt - * @param root0.contentLink - * @param root0.id - * @returns exhibit page - */ export default function Exhibit({ title, - createdAt, - contentLink, + description, + category, + image, id, }: { title: string; - createdAt: string; - contentLink: string; + description: string; + category: string; + image: string; id: string; }) { return ( -
  • +
      +
      +
      +
      +
      {title}
      +
      +
      {description}
      + Exhibit +
      +
      +
    ); } \ No newline at end of file diff --git a/src/types/supabase.ts b/src/types/supabase.ts index 3d2d2ff7..b3f61740 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,7 +4,7 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[]; + | Json[] export type Database = { public: { @@ -32,47 +32,46 @@ export type Database = { }; 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; - summary: string | null; - 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; @@ -93,62 +92,23 @@ export type Database = { }; Relationships: []; }; - emails: { - Row: { - emails: string | null; - id: number; - }; - Insert: { - emails?: string | null; - id?: number; - }; - Update: { - emails?: string | null; - id?: number; - }; - Relationships: []; - }; - exhibits: { - Row: { - coordinates: Json | null; - description: string; - id: string; - image: string | null; - title: string; - }; - Insert: { - coordinates?: Json | null; - description: string; - id?: string; - image?: string | null; - title: string; - }; - Update: { - coordinates?: Json | null; - description?: string; - id?: string; - image?: string | null; - title?: string; - }; - Relationships: []; - }; 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; @@ -159,123 +119,99 @@ export type Database = { }; Relationships: []; }; - news: { - Row: { - 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; - }; - Update: { - 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']; @@ -314,8 +250,8 @@ export type Database = { }; }; Views: { - [_ in never]: never; - }; + [_ in never]: never + } Functions: { fetch_recommended_spotlights: { Args: { @@ -335,17 +271,27 @@ export type Database = { }; fetchimagesfordisplay: { Args: { - displayid: string; - }; + 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 + }[] + } + id: string + url: string + type: string + title: string + text: string + created_at: string + }[] + } fetchimagesfortour: { Args: { tourid: string; @@ -381,7 +327,8 @@ export type Database = { }[]; }; join_tours_with_media: { - Args: Record; + Args: Record + Args: Record Returns: { id: string; name: string; @@ -442,8 +389,10 @@ export type TablesInsert< ? 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 + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Insert: infer I } ? I : never @@ -463,8 +412,10 @@ export type TablesUpdate< ? 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 + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Update: infer U } ? U : never From 463c0976f9c8ce016f23853b1589652011858689 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 17 Mar 2024 14:29:23 -0700 Subject: [PATCH 034/103] added to nav bar --- src/components/userComponents/navBar/navBar.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/userComponents/navBar/navBar.tsx b/src/components/userComponents/navBar/navBar.tsx index fa4c4d6c..3f0f0b84 100644 --- a/src/components/userComponents/navBar/navBar.tsx +++ b/src/components/userComponents/navBar/navBar.tsx @@ -96,6 +96,9 @@ function NavBar() { Site Map + + Exhibits + QR Code Tour From f78e9a45218c022ef663e311157b6a3cd334fdc9 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 17 Mar 2024 14:33:09 -0700 Subject: [PATCH 035/103] removed cateogry for now --- src/app/exhibitsPage/page.tsx | 2 +- src/components/userComponents/Exhibit/Exhibit.tsx | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index ba54ab22..7d31d84d 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -58,7 +58,7 @@ function App() {
  • {exhibits.map(exhibit => ( - + ))} diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index e9f14eba..0d354cb4 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -14,13 +14,11 @@ import Image from 'next/image'; export default function Exhibit({ title, description, - category, image, id, }: { title: string; description: string; - category: string; image: string; id: string; }) { From 655a9b977812f17017843cd625516ac8a466c67d Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 17 Mar 2024 14:37:31 -0700 Subject: [PATCH 036/103] prettier changes --- src/app/exhibitsPage/page.tsx | 27 +- .../userComponents/Exhibit/Exhibit.tsx | 49 +-- src/supabase/tour_displays/queries.tsx | 5 +- src/types/supabase.ts | 302 ++++++++++-------- 4 files changed, 211 insertions(+), 172 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 7d31d84d..4d0450b5 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -45,20 +45,35 @@ function App() { }, [exhibits]); return (
    - +
    - +
    -
    Our Exhibits
    -
    Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with protective efforts in place.
    +
    + Our Exhibits{' '} +
    +
    + Saratoga is home to an abundance of plant and animal life. As you + explore these exhibits you will learn about species that are + endangered and being carefully monitored by scientists with + protective efforts in place. +
    -
    Go to Map
    +
    + Go to Map +
    {exhibits.map(exhibit => ( - + ))}
    diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 0d354cb4..1fe7752d 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -12,27 +12,32 @@ import Image from 'next/image'; * @returns exhibit component */ export default function Exhibit({ - title, - description, - image, - id, - }: { - title: string; - description: string; - image: string; - id: string; - }) { - return ( -
      -
      -
      -
      -
      {title}
      -
      -
      {description}
      - Exhibit + title, + description, + image, + id, +}: { + title: string; + description: string; + image: string; + id: string; +}) { + return ( +
        +
        +
        +
        +
        + {' '} + {title}
        +
        +
        + {description} +
        + Exhibit
        -
      - ); - } \ No newline at end of file +
      +
    + ); +} diff --git a/src/supabase/tour_displays/queries.tsx b/src/supabase/tour_displays/queries.tsx index 0fae2ea9..0f921628 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 b3f61740..3a15d1a5 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,7 +4,7 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[] + | Json[]; export type Database = { public: { @@ -48,30 +48,30 @@ export type Database = { } 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; @@ -94,21 +94,21 @@ export type Database = { }; 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; @@ -121,97 +121,97 @@ export type Database = { }; 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']; @@ -250,8 +250,8 @@ export type Database = { }; }; Views: { - [_ in never]: never - } + [_ in never]: never; + }; Functions: { fetch_recommended_spotlights: { Args: { @@ -271,30 +271,22 @@ export type Database = { }; fetchimagesfordisplay: { Args: { - displayid: string - } - 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 - }[] - } + id: string; + url: string; + type: string; + title: string; + text: string; + created_at: string; + }[]; + }; fetchimagesfortour: { Args: { tourid: string; + }; + tourid: string; }; Returns: { id: string; @@ -307,12 +299,42 @@ export type Database = { }; get_category_color: { Args: { - category_in: string; + category_in: string + } + Returns: string + } + get_spotlight_recommendations: { + Args: { + source_display_id: string; }; - Returns: string; - }; - join_all_spotlights_with_media: { - 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"] + }[] + } + get_spotlight_tours: { + 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"] + }[] + } + join_spotlights_with_media: { + Args: Record Returns: { id: string; name: string; @@ -327,8 +349,7 @@ export type Database = { }[]; }; join_tours_with_media: { - Args: Record - Args: Record + Args: Record; Returns: { id: string; name: string; @@ -365,6 +386,9 @@ export type 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; @@ -389,10 +413,8 @@ export type TablesInsert< ? 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 + ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { + Insert: infer I; } ? I : never @@ -412,10 +434,8 @@ export type TablesUpdate< ? 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 + ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { + Update: infer U; } ? U : never From 776e0ecf20db9c5513826851c18c2fb0ccdbd5ac Mon Sep 17 00:00:00 2001 From: Andrei Tan <73627326+andreisito@users.noreply.github.com> Date: Sun, 10 Mar 2024 19:15:12 -0700 Subject: [PATCH 037/103] feat: disabling github actions until MPH / post-MPH --- .github/workflows/lint.yml | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..00ce51a9 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,66 @@ + +# TODO: Will bring this back once other TSC issues are dealt with. +# --- +# 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 # +# ################################ +# - 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 From fda7a2e0f645a704fdf853feb9240cedfaa9c645 Mon Sep 17 00:00:00 2001 From: Andrei Tan <73627326+andreisito@users.noreply.github.com> Date: Sun, 10 Mar 2024 19:15:38 -0700 Subject: [PATCH 038/103] chore: prettier --- .github/workflows/lint.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 00ce51a9..a104c7c5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,3 @@ - # TODO: Will bring this back once other TSC issues are dealt with. # --- # name: Lint From 266e7281b13c88729e438ac600aab943c78bb92b Mon Sep 17 00:00:00 2001 From: Andrei Tan <73627326+andreisito@users.noreply.github.com> Date: Sun, 10 Mar 2024 19:17:07 -0700 Subject: [PATCH 039/103] chore: disabled only the tsc compiler for now --- .github/workflows/lint.yml | 120 ++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a104c7c5..4235a8f7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,65 +1,65 @@ -# TODO: Will bring this back once other TSC issues are dealt with. -# --- -# name: Lint +--- +name: Lint -# ############################# -# # Start the job on push # -# ############################# -# on: -# push: -# branches-ignore: [main] -# pull_request: -# branches: [main] +############################# +# 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 +############### +# 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 + ################## + # 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 # -# ################################ -# - 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\?$') + ################################ + # 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 + # # Run tsc on each file + # for file in $files + # do + # npx tsc --noEmit $file || exit 1 + # done From 4c559a8fdbe39945edf1143aff93cd2b36c1ba53 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sat, 16 Mar 2024 12:24:26 -0700 Subject: [PATCH 040/103] adding comp --- .../userComponents/Exhibit/Exhibit.tsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 1fe7752d..69d88f9b 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -1,6 +1,39 @@ import React from 'react'; import Image from 'next/image'; +/** + * + * @param root0 passed in + * @param root0.title title of exhibit + * @param root0.description description of exhibit + * @param root0.category category of exhibit + * @param root0.image image + * @param root0.id id of exhibit + * @returns exhibit component + */ + +/** + * @param evt on click of button + */ +function goBack(evt: React.SyntheticEvent) { + // ignore the native anchor action + evt.preventDefault(); + + window.history.back(); + } + + /** + * @returns back button + */ + function BackButton() { + return ( + + ); + } + /** * * @param root0 passed in From bbf2efe42cb84ef2ce6f387cdb54a95951ad853b Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sat, 16 Mar 2024 14:33:29 -0700 Subject: [PATCH 041/103] finished? --- src/types/supabase.ts | 343 ++++++++++++++++++++---------------------- 1 file changed, 167 insertions(+), 176 deletions(-) diff --git a/src/types/supabase.ts b/src/types/supabase.ts index 3a15d1a5..5c62bfc0 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,7 +4,7 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[]; + | Json[] export type Database = { public: { @@ -48,39 +48,38 @@ export type Database = { } 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; - summary?: string | null; - 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; @@ -94,21 +93,21 @@ export type Database = { }; 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; @@ -121,97 +120,97 @@ export type Database = { }; 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']; @@ -250,53 +249,48 @@ export type Database = { }; }; Views: { - [_ in never]: never; - }; + [_ in never]: never + } Functions: { - fetch_recommended_spotlights: { - Args: { - 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']; - }[]; - }; 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; - }; + 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_spotlight_recommendations: { + Args: { + source_display_id: string + } + Returns: { + id: string + url: string + type: string + title: string + text: string + created_at: string + }[] + } get_category_color: { Args: { category_in: string @@ -349,7 +343,7 @@ export type Database = { }[]; }; join_tours_with_media: { - Args: Record; + Args: Record Returns: { id: string; name: string; @@ -363,7 +357,7 @@ export type Database = { }; }; Enums: { - media_type: 'image' | 'video' | 'link'; + media_type: "image" | "video" | "link" tour_category: | 'BuildingsAndServices' | 'ParksAviariesEnclosures' @@ -386,12 +380,9 @@ export type 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; + ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends { + Row: infer R } ? R : never @@ -413,18 +404,18 @@ export type TablesInsert< ? 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 @@ -434,18 +425,18 @@ export type TablesUpdate< ? 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 From c8e92e7c23cef957ca9ad3f667cd6a2ffb19be4f Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 17 Mar 2024 14:37:31 -0700 Subject: [PATCH 042/103] prettier changes --- src/types/supabase.ts | 284 +++++++++++++++++++++--------------------- 1 file changed, 142 insertions(+), 142 deletions(-) diff --git a/src/types/supabase.ts b/src/types/supabase.ts index 5c62bfc0..611d93d0 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,7 +4,7 @@ export type Json = | boolean | null | { [key: string]: Json | undefined } - | Json[] + | Json[]; export type Database = { public: { @@ -48,38 +48,38 @@ export type Database = { } 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; @@ -93,21 +93,21 @@ export type Database = { }; 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; @@ -120,97 +120,97 @@ export type Database = { }; 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']; @@ -249,35 +249,35 @@ export type Database = { }; }; Views: { - [_ in never]: never - } + [_ in never]: never; + }; Functions: { 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_spotlight_recommendations: { Args: { source_display_id: string @@ -343,7 +343,7 @@ export type Database = { }[]; }; join_tours_with_media: { - Args: Record + Args: Record; Returns: { id: string; name: string; @@ -357,7 +357,7 @@ export type Database = { }; }; Enums: { - media_type: "image" | "video" | "link" + media_type: 'image' | 'video' | 'link'; tour_category: | 'BuildingsAndServices' | 'ParksAviariesEnclosures' @@ -380,9 +380,9 @@ export type 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 @@ -404,8 +404,8 @@ export type TablesInsert< ? 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 @@ -425,8 +425,8 @@ export type TablesUpdate< ? 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 From 8383d06722857eca00947bbd621965ec314a9adf Mon Sep 17 00:00:00 2001 From: jxmoose Date: Fri, 5 Apr 2024 03:20:59 -0700 Subject: [PATCH 043/103] removed category from table and small fixes --- database.types.ts | 0 src/app/exhibitsPage/page.tsx | 20 ++++++++++--------- .../userComponents/Exhibit/Exhibit.tsx | 12 +++++------ 3 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 database.types.ts diff --git a/database.types.ts b/database.types.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 4d0450b5..43c0a5c7 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -66,15 +66,17 @@ function App() { - {exhibits.map(exhibit => ( - - ))} +
      + {exhibits.map(exhibit => ( + + ))} +
    ); diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 69d88f9b..59003abe 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -56,21 +56,21 @@ export default function Exhibit({ id: string; }) { return ( -
      +
    • -
      +

      {' '} {title} -

      +
      -
      +

      {description} -

      +

      Exhibit
      -
    + ); } From 8e398feebce6859b0f326e32c56ce8e3bbaf55b9 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Tue, 9 Apr 2024 23:36:27 -0700 Subject: [PATCH 044/103] added linking from map --- src/app/exhibitsPage/page.tsx | 22 ++++- .../userComponents/Exhibit/Exhibit.tsx | 2 +- .../SiteMap/DisplayPreviewCard.tsx | 31 ++++++- src/supabase/exhibits/queries.tsx | 88 ++++++------------- 4 files changed, 74 insertions(+), 69 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 43c0a5c7..a8625104 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -1,3 +1,4 @@ + 'use client'; import React, { useEffect, useState } from 'react'; @@ -11,10 +12,9 @@ import Exhibit from '../../components/userComponents/Exhibit/Exhibit'; /** * @param evt on click of button */ -function goBack(evt: React.SyntheticEvent) { +function goBack(evt : React.SyntheticEvent) { // ignore the native anchor action evt.preventDefault(); - window.history.back(); } @@ -42,7 +42,21 @@ function App() { setExhibits(fetchedExhibits); }; getExhibits(); + // Detect the hash in URL and scroll to the element with the corresponding ID }, [exhibits]); + + useEffect(() => { + const { hash } = window.location; + if (hash) { + setTimeout(() => { + const element = document.querySelector(hash); + const yOffset = -50; + const y = + element.getBoundingClientRect().top + window.scrollY + yOffset; + window.scrollTo({ top: y, behavior: 'smooth' }); + }, 1000); + } + }, []); return (
    @@ -70,7 +84,7 @@ function App() { {exhibits.map(exhibit => ( +
  • diff --git a/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx b/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx index 3d5a169a..9efa65cd 100644 --- a/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx +++ b/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx @@ -52,34 +52,53 @@ function DisplayPreviewCard({ let imageUrl = ''; let displayName = ''; + if ('name' in tour) { + + let imageUrl = ''; + let displayName = ''; + if ('name' in tour) { // 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; } 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; + displayName = tour.title; } + // Set state variables setPreviewImage(imageUrl); setname1(displayName); setLoading(false); }; + fetchDetails(); }, [tour]); + /** route this to spotlights */ return ( +
    +
    +
    + +
    +
    +
  • ); } -export default DisplayPreviewCard; +export default DisplayPreviewCard; \ No newline at end of file diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index 2577a76c..18c306a7 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -1,6 +1,5 @@ 'use client'; -<<<<<<< HEAD import supabase from '../client'; import { ExhibitRow } from '../../types/types'; @@ -12,18 +11,6 @@ export async function fetchAllExhibits(): Promise { const { data, error } = await supabase.from('exhibits').select('*'); if (error) { throw new Error(error.message); -======= -import { ExhibitRow } from '../../types/types'; - -/** - * Fetches all tours from the database. - * @returns A promise that resolves to an array of ExhibitRow objects. - */ -export async function fetchAllExhibits(): Promise { - const { data, error } = await supabase.from('exhibits').select('*'); - if (error) { - throw new Error(`An error occurred trying to read exhibits: ${error}`); ->>>>>>> b191485 (added database and page) } return data; } @@ -51,6 +38,14 @@ export async function fetchExhibit(exhibitId: string): Promise { */ export async function fetchExhibitImage( exhibitId: string, +): Promise<{ image: string }> { + const { data, error } = await supabase + .from('exhibits') + .select('image') + .eq('id', exhibitId) + .single(); +export async function fetchExhibitImage( + exhibitId: string, ): Promise<{ image: string }> { const { data, error } = await supabase .from('exhibits') @@ -61,13 +56,21 @@ export async function fetchExhibitImage( if (error) { throw new Error(error.message); } + if (error) { + throw new Error(error.message); + } + // Provide a default image URL if the image is null + const imageUrl = + data?.image ?? + 'https://buffer.com/cdn-cgi/image/w=1000,fit=contain,q=90,f=auto/library/content/images/size/w1200/2023/10/free-images.jpg'; // Adjust the default image path as needed // Provide a default image URL if the image is null const imageUrl = data?.image ?? 'https://buffer.com/cdn-cgi/image/w=1000,fit=contain,q=90,f=auto/library/content/images/size/w1200/2023/10/free-images.jpg'; // Adjust the default image path as needed return { image: imageUrl }; + return { image: imageUrl }; } /** @@ -75,6 +78,9 @@ export async function fetchExhibitImage( * @param exhibitData - The exhibit to insert. * @returns A promise that resolves to a ExhibitRow object. */ +export async function insertExhibit( + exhibitData: ExhibitRow, +): Promise { export async function insertExhibit( exhibitData: ExhibitRow, ): Promise { @@ -92,6 +98,7 @@ export async function insertExhibit( */ export async function updateExhibit( newExhibitData: ExhibitRow, + newExhibitData: ExhibitRow, ): Promise { const { data, error } = await supabase .from('exhibits') @@ -108,6 +115,9 @@ export async function updateExhibit( * @param exhibitData - The exhibit to upsert. * @returns A promise that resolves to a ExhibitRow object. */ +export async function upsertTour( + exhibitData: ExhibitRow, +): Promise { export async function upsertTour( exhibitData: ExhibitRow, ): Promise { @@ -126,53 +136,9 @@ export async function upsertTour( export async function deleteExhibit( exhibitId: string, ): Promise { - const { data, error } = await supabase - .from('exhibits') - .delete() - .eq('id', exhibitId); - if (error) { - throw new Error(error.message); - } - return data; -} -======= -/** - * Updates a single exhibit in the database. - * @param newExhibitData - The updated exhibit data. - * @returns A promise that resolves to a ExhibitRow object. - */ -export async function updateExhibit( - newExhibitData: ExhibitRow, +export async function deleteExhibit( + exhibitId: string, ): Promise { - const { data, error } = await supabase - .from('exhibits') - .update(newExhibitData) - .eq('id', newExhibitData.id); - if (error) { - throw new Error(error.message); - } - return data; -} - -/** - * Upserts a single exhibit into the database. - * @param exhibitData - The exhibit to upsert. - * @returns A promise that resolves to a ExhibitRow object. - */ -export async function upsertTour(exhibitData: ExhibitRow): Promise { - const { data, error } = await supabase.from('exhibits').upsert(exhibitData); - if (error) { - throw new Error(error.message); - } - return data; -} - -/** - * Deletes a single exhibit from the database. - * @param exhibitId - The id of the exhibit to delete. - * @returns A promise that resolves to a ExhibitRow object. - */ -export async function deleteExhibit(exhibitId: string): Promise { const { data, error } = await supabase .from('exhibits') .delete() @@ -181,6 +147,4 @@ export async function deleteExhibit(exhibitId: string): Promise>>>>>> b191485 (added database and page) +} \ No newline at end of file From 7f561ec034faf36c4fe7d8a463a6ebdffc16539f Mon Sep 17 00:00:00 2001 From: jxmoose Date: Wed, 10 Apr 2024 00:50:44 -0700 Subject: [PATCH 045/103] design changes + adding active state to buttons --- src/app/exhibitsPage/page.tsx | 35 ++++------------ .../userComponents/BackButton/page.tsx | 18 +++++++-- .../userComponents/Exhibit/Exhibit.tsx | 40 ++----------------- 3 files changed, 26 insertions(+), 67 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index a8625104..363693e0 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -3,32 +3,12 @@ import React, { useEffect, useState } from 'react'; import Link from 'next/link'; -import { IoIosArrowRoundBack } from 'react-icons/io'; import NavBar from '../../components/userComponents/navBar/navBar'; import { ExhibitRow } from '../../types/types'; import { fetchAllExhibits } from '../../supabase/exhibits/queries'; import Exhibit from '../../components/userComponents/Exhibit/Exhibit'; +import BackButton from '../../components/userComponents/BackButton/page'; -/** - * @param evt on click of button - */ -function goBack(evt : React.SyntheticEvent) { - // ignore the native anchor action - evt.preventDefault(); - window.history.back(); -} - -/** - * @returns back button - */ -function BackButton() { - return ( - - ); -} /** * @returns exhibit page @@ -53,7 +33,8 @@ function App() { const yOffset = -50; const y = element.getBoundingClientRect().top + window.scrollY + yOffset; - window.scrollTo({ top: y, behavior: 'smooth' }); + // check on this offset later + window.scrollTo({ top: y, behavior: 'instant' }); }, 1000); } }, []); @@ -62,11 +43,11 @@ function App() {
    -
    -
    +
    +
    Our Exhibits{' '}
    -
    +
    Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with @@ -74,8 +55,8 @@ function App() {
    -
    -
    +
    +
    Go to Map
    diff --git a/src/components/userComponents/BackButton/page.tsx b/src/components/userComponents/BackButton/page.tsx index 111f459a..1727e9a8 100644 --- a/src/components/userComponents/BackButton/page.tsx +++ b/src/components/userComponents/BackButton/page.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { IoIosArrowRoundBack } from 'react-icons/io'; /** * @param evt on click of button @@ -16,9 +15,22 @@ function goBack(evt: React.SyntheticEvent) { */ export default function BackButton() { return ( - ); } diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 630d5981..19159520 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -1,45 +1,11 @@ import React from 'react'; import Image from 'next/image'; - -/** - * - * @param root0 passed in - * @param root0.title title of exhibit - * @param root0.description description of exhibit - * @param root0.category category of exhibit - * @param root0.image image - * @param root0.id id of exhibit - * @returns exhibit component - */ - -/** - * @param evt on click of button - */ -function goBack(evt: React.SyntheticEvent) { - // ignore the native anchor action - evt.preventDefault(); - - window.history.back(); - } - - /** - * @returns back button - */ - function BackButton() { - return ( - - ); - } /** * * @param root0 passed in * @param root0.title title of exhibit * @param root0.description description of exhibit - * @param root0.category category of exhibit * @param root0.image image * @param root0.id id of exhibit * @returns exhibit component @@ -57,15 +23,15 @@ export default function Exhibit({ }) { return (
  • -
    +
    -

    +

    {' '} {title}

    -

    +

    {description}

    Exhibit From 2113ada79d392d55cdd780fbc95173f88cc6db6d Mon Sep 17 00:00:00 2001 From: jxmoose Date: Thu, 11 Apr 2024 11:31:42 -0700 Subject: [PATCH 046/103] big database edits to make fun facts possible on map --- src/app/exhibitsPage/page.tsx | 24 +- .../userComponents/BackButton/page.tsx | 13 +- .../userComponents/Exhibit/Exhibit.tsx | 4 +- .../SiteMap/DisplayPreviewCard.tsx | 19 +- .../userComponents/SiteMap/SiteMap.tsx | 17 +- src/supabase/category/queries.tsx | 16 +- src/supabase/exhibits/queries.tsx | 8 +- src/types/supabase.ts | 220 ++++++++++++------ src/types/types.ts | 10 +- 9 files changed, 211 insertions(+), 120 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 363693e0..47c11c9e 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -1,24 +1,22 @@ - 'use client'; import React, { useEffect, useState } from 'react'; import Link from 'next/link'; import NavBar from '../../components/userComponents/navBar/navBar'; -import { ExhibitRow } from '../../types/types'; -import { fetchAllExhibits } from '../../supabase/exhibits/queries'; +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'; - /** * @returns exhibit page */ function App() { - const [exhibits, setExhibits] = useState([]); + const [exhibits, setExhibits] = useState([]); useEffect(() => { // Get exhibits const getExhibits = async () => { - const fetchedExhibits: ExhibitRow[] = await fetchAllExhibits(); + const fetchedExhibits: CategoryRow[] = await fetchAllCategories(); setExhibits(fetchedExhibits); }; getExhibits(); @@ -31,10 +29,12 @@ function App() { setTimeout(() => { const element = document.querySelector(hash); const yOffset = -50; - const y = - element.getBoundingClientRect().top + window.scrollY + yOffset; - // check on this offset later - window.scrollTo({ top: y, behavior: 'instant' }); + if (element) { + const y = + element.getBoundingClientRect().top + window.scrollY + yOffset; + // check on this offset later + window.scrollTo({ top: y, behavior: 'instant' }); + } }, 1000); } }, []); @@ -64,7 +64,7 @@ function App() {
      {exhibits.map(exhibit => ( {' '} - diff --git a/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx b/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx index b6e5fb32..318284a5 100644 --- a/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx +++ b/src/components/userComponents/SiteMap/DisplayPreviewCard.tsx @@ -3,12 +3,11 @@ import { LatLngExpression } from 'leaflet'; import { useMapEvents } from 'react-leaflet'; import Link from 'next/link'; import Image from 'next/image'; -import { ExhibitRow, TourRow } from '../../../types/types'; +import { ExhibitWithCategoryRow, TourRow } from '../../../types/types'; import { fetchImagesForTour } from '../../../supabase/media/queries'; -import { fetchExhibitImage } from '../../../supabase/exhibits/queries'; interface DisplayCardProps { - tour: TourRow | ExhibitRow; + tour: TourRow | ExhibitWithCategoryRow; handleClose: () => void; handleClick?: () => void; } @@ -60,12 +59,12 @@ function DisplayPreviewCard({ } displayName = tour.name; } else { - // Handle as an ExhibitRow - const imageObj = await fetchExhibitImage(tour.id); - if (imageObj) { - imageUrl = imageObj.image; - } - displayName = tour.title; + // Handle as an ExhibitWithCategoryRow + // const imageObj = await fetchExhibitImage(tour.id); + // if (imageObj) { + imageUrl = tour.image; + // } + displayName = tour.category; } // Set state variables @@ -149,4 +148,4 @@ function DisplayPreviewCard({ ); } -export default DisplayPreviewCard; \ No newline at end of file +export default DisplayPreviewCard; diff --git a/src/components/userComponents/SiteMap/SiteMap.tsx b/src/components/userComponents/SiteMap/SiteMap.tsx index 1ce494a1..b86c711b 100644 --- a/src/components/userComponents/SiteMap/SiteMap.tsx +++ b/src/components/userComponents/SiteMap/SiteMap.tsx @@ -4,13 +4,10 @@ import L, { LatLngExpression } from 'leaflet'; import React, { useEffect, useState } from 'react'; import { LayersControl, MapContainer, TileLayer, Marker } from 'react-leaflet'; import { fetchAllSpotlights } from '../../../supabase/tours/queries'; -import { ExhibitRow, TourRow } from '../../../types/types'; +import { ExhibitWithCategoryRow, TourRow } from '../../../types/types'; import Control from './Control'; import DisplayPreviewCard from './DisplayPreviewCard'; -import { - fetchExhibit, - fetchAllExhibits, -} from '../../../supabase/exhibits/queries'; +import { fetchAllExhibits } from '../../../supabase/exhibits/queries'; import { getCategoryColor1 } from '../../../supabase/category/queries'; import RecenterMap from './MapInteractionHandler'; @@ -88,12 +85,12 @@ interface SiteMapProps { */ function SiteMap({ mode }: SiteMapProps) { const [spotlightTours, setSpotlightTours] = useState< - TourRow[] | ExhibitRow[] | null + TourRow[] | ExhibitWithCategoryRow[] | null >(null); const [colorsMap, setColorsMap] = useState<{ [key: string]: string }>({}); - const [selectedTour, setSelectedTour] = useState( - null, - ); + const [selectedTour, setSelectedTour] = useState< + TourRow | ExhibitWithCategoryRow | null + >(null); const [mapCenter, setMapCenter] = useState(center); const [selectedMarker, setSelectedMarker] = useState(null); const [resetCenter, setResetCenter] = useState(center); // New state to trigger recentering @@ -148,7 +145,7 @@ function SiteMap({ mode }: SiteMapProps) { }, [selectedTour]); const handleMarkerSelect = ( - tour: TourRow | ExhibitRow, + tour: TourRow | ExhibitWithCategoryRow, markerIndex: number, ) => { setSelectedTour(tour); 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 93bdea29..cb726955 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -7,8 +7,8 @@ import { ExhibitRow } from '../../types/types'; * Fetches all tours from the database. * @returns A promise that resolves to an array of ExhibitRow objects. */ -export async function fetchAllExhibits(): Promise { - const { data, error } = await supabase.from('exhibits').select('*'); +export async function fetchAllExhibits() { + const { data, error } = await supabase.rpc('get_exhibits'); if (error) { throw new Error(error.message); } @@ -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(); @@ -121,4 +121,4 @@ export async function deleteExhibit( throw new Error(error.message); } return data; -} \ No newline at end of file +} diff --git a/src/types/supabase.ts b/src/types/supabase.ts index 611d93d0..dc4795ad 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -14,38 +14,44 @@ export type Database = { 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; id?: number; + image: string; }; Update: { 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'; @@ -76,7 +82,7 @@ export type Database = { coordinates?: Json | null; created_at?: string; description?: string; - id: string; + id?: string; title?: string; updated_at?: string | null; }; @@ -85,12 +91,55 @@ export type Database = { created_at?: string; description?: string; id?: string; - summary?: string | null; title?: string; updated_at?: string | null; }; Relationships: []; }; + emails: { + Row: { + emails: string | null; + id: number; + }; + Insert: { + emails?: string | null; + id?: number; + }; + Update: { + emails?: string | null; + id?: number; + }; + Relationships: []; + }; + exhibits: { + Row: { + category_id: number; + coordinates: Json | null; + id: string; + title: string; + }; + Insert: { + category_id: number; + coordinates?: Json | null; + id?: string; + title: string; + }; + Update: { + 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']; + }, + ]; + }; media: { Row: { created_at: string; @@ -118,6 +167,30 @@ export type Database = { }; Relationships: []; }; + news: { + Row: { + 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; + }; + Update: { + content_link?: string; + created_at?: string; + id?: string; + title?: string; + updated_at?: string | null; + }; + Relationships: []; + }; spotlight_recommendations: { Row: { source_display_id: string; @@ -252,6 +325,22 @@ export type Database = { [_ in never]: never; }; Functions: { + fetch_recommended_spotlights: { + Args: { + 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']; + }[]; + }; fetchimagesfordisplay: { Args: { displayid: string; @@ -278,57 +367,38 @@ export type Database = { created_at: string; }[]; }; - get_spotlight_recommendations: { - Args: { - source_display_id: string - } - Returns: { - id: string - url: string - type: string - title: string - text: string - created_at: string - }[] - } get_category_color: { Args: { - category_in: string - } - Returns: string - } - get_spotlight_recommendations: { - Args: { - source_display_id: string; + category_in: string; }; + Returns: string; + }; + get_exhibits: { + 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"] - }[] - } - get_spotlight_tours: { - Args: Record + id: number; + coordinates: Json; + category: string; + description: string; + image: string; + }[]; + }; + get_non_spotlight_tours: { + 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"] - }[] - } - join_spotlights_with_media: { - Args: Record + 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; Returns: { id: string; name: string; @@ -342,7 +412,7 @@ export type Database = { media_url: string; }[]; }; - join_tours_with_media: { + join_all_tours_with_media: { Args: Record; Returns: { id: string; @@ -352,7 +422,9 @@ export type Database = { stop_count: number; spotlight: boolean; preview_text: string; - url: string; + coordinates: Json; + category: Database['public']['Enums']['tour_category']; + media_url: string; }[]; }; }; @@ -409,13 +481,13 @@ export type TablesInsert< } ? I : never - : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] - ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { - Insert: infer I - } - ? I - : never + : PublicTableNameOrOptions extends keyof PublicSchema['Tables'] + ? PublicSchema['Tables'][PublicTableNameOrOptions] extends { + Insert: infer I; + } + ? I : never + : never; export type TablesUpdate< PublicTableNameOrOptions extends @@ -430,13 +502,13 @@ export type TablesUpdate< } ? U : never - : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] - ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { - Update: infer U - } - ? U - : never + : PublicTableNameOrOptions extends keyof PublicSchema['Tables'] + ? PublicSchema['Tables'][PublicTableNameOrOptions] extends { + Update: infer U; + } + ? U : never + : never; export type Enums< PublicEnumNameOrOptions extends diff --git a/src/types/types.ts b/src/types/types.ts index 4be9f38f..59c19b52 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -4,7 +4,7 @@ This file is meant to create clean type definitions that we can export to keep t Any updates to supabase.ts should be reflected here (new tables). */ -import { Database } from './supabase'; +import { Database, Json } from './supabase'; export type DisplayRow = Database['public']['Tables']['displays']['Row']; export type MediaRow = Database['public']['Tables']['media']['Row']; @@ -14,9 +14,17 @@ export type TourMediaRow = Database['public']['Tables']['tour_media']['Row']; export type TourRow = Database['public']['Tables']['tours']['Row']; export type NewsRow = Database['public']['Tables']['news']['Row']; export type ExhibitRow = Database['public']['Tables']['exhibits']['Row']; +export type CategoryRow = Database['public']['Tables']['categories']['Row']; export type SpotlightRow = { tour_row: TourRow; url: string; }; export type SpotlightWithMediaRow = TourRow & { media_url: string }; export type ToursWithMediaRow = TourRow & { media_url: string }; +export type ExhibitWithCategoryRow = { + id: number; + category: string; + description: string; + image: string; + coordinates: Json; +}; From f5b8784cfd93e0f7f601225b020e51148b0f41f9 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Thu, 11 Apr 2024 13:58:51 -0700 Subject: [PATCH 047/103] supabase function change --- src/supabase/exhibits/queries.tsx | 2 +- src/types/supabase.ts | 766 +++++++++++++++--------------- 2 files changed, 384 insertions(+), 384 deletions(-) diff --git a/src/supabase/exhibits/queries.tsx b/src/supabase/exhibits/queries.tsx index cb726955..a72d9566 100644 --- a/src/supabase/exhibits/queries.tsx +++ b/src/supabase/exhibits/queries.tsx @@ -8,7 +8,7 @@ import { ExhibitRow } from '../../types/types'; * @returns A promise that resolves to an array of ExhibitRow objects. */ export async function fetchAllExhibits() { - const { data, error } = await supabase.rpc('get_exhibits'); + const { data, error } = await supabase.rpc('get_exhibit_details'); if (error) { throw new Error(error.message); } diff --git a/src/types/supabase.ts b/src/types/supabase.ts index dc4795ad..d2ed141d 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -4,521 +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; - id: number; - image: string; - }; + 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; - id?: number; - image: string; - }; + 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; - id?: number; - image?: string; - }; - 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; - id: number; - }; + emails: string | null + id: number + } Insert: { - emails?: string | null; - id?: number; - }; + emails?: string | null + id?: number + } Update: { - emails?: 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; - }; - get_exhibits: { - Args: Record; + category_in: string + } + Returns: string + } + get_exhibit_details: { + Args: Record Returns: { - id: number; - coordinates: Json; - 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 From 3ed4501929e248005973cb137cbfa48e4b553161 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Fri, 12 Apr 2024 13:59:36 -0700 Subject: [PATCH 048/103] documentation changes + tailwind changes --- src/app/exhibitsPage/page.tsx | 18 +++++++++++------- .../userComponents/Exhibit/Exhibit.tsx | 6 +++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 47c11c9e..defdadc6 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -13,6 +13,7 @@ import BackButton from '../../components/userComponents/BackButton/page'; */ function App() { const [exhibits, setExhibits] = useState([]); + // fetches all the exhibits to display on the page useEffect(() => { // Get exhibits const getExhibits = async () => { @@ -23,12 +24,15 @@ function App() { // 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 = -50; + const yOffset = -200; if (element) { const y = element.getBoundingClientRect().top + window.scrollY + yOffset; @@ -44,21 +48,21 @@ function App() {
      -
      +

      Our Exhibits{' '} -

      -
      + +

      Saratoga is home to an abundance of plant and animal life. As you explore these exhibits you will learn about species that are endangered and being carefully monitored by scientists with protective efforts in place. -

      +

      -
      +

      Go to Map -

      +

        diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index ed226d3d..18e3d5a6 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -23,15 +23,15 @@ export default function Exhibit({ }) { return (
      • -
        +
        -

        +

        {' '} {title}

        -

        +

        {description}

        Exhibit From 2bab665e6fe7346679ffc8a16b6307c14c830728 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 21 Apr 2024 15:25:05 -0700 Subject: [PATCH 049/103] small styling changes --- src/app/exhibitsPage/page.tsx | 17 ++++++++++------- .../userComponents/Exhibit/Exhibit.tsx | 4 ++-- tailwind.config.ts | 3 +++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index defdadc6..1dec7631 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -24,9 +24,9 @@ function App() { // 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 + // 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) { @@ -52,10 +52,13 @@ function App() { Our Exhibits{' '}

        - Saratoga is home to an abundance of plant and animal life. As you - explore these exhibits you will learn about species that are - endangered and being carefully monitored by scientists with - protective efforts in place. + 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.

        diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index 18e3d5a6..a0633e16 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -26,12 +26,12 @@ export default function Exhibit({
        -

        +

        {' '} {title}

        -

        +

        {description}

        Exhibit diff --git a/tailwind.config.ts b/tailwind.config.ts index a5230b28..d0c06923 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: { lato: ['Lato'], From c285798ec48118ed157bd90a7b088d78d089d5cc Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 28 Apr 2024 13:18:29 -0700 Subject: [PATCH 050/103] some wbe changes --- src/app/exhibitsPage/page.tsx | 129 +++++++++++++++++++++++++--------- 1 file changed, 95 insertions(+), 34 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index 1dec7631..d69f2aa6 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -24,6 +24,16 @@ function App() { // Detect the hash in URL and scroll to the element with the corresponding ID }, [exhibits]); + // for web rendering + const [windowWidth, setWindowWidth] = useState(1024); + useEffect(() => { + const handleResize = () => setWindowWidth(window.innerWidth); + window.addEventListener('resize', handleResize); + return () => { + window.removeEventListener('resize', handleResize); + }; + }, []); + // 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 @@ -43,43 +53,94 @@ function App() { } }, []); return ( -
        - -
        - -
        -

        - 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. -

        +
        + {windowWidth < 1024 && ( +
        + +
        + +
        +

        + 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 => ( + + ))} +
        +
        - -
        -

        - Go to Map + )} + {windowWidth >= 1024 && ( +

        + +
        +

        + {' '} + + {' '} + 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 => ( + + ))} +
        - -
          - {exhibits.map(exhibit => ( - - ))} -
        -
        +
        + )}
        ); } From 7fcdd1a7d98daec31fc8d93e9bea427440ecdd9b Mon Sep 17 00:00:00 2001 From: jxmoose Date: Sun, 28 Apr 2024 14:53:59 -0700 Subject: [PATCH 051/103] maybe will make components equal heightsl ater if have time i cant figure it out lol fml --- src/app/exhibitsPage/page.tsx | 14 +++--- .../userComponents/Exhibit/Exhibit.tsx | 50 ++++++++++++++----- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index d69f2aa6..eab159f7 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -25,7 +25,7 @@ function App() { }, [exhibits]); // for web rendering - const [windowWidth, setWindowWidth] = useState(1024); + const [windowWidth, setWindowWidth] = useState(window.innerWidth); useEffect(() => { const handleResize = () => setWindowWidth(window.innerWidth); window.addEventListener('resize', handleResize); @@ -54,7 +54,7 @@ function App() { }, []); return (
        - {windowWidth < 1024 && ( + {windowWidth <= 1024 && (
        @@ -88,13 +88,14 @@ function App() { image={exhibit.image || ''} key={exhibit.id} id={exhibit.id} + web={false} /> ))}
    )} - {windowWidth >= 1024 && ( + {windowWidth > 1024 && (
    @@ -121,13 +122,13 @@ function App() {

    -
    +

    Go to Map

    -
      +
      {exhibits.map(exhibit => ( ))} -
    +
    )} diff --git a/src/components/userComponents/Exhibit/Exhibit.tsx b/src/components/userComponents/Exhibit/Exhibit.tsx index a0633e16..0961048f 100644 --- a/src/components/userComponents/Exhibit/Exhibit.tsx +++ b/src/components/userComponents/Exhibit/Exhibit.tsx @@ -8,6 +8,7 @@ import Image from 'next/image'; * @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({ @@ -15,28 +16,51 @@ export default function Exhibit({ description, image, id, + web, }: { title: string; description: string; image: string; id: number; + web: boolean; }) { return ( -
  • -
    -
    -
    -

    - {' '} - {title} -

    +
    + {!web && ( +
  • +
    +
    +
    +

    + {' '} + {title} +

    +
    +

    + {description} +

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

    + {' '} + {title} +

    +
    +

    + {description} +

    -

    - {description} -

    Exhibit +
    -
    - + )} +
    ); } From 6a3012138bd8d3cc998ca07eaff8ec470df33678 Mon Sep 17 00:00:00 2001 From: jxmoose Date: Tue, 14 May 2024 00:01:37 -0700 Subject: [PATCH 052/103] web resize changes --- src/app/exhibitsPage/page.tsx | 16 ++--- src/app/layout.tsx | 20 +++---- .../userComponents/Exhibit/Exhibit.tsx | 6 +- .../WindowWidthContext/WindowWidthContext.tsx | 58 +++++++++++++++++++ 4 files changed, 75 insertions(+), 25 deletions(-) create mode 100644 src/context/WindowWidthContext/WindowWidthContext.tsx diff --git a/src/app/exhibitsPage/page.tsx b/src/app/exhibitsPage/page.tsx index eab159f7..ab4de68d 100644 --- a/src/app/exhibitsPage/page.tsx +++ b/src/app/exhibitsPage/page.tsx @@ -7,11 +7,13 @@ 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(() => { @@ -24,16 +26,6 @@ function App() { // Detect the hash in URL and scroll to the element with the corresponding ID }, [exhibits]); - // for web rendering - const [windowWidth, setWindowWidth] = useState(window.innerWidth); - useEffect(() => { - const handleResize = () => setWindowWidth(window.innerWidth); - window.addEventListener('resize', handleResize); - return () => { - window.removeEventListener('resize', handleResize); - }; - }, []); - // 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 @@ -54,7 +46,7 @@ function App() { }, []); return (
    - {windowWidth <= 1024 && ( + {!isWebDevice && (
    @@ -95,7 +87,7 @@ function App() {
    )} - {windowWidth > 1024 && ( + {isWebDevice && (
    diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 8bb23574..26910912 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,22 +1,17 @@ import './globals.css'; import type { Metadata } from 'next'; -import { Inter, Lato, Manrope } from 'next/font/google'; +import { Inter } from 'next/font/google'; import React from 'react'; +import { WindowWidthProvider } from '../context/WindowWidthContext/WindowWidthContext'; const inter = Inter({ subsets: ['latin'] }); -const manrope = Manrope({ weight: ['400', '700'], subsets: ['latin'] }); - -const lato = Lato({ - weight: ['400', '700'], - subsets: ['latin'], -}); +// const lato = Lato({ weight: ['300', '400', '500', '700'], subsets: ['latin'] }); 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. @@ -37,9 +32,10 @@ export default function RootLayout({ crossOrigin="" />