Skip to content

Commit

Permalink
hide about if not in cms
Browse files Browse the repository at this point in the history
  • Loading branch information
saml33 committed Dec 9, 2023
1 parent 3244f70 commit f6dd81b
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 21 deletions.
17 changes: 6 additions & 11 deletions app/(pages)/explore/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,12 @@ async function TokenPage({ params }: TokenPageProps) {
tokenPageData={tokenPageData}
/>
</div>
{/* <div className={SECTION_WRAPPER_CLASSES}>
<h2 className="mb-4 text-2xl">Safety</h2>
<TokenStats
tokenData={tokenPageData}
securityData={birdeyeSecurityData}
/>
</div> */}
<div className={SECTION_WRAPPER_CLASSES}>
<h2 className="mb-4 text-2xl">{`About ${tokenName}`}</h2>
<TokenAbout content={description} />
</div>
{description ? (
<div className={SECTION_WRAPPER_CLASSES}>
<h2 className="mb-4 text-2xl">{`About ${tokenName}`}</h2>
<TokenAbout content={description} />
</div>
) : null}
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion app/components/explore/Explore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Explore = ({
const volume = birdeyeData?.v24hUSD
? `$${numberCompacter.format(birdeyeData.v24hUSD)}`
: '–'
const hasCustomIcon = CUSTOM_TOKEN_ICONS[mangoSymbol.toLowerCase()]
const hasCustomIcon = CUSTOM_TOKEN_ICONS[mangoSymbol?.toLowerCase()]
const logoPath = hasCustomIcon
? `/icons/tokens/${mangoSymbol.toLowerCase()}.svg`
: birdeyeData?.logoURI
Expand Down
2 changes: 1 addition & 1 deletion app/components/explore/token-page/TokenAbout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Document as RichTextDocument } from '@contentful/rich-text-types'
import RichText from '../../../../contentful/RichText'

const TokenAbout = ({ content }: { content: RichTextDocument | null }) => {
const TokenAbout = ({ content }: { content: RichTextDocument | undefined }) => {
return (
<div className="max-w-4xl">
<RichText document={content} />
Expand Down
2 changes: 2 additions & 0 deletions app/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const MANGO_DATA_API_URL = 'https://api.mngo.cloud/data/v4'
export const CUSTOM_TOKEN_ICONS: { [key: string]: boolean } = {
all: true,
bonk: true,
bsol: true,
btc: true,
chai: true,
crown: true,
Expand All @@ -15,6 +16,7 @@ export const CUSTOM_TOKEN_ICONS: { [key: string]: boolean } = {
hnt: true,
jitosol: true,
jlp: true,
jto: true,
kin: true,
ldo: true,
mngo: true,
Expand Down
2 changes: 1 addition & 1 deletion contentful/RichText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Document as RichTextDocument } from '@contentful/rich-text-types'
import { documentToReactComponents } from '@contentful/rich-text-react-renderer'

type RichTextProps = {
document: RichTextDocument | null
document: RichTextDocument | undefined
}

function RichText({ document }: RichTextProps) {
Expand Down
4 changes: 2 additions & 2 deletions contentful/blogPost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type BlogPostEntry = Entry<TypeBlogPostSkeleton, undefined, string>
export interface BlogPost {
postTitle: string
postDescription: string
postContent: RichTextDocument | null
postContent: RichTextDocument | undefined
postHeroImage: ContentImage | null
slug: string
}
Expand All @@ -28,7 +28,7 @@ export function parseContentfulBlogPost(
return {
postTitle: blogPostEntry.fields.postTitle || '',
postDescription: blogPostEntry.fields.postDescription,
postContent: blogPostEntry.fields.postContent || null,
postContent: blogPostEntry.fields.postContent || undefined,
postHeroImage: parseContentfulContentImage(
blogPostEntry.fields.postHeroImage,
),
Expand Down
4 changes: 2 additions & 2 deletions contentful/tokenPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface TokenPage {
tokenName: string
symbol: string
slug: string
description: RichTextDocument | null
description: RichTextDocument | undefined
tags: string[]
websiteUrl?: string
twitterUrl?: string
Expand All @@ -38,7 +38,7 @@ export function parseContentfulTokenPage(
tokenName: tokenPageEntry.fields.tokenName,
symbol: tokenPageEntry.fields.symbol,
slug: tokenPageEntry.fields.slug,
description: tokenPageEntry.fields.description || null,
description: tokenPageEntry.fields.description || undefined,
tags: tokenPageEntry.fields.tags || [],
websiteUrl: tokenPageEntry.fields.websiteUrl || undefined,
twitterUrl: tokenPageEntry.fields.twitterUrl || undefined,
Expand Down
9 changes: 7 additions & 2 deletions contentful/types/TypeToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ export interface TypeTokenFields {
slug: EntryFieldTypes.Symbol
seoTitle: EntryFieldTypes.Symbol
seoDescription: EntryFieldTypes.Text
description: EntryFieldTypes.RichText
description?: EntryFieldTypes.RichText
tags: EntryFieldTypes.Array<
EntryFieldTypes.Symbol<
'Blue Chip' | 'Dog Coins' | 'Governanace' | 'Liquid Staking' | 'Meme'
| 'Blue Chip'
| 'Bridged (Portal)'
| 'Dog Coins'
| 'Governanace'
| 'Liquid Staking'
| 'Meme'
>
>
websiteUrl?: EntryFieldTypes.Symbol
Expand Down
15 changes: 15 additions & 0 deletions public/icons/tokens/jto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tsconfig.tsbuildinfo

Large diffs are not rendered by default.

0 comments on commit f6dd81b

Please sign in to comment.