diff --git a/src/components/site/SiteHeader.tsx b/src/components/site/SiteHeader.tsx index 4aba9f00..7a72a0be 100644 --- a/src/components/site/SiteHeader.tsx +++ b/src/components/site/SiteHeader.tsx @@ -180,9 +180,10 @@ export const SiteHeader: React.FC<{ {site?.name} {site?.bio && ( -
- {site?.bio} -
+
)}
{siteSubscriptions.data ? ( diff --git a/src/components/site/SiteLayout.tsx b/src/components/site/SiteLayout.tsx index 5d20d0b8..e062aea9 100644 --- a/src/components/site/SiteLayout.tsx +++ b/src/components/site/SiteLayout.tsx @@ -42,7 +42,9 @@ export const SiteLayout: React.FC = ({ ]*>/g, "") + } image={getUserContentsUrl(site?.avatars?.[0])} /> diff --git a/src/css/tailwind.css b/src/css/tailwind.css index 502e9473..b732e508 100644 --- a/src/css/tailwind.css +++ b/src/css/tailwind.css @@ -236,3 +236,7 @@ textarea.input { .cm-editor { @apply h-full; } + +.xlog-site-description a { + @apply underline; +} diff --git a/src/lib/types.ts b/src/lib/types.ts index 31cad907..eb2ce219 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -86,6 +86,7 @@ export type Profile = UniProfile & { css?: string ga?: string custom_domain?: string + description?: string } export type Profiles = { diff --git a/src/models/site.model.ts b/src/models/site.model.ts index 0988be2d..bfc08579 100644 --- a/src/models/site.model.ts +++ b/src/models/site.model.ts @@ -3,6 +3,7 @@ import { nanoid } from "nanoid" import { checkReservedWords } from "~/lib/reserved-words" import unidata from "~/lib/unidata" import { indexer, getContract } from "~/lib/crossbell" +import { renderPageContent } from "~/markdown" export const checkSubdomain = async ({ subdomain, @@ -31,7 +32,7 @@ export const checkSubdomain = async ({ // } } -const expandSite = (site: Profile) => { +const expandSite = async (site: Profile) => { site.navigation = JSON.parse( site.metadata?.raw?.attributes?.find( (a: any) => a.trait_type === "xlog_navigation", @@ -56,6 +57,7 @@ const expandSite = (site: Profile) => { (a: any) => a.trait_type === "xlog_custom_domain", )?.value || "" site.name = site.name || site.username + site.description = (await renderPageContent(site.bio || "")).contentHTML return site } @@ -73,10 +75,12 @@ export const getUserSites = async (address?: string) => { }, }) - const sites: Profile[] = profiles.list?.map((profile) => { - expandSite(profile) - return profile - }) + const sites: Profile[] = await Promise.all( + profiles.list?.map((profile) => { + expandSite(profile) + return profile + }), + ) if (!sites || !sites.length) return null @@ -91,7 +95,7 @@ export const getSite = async (input: string) => { }) const site: Profile = profiles.list[0] - expandSite(site) + await expandSite(site) return site } diff --git a/src/pages/dashboard/[subdomain]/settings/general.tsx b/src/pages/dashboard/[subdomain]/settings/general.tsx index eb8333fc..0391382c 100644 --- a/src/pages/dashboard/[subdomain]/settings/general.tsx +++ b/src/pages/dashboard/[subdomain]/settings/general.tsx @@ -77,10 +77,12 @@ export default function SiteSettingsGeneralPage() { -