From d1b8b729171921a51850ba722487de1bf34cd213 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Fri, 16 Feb 2024 12:19:44 +0200 Subject: [PATCH 1/3] add oghead --- components/meta/OgHead.tsx | 34 ++++++++++++++-------------------- pages/topics/[topic].tsx | 3 +++ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/components/meta/OgHead.tsx b/components/meta/OgHead.tsx index c85d68784..a12549a1e 100644 --- a/components/meta/OgHead.tsx +++ b/components/meta/OgHead.tsx @@ -9,49 +9,43 @@ export type OgProps = { const defaultDescription = "The application interface for Zeitgeist Prediction Markets. Built on Polkadot, Zeitgeist is the leader in decentralized prediction markets."; -export const OgHead = (props: OgProps) => { +export const OgHead = ({ title, description, image }: OgProps) => { + description ??= defaultDescription; + return ( - {props.title && ( + {title && ( <> - {props.title} - - + {title} + + )} <> - + - {props.image && ( + {image && ( <> - + )} diff --git a/pages/topics/[topic].tsx b/pages/topics/[topic].tsx index a67d26e77..fb6e8c026 100644 --- a/pages/topics/[topic].tsx +++ b/pages/topics/[topic].tsx @@ -2,6 +2,7 @@ import { PortableText } from "@portabletext/react"; import { FullMarketFragment } from "@zeitgeistpm/indexer"; import { ZeitgeistIpfs, create } from "@zeitgeistpm/sdk"; import MarketCard from "components/markets/market-card"; +import { OgHead } from "components/meta/OgHead"; import { sanityImageBuilder } from "lib/cms/sanity"; import { CmsTopicFull, @@ -71,9 +72,11 @@ const TopicPage: NextPage<{ blurDataURL: cmsTopic.bannerBlurData, }; } + console.log(cmsTopic.description); return (
+ {banner && (
Date: Fri, 16 Feb 2024 12:34:47 +0200 Subject: [PATCH 2/3] add og description and remove topics from markets list --- components/markets/MarketsList.tsx | 14 +------------- pages/markets/index.tsx | 19 ++----------------- pages/topics/[topic].tsx | 8 +++++--- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/components/markets/MarketsList.tsx b/components/markets/MarketsList.tsx index d7a87f84d..7d713bc7f 100644 --- a/components/markets/MarketsList.tsx +++ b/components/markets/MarketsList.tsx @@ -19,8 +19,6 @@ import { Topics } from "components/front-page/Topics"; export type MarketsListProps = { className?: string; - cmsTopics: CmsTopicHeader[]; - cmsTopicPlaceholders: string[]; }; const useChangeQuery = ( @@ -59,11 +57,7 @@ const useChangeQuery = ( }, [withLiquidityOnly]); }; -const MarketsList = ({ - className = "", - cmsTopics, - cmsTopicPlaceholders, -}: MarketsListProps) => { +const MarketsList = ({ className = "" }: MarketsListProps) => { const [filters, setFilters] = useState(); const [orderBy, setOrderBy] = useState(); const [withLiquidityOnly, setWithLiquidityOnly] = useState(); @@ -104,12 +98,6 @@ const MarketsList = ({ data-testid="marketsList" id={"market-list"} > - {process.env.NEXT_PUBLIC_SHOW_TOPICS === "true" && ( -
- -
- )} - { - return ( - - ); + return ; }; export async function getStaticProps() { const queryClient = new QueryClient(); - const [cmsMarketMetaData, cmsTopics] = await Promise.all([ + const [cmsMarketMetaData] = await Promise.all([ getCmsMarketMetadataForAllMarkets(), - getCmsTopicHeaders(), ]); - const cmsTopicPlaceholders = await getPlaiceholders( - cmsTopics.map((topic) => topic.thumbnail ?? ""), - { size: 16 }, - ).then((plh) => plh.map((c) => c.base64) ?? []); - for (const marketCmsData of cmsMarketMetaData) { if (marketCmsData.marketId) { queryClient.setQueryData( @@ -47,8 +34,6 @@ export async function getStaticProps() { return { props: { dehydratedState: dehydrate(queryClient), - cmsTopics, - cmsTopicPlaceholders, }, revalidate: environment === "production" diff --git a/pages/topics/[topic].tsx b/pages/topics/[topic].tsx index fb6e8c026..8e0d6e03c 100644 --- a/pages/topics/[topic].tsx +++ b/pages/topics/[topic].tsx @@ -1,4 +1,4 @@ -import { PortableText } from "@portabletext/react"; +import { PortableText, toPlainText } from "@portabletext/react"; import { FullMarketFragment } from "@zeitgeistpm/indexer"; import { ZeitgeistIpfs, create } from "@zeitgeistpm/sdk"; import MarketCard from "components/markets/market-card"; @@ -72,11 +72,13 @@ const TopicPage: NextPage<{ blurDataURL: cmsTopic.bannerBlurData, }; } - console.log(cmsTopic.description); return (
- + {banner && (
Date: Fri, 16 Feb 2024 15:56:49 +0200 Subject: [PATCH 3/3] fix market card stats --- components/markets/market-card/index.tsx | 1 - pages/topics/[topic].tsx | 55 +++++++++++++++++++----- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/components/markets/market-card/index.tsx b/components/markets/market-card/index.tsx index b77b2911f..f7862a051 100644 --- a/components/markets/market-card/index.tsx +++ b/components/markets/market-card/index.tsx @@ -1,4 +1,3 @@ -import type { ScalarRangeType } from "@zeitgeistpm/sdk"; import Skeleton from "components/ui/Skeleton"; import Decimal from "decimal.js"; import { ZTG } from "lib/constants"; diff --git a/pages/topics/[topic].tsx b/pages/topics/[topic].tsx index 8e0d6e03c..03b998875 100644 --- a/pages/topics/[topic].tsx +++ b/pages/topics/[topic].tsx @@ -115,32 +115,67 @@ const TopicPage: NextPage<{
- - + +
- - + +
- {restMarkets.map((market) => ( - + {restMarkets.map(({ market, stats }) => ( + ))}
- {markets.map((market) => ( - + {markets.map(({ market, stats }) => ( + ))}
) : ( <>
- {markets.map((market) => ( - + {markets.map(({ market, stats }) => ( + ))}