diff --git a/server/lib/orcasite/radio_legacy/radio_legacy.ex b/server/lib/orcasite/radio_legacy/radio_legacy.ex index d593cf60..373224f0 100644 --- a/server/lib/orcasite/radio_legacy/radio_legacy.ex +++ b/server/lib/orcasite/radio_legacy/radio_legacy.ex @@ -5,7 +5,7 @@ defmodule Orcasite.RadioLegacy do import Ecto.Query, warn: false alias Orcasite.Repo - alias Orcasite.RadioLegacy.{Feed, Detection, Candidate} + alias Orcasite.RadioLegacy.{Detection, Candidate} def verify_can_submit_detection( feed_id, diff --git a/server/lib/orcasite_web/graphql/types/feed.ex b/server/lib/orcasite_web/graphql/types/feed.ex index 65b1a34c..1887d2fb 100644 --- a/server/lib/orcasite_web/graphql/types/feed.ex +++ b/server/lib/orcasite_web/graphql/types/feed.ex @@ -20,6 +20,16 @@ defmodule OrcasiteWeb.Types.Feed do end) end + field :longitude_latitude, non_null(:json) do + resolve(fn + %{location_point: %{coordinates: {lng, lat}}}, _, _ -> + {:ok, %{lng: lng, lat: lat}} + + _, _, _ -> + {:ok, %{}} + end) + end + field :thumb_url, non_null(:string) do resolve(fn %{node_name: node_name}, _, _ -> {:ok, feed_s3_url(node_name, "thumbnail.png")} diff --git a/ui/src/components/Map.tsx b/ui/src/components/Map.tsx index b6b71ce6..0fadb36c 100644 --- a/ui/src/components/Map.tsx +++ b/ui/src/components/Map.tsx @@ -17,7 +17,7 @@ export default function Map({ feeds, }: { setMap?: (map: LeafletMap) => void - currentFeed?: Pick + currentFeed?: Pick feeds: FeedsQuery['feeds'] }) { const router = useRouter() @@ -50,7 +50,7 @@ export default function Map({ {feeds.map((feed) => ( { if (feed && feed.slug !== currentFeed?.slug) { setCurrentFeed(feed) - map?.panTo(feed.locationPoint.coordinates) + map?.panTo(feed.longitudeLatitude) } }, [feed, map, currentFeed]) diff --git a/ui/src/components/Player/Player.tsx b/ui/src/components/Player/Player.tsx index 79044b67..8da0af66 100644 --- a/ui/src/components/Player/Player.tsx +++ b/ui/src/components/Player/Player.tsx @@ -153,7 +153,7 @@ export default function Player({ {currentFeed && - `${currentFeed.locationPoint.coordinates[0]}, ${currentFeed.locationPoint.coordinates[1]}`} + `${currentFeed.longitudeLatitude["lng"]}, ${currentFeed.longitudeLatitude["lat"]}`} ) diff --git a/ui/src/graphql/generated/index.ts b/ui/src/graphql/generated/index.ts index 6fd21982..f61d205d 100644 --- a/ui/src/graphql/generated/index.ts +++ b/ui/src/graphql/generated/index.ts @@ -105,6 +105,7 @@ export type Feed = { id: Scalars['ID']['output'] introHtml: Scalars['String']['output'] locationPoint: Scalars['Json']['output'] + longitudeLatitude: Scalars['Json']['output'] mapUrl: Scalars['String']['output'] name: Scalars['String']['output'] nodeName: Scalars['String']['output'] @@ -254,6 +255,7 @@ export type FeedQuery = { slug: string nodeName: string locationPoint: any + longitudeLatitude: any introHtml: string thumbUrl: string mapUrl: string @@ -271,6 +273,7 @@ export type FeedsQuery = { slug: string nodeName: string locationPoint: any + longitudeLatitude: any thumbUrl: string mapUrl: string }> @@ -335,6 +338,7 @@ export const FeedDocument = ` slug nodeName locationPoint + longitudeLatitude introHtml thumbUrl mapUrl @@ -363,6 +367,7 @@ export const FeedsDocument = ` slug nodeName locationPoint + longitudeLatitude thumbUrl mapUrl } diff --git a/ui/src/graphql/queries/getFeed.graphql b/ui/src/graphql/queries/getFeed.graphql index c4a27918..58af7627 100644 --- a/ui/src/graphql/queries/getFeed.graphql +++ b/ui/src/graphql/queries/getFeed.graphql @@ -5,6 +5,7 @@ query feed($slug: String!) { slug nodeName locationPoint + longitudeLatitude introHtml thumbUrl mapUrl diff --git a/ui/src/graphql/queries/listFeeds.graphql b/ui/src/graphql/queries/listFeeds.graphql index 8b786f04..64c4f300 100644 --- a/ui/src/graphql/queries/listFeeds.graphql +++ b/ui/src/graphql/queries/listFeeds.graphql @@ -5,6 +5,7 @@ query feeds { slug nodeName locationPoint + longitudeLatitude thumbUrl mapUrl }