From cffc17386621d479e71b6f73a7e7546156bc9a5a Mon Sep 17 00:00:00 2001 From: Jay Varner Date: Thu, 21 Nov 2024 13:35:04 -0500 Subject: [PATCH] Switching to only Elasticsearch --- app/components/FeaturedMedium.tsx | 15 +- app/components/VideoEmbed.tsx | 24 +- app/components/VideoModal.tsx | 16 +- app/components/VideoThumbnail.tsx | 34 +-- app/components/layout/PlaceContent.tsx | 2 + app/components/layout/RelatedRecords.tsx | 31 +-- .../relatedRecords/RelatedPhotographs.tsx | 78 ++++--- .../relatedRecords/RelatedPlaces.tsx | 211 ++++++++---------- .../relatedRecords/RelatedVideos.tsx | 16 +- app/contexts.ts | 36 ++- app/data/coredata.ts | 21 +- app/esTypes.ts | 53 +++++ app/routes/islands.$id.tsx | 97 +++----- app/routes/places.$id.tsx | 23 +- app/types.ts | 8 +- app/utils/toFeatureCollection.ts | 17 +- package-lock.json | 2 +- package.json | 2 +- 18 files changed, 331 insertions(+), 355 deletions(-) create mode 100644 app/esTypes.ts diff --git a/app/components/FeaturedMedium.tsx b/app/components/FeaturedMedium.tsx index 565435a..32a3d80 100644 --- a/app/components/FeaturedMedium.tsx +++ b/app/components/FeaturedMedium.tsx @@ -1,19 +1,16 @@ +import type { ESPlace } from "~/esTypes"; import VideoEmbed from "./VideoEmbed"; -import type { TRelatedCoreDataRecords } from "~/types"; interface Props { - record: TRelatedCoreDataRecords; + record: ESPlace; } const FeaturedMedium = ({ record }: Props) => { - if (!record.items || !record.media_contents) return null; - if (record.items?.videos) { - return ; + if (record.featured_video) { + return ; } - if (record.media_contents?.photographs) { - return ( - - ); + if (record.featured_photograph) { + return ; } return <>; }; diff --git a/app/components/VideoEmbed.tsx b/app/components/VideoEmbed.tsx index 7a3c868..ce48541 100644 --- a/app/components/VideoEmbed.tsx +++ b/app/components/VideoEmbed.tsx @@ -1,32 +1,16 @@ -import { useMemo, useState } from "react"; -import type { TVideoItem } from "../types"; +import type { ESVideo } from "~/esTypes"; interface Props { - video: TVideoItem; + video: ESVideo; } const VideoEmbed = ({ video }: Props) => { - const [embedSrc, setEmbedSrc] = useState(undefined); - - useMemo(() => { - switch (video.provider) { - case "Vimeo": - setEmbedSrc(`https://player.vimeo.com/video/${video.embed_id}`); - break; - case "YouTube": - setEmbedSrc(`https://www.youtube.com/embed/${video.embed_id}`); - default: - break; - } - return; - }, [video]); - return (