diff --git a/ui/src/pages/listen/index.tsx b/ui/src/pages/listen/index.tsx index ec78fba1..2c818168 100644 --- a/ui/src/pages/listen/index.tsx +++ b/ui/src/pages/listen/index.tsx @@ -1,6 +1,7 @@ import { Container, Stack, Typography } from "@mui/material"; import { dehydrate, QueryClient } from "@tanstack/react-query"; import Head from "next/head"; +import { useMemo } from "react"; import FeedCard from "@/components/FeedCard"; import { getMapLayout } from "@/components/layouts/MapLayout"; @@ -8,9 +9,16 @@ import { useFeedsQuery } from "@/graphql/generated"; import type { NextPageWithLayout } from "@/pages/_app"; const FeedsPage: NextPageWithLayout = () => { - const feeds = useFeedsQuery().data?.feeds; + const feedsQueryResult = useFeedsQuery(); - if (!feeds) return null; + // Sort feeds by high latitude to low (to match the order on the map) + const sortedFeeds = useMemo( + () => + feedsQueryResult.data?.feeds.sort((a, b) => b.latLng.lat - a.latLng.lat), + [feedsQueryResult.data], + ); + + if (!sortedFeeds) return null; return (