diff --git a/src/components/dashboard/PagesManager.tsx b/src/components/dashboard/PagesManager.tsx index ab182759..99091ba1 100644 --- a/src/components/dashboard/PagesManager.tsx +++ b/src/components/dashboard/PagesManager.tsx @@ -14,6 +14,7 @@ import { Menu } from "@headlessui/react" import { useQueryClient } from "@tanstack/react-query" import PostCover from "~/components/home/PostCover" +import { Image } from "~/components/ui/Image" import { useDate } from "~/hooks/useDate" import { Trans, useTranslation } from "~/lib/i18n/client" import { getPageVisibility } from "~/lib/page-helpers" @@ -24,6 +25,7 @@ import { cn } from "~/lib/utils" import { useGetPagesBySite, usePinnedPage } from "~/queries/page" import { useGetSite } from "~/queries/site" +import { PlatformsSyncMap } from "../site/Platform" import { Button } from "../ui/Button" import { EmptyState } from "../ui/EmptyState" import { TabItem, Tabs } from "../ui/Tabs" @@ -187,7 +189,18 @@ export const PagesManager = ({ type }: { type: NoteType }) => { ) break case "portfolio": // TODO - description = <> + description = ( + <> +

+ + The portfolio is a collection of works outside of xLog, such as + your YouTube videos and GitHub projects. They will be displayed in + the list on the homepage like posts. The difference is that the + portfolio directly links to external URLs. + +

+ + ) } let currentLength = 0 @@ -212,17 +225,19 @@ export const PagesManager = ({ type }: { type: NoteType }) => { {t(`New ${type.charAt(0).toUpperCase() + type.slice(1)}`)} - - - - - + {type !== "portfolio" && ( + + + + + + )}
{description} @@ -250,6 +265,15 @@ export const PagesManager = ({ type }: { type: NoteType }) => { (page) => page.list?.map((page) => { currentLength++ + const isPortfolio = + page.metadata?.content?.tags?.[0] === "portfolio" + const externalLink = page.metadata?.content?.external_urls?.[0] + const platform = Object.values(PlatformsSyncMap).find( + (p) => + p.portfolioDomain && + externalLink?.startsWith(p.portfolioDomain), + ) + return ( { {page.metadata?.content?.summary && "..."}
- {!!page.metadata?.content?.tags?.[1] && ( - - - {page.metadata?.content?.tags?.[1]} - - )} - - - - {page.metadata?.content?.readingTime} {t("min")} - - - {!!page.stat?.viewDetailCount && ( - - - {page.stat?.viewDetailCount} - + {isPortfolio ? ( + <> + + + {platform?.icon && ( + {platform?.name} + )} + {t("Portfolio")} + + + + ) : ( + <> + {!!page.metadata?.content?.tags?.[1] && ( + + + {page.metadata?.content?.tags?.[1]} + + )} + + + + {page.metadata?.content?.readingTime} {t("min")} + + + {!!page.stat?.viewDetailCount && ( + + + {page.stat?.viewDetailCount} + + )} + )}
diff --git a/src/lib/i18n/locales/zh/dashboard.json b/src/lib/i18n/locales/zh/dashboard.json index aa76af6f..df18e1f7 100644 --- a/src/lib/i18n/locales/zh/dashboard.json +++ b/src/lib/i18n/locales/zh/dashboard.json @@ -33,6 +33,7 @@ "link post-vs-page": "https://wordpress.com/zh-cn/support/post-vs-page/", "posts description": "文章是按时间倒序在你的网站上列出的条目。可以将它们看作是更新,以提供新内容给读者。<2>文章与页面。", "pages description": "页面是静态的,不受日期影响。它们更像是你网站上的永久元素,比如“关于我们”、“联系我们”等。<2>文章与页面。", + "portfolios description": "作品集是 xLog 之外的作品,比如你的 YouTube 视频、GitHub 项目,它们将像文章一样显示在主页的列表中。不同之处在于作品集直接跳转到外部网址。", "pages add": "创建页面后,你可以将其<2>添加到你网站的导航菜单中,以便访问者可以找到它。", "New Post": "新建文章", "New Page": "新建页面",