Skip to content

Commit

Permalink
add og description and remove topics from markets list
Browse files Browse the repository at this point in the history
  • Loading branch information
Robiquet committed Feb 16, 2024
1 parent d1b8b72 commit a3465a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 33 deletions.
14 changes: 1 addition & 13 deletions components/markets/MarketsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import { Topics } from "components/front-page/Topics";

export type MarketsListProps = {
className?: string;
cmsTopics: CmsTopicHeader[];
cmsTopicPlaceholders: string[];
};

const useChangeQuery = (
Expand Down Expand Up @@ -59,11 +57,7 @@ const useChangeQuery = (
}, [withLiquidityOnly]);
};

const MarketsList = ({
className = "",
cmsTopics,
cmsTopicPlaceholders,
}: MarketsListProps) => {
const MarketsList = ({ className = "" }: MarketsListProps) => {
const [filters, setFilters] = useState<MarketFilter[]>();
const [orderBy, setOrderBy] = useState<MarketsOrderBy>();
const [withLiquidityOnly, setWithLiquidityOnly] = useState<boolean>();
Expand Down Expand Up @@ -104,12 +98,6 @@ const MarketsList = ({
data-testid="marketsList"
id={"market-list"}
>
{process.env.NEXT_PUBLIC_SHOW_TOPICS === "true" && (
<div className="flex gap-2 py-8">
<Topics topics={cmsTopics} imagePlaceholders={cmsTopicPlaceholders} />
</div>
)}

<MarketFilterSelection
onFiltersChange={setFilters}
onOrderingChange={setOrderBy}
Expand Down
19 changes: 2 additions & 17 deletions pages/markets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,20 @@ import { CmsTopicHeader, getCmsTopicHeaders } from "lib/cms/topics";
import { getPlaiceholders } from "lib/util/getPlaiceHolders";

const MarketsPage: NextPage = ({
cmsTopics,
cmsTopicPlaceholders,
}: {
cmsTopics: CmsTopicHeader[];
cmsTopicPlaceholders: string[];
}) => {
return (
<MarketsList
cmsTopics={cmsTopics}
cmsTopicPlaceholders={cmsTopicPlaceholders}
/>
);
return <MarketsList />;
};

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(
Expand All @@ -47,8 +34,6 @@ export async function getStaticProps() {
return {
props: {
dehydratedState: dehydrate(queryClient),
cmsTopics,
cmsTopicPlaceholders,
},
revalidate:
environment === "production"
Expand Down
8 changes: 5 additions & 3 deletions pages/topics/[topic].tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -72,11 +72,13 @@ const TopicPage: NextPage<{
blurDataURL: cmsTopic.bannerBlurData,
};
}
console.log(cmsTopic.description);

return (
<div>
<OgHead title={cmsTopic.title} />
<OgHead
title={cmsTopic.title}
description={toPlainText(cmsTopic.description)}
/>
{banner && (
<div className="relative mb-10 mt-3 h-[150px] w-full md:h-[262px]">
<Image
Expand Down

0 comments on commit a3465a6

Please sign in to comment.