From 5ca4d3fb7f498665f117e0bc0d8c8e03ae0e8008 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 14 Sep 2023 17:29:07 +0800 Subject: [PATCH] feat: publishing menu in connect button --- src/app/site/[site]/shorts/page.tsx | 2 +- src/components/common/ConnectButton.tsx | 70 +++++++++++++++++++++-- src/components/dashboard/PagesManager.tsx | 3 +- src/lib/i18n/locales/ja/dashboard.json | 2 - src/lib/i18n/locales/zh-TW/dashboard.json | 2 - src/lib/i18n/locales/zh/common.json | 6 +- src/lib/i18n/locales/zh/dashboard.json | 4 -- 7 files changed, 74 insertions(+), 15 deletions(-) diff --git a/src/app/site/[site]/shorts/page.tsx b/src/app/site/[site]/shorts/page.tsx index 38b75e08a9..f1ecaf1502 100644 --- a/src/app/site/[site]/shorts/page.tsx +++ b/src/app/site/[site]/shorts/page.tsx @@ -42,7 +42,7 @@ async function SiteShortsPage({ type: "short", visibility: PageVisibilityEnum.Published, useStat: true, - limit: 18, + limit: 20, }, queryClient, ) diff --git a/src/components/common/ConnectButton.tsx b/src/components/common/ConnectButton.tsx index 1130fd2417..8ac90152a7 100644 --- a/src/components/common/ConnectButton.tsx +++ b/src/components/common/ConnectButton.tsx @@ -24,6 +24,7 @@ import { BellIcon, FaceFrownIcon, FaceSmileIcon, + PlusCircleIcon, } from "@heroicons/react/24/outline" import { BellAlertIcon } from "@heroicons/react/24/solid" @@ -194,6 +195,29 @@ export const ConnectButton = ({ }, ] + const addDropdownLinks: HeaderLinkType[] = [ + { + icon: "icon-[mingcute--news-line]", + label: t("New Post") || "", + href: `${SITE_URL}/dashboard/${account?.character?.handle}/editor?type=post`, + }, + { + icon: "icon-[mingcute--file-line]", + label: t("New Page") || "", + href: `${SITE_URL}/dashboard/${account?.character?.handle}/editor?type=page`, + }, + { + icon: "icon-[mingcute--ins-line]", + label: t("New Short") || "", + href: `${SITE_URL}/dashboard/${account?.character?.handle}/editor?type=short`, + }, + { + icon: "icon-[mingcute--cloud-line]", + label: t("New Portfolio") || "", + href: `${SITE_URL}/dashboard/${account?.character?.handle}/editor?type=portfolio`, + }, + ] + return (
) : ( )} -
+ + } + dropdown={ +
+ {addDropdownLinks.map((link, i) => ( + } + className={`${ + size === "base" ? "pl-5 pr-6 h-11" : "pl-4 pr-5 h-9" + } whitespace-nowrap`} + {...("href" in link + ? { + type: "link", + href: link.href, + } + : { + type: "button", + onClick: link.onClick, + })} + > + {link.label} + + ))} +
+ } + /> +
@@ -250,7 +312,7 @@ export const ConnectButton = ({ placement="bottom-end" target={ {(type === "post" || type === "page") && ( diff --git a/src/lib/i18n/locales/ja/dashboard.json b/src/lib/i18n/locales/ja/dashboard.json index 6e9ddd2d8f..6a1b1dd292 100644 --- a/src/lib/i18n/locales/ja/dashboard.json +++ b/src/lib/i18n/locales/ja/dashboard.json @@ -24,8 +24,6 @@ "posts description": "記事は、時間順に表示されます。読者に新しいコンテンツを提供し続けることで、ブログのフォローワが増えるでしょう。<2>記事", "pages description": "ページは日付に影響を受けることがありません。「私たちについて」「お問い合わせ」などのようにページを活用しましょう。<2>ページ", "pages add": "ページを作成した後、<2>ナビゲーションメニューに追加することができます。ナビゲーションメニューに追加することで訪問者がそれを見つけやすくなります。", - "New Post": "新しい記事", - "New Page": "新しいページ", "Import": "インポート", "Import markdown file with front matter supported": "Markdown ファイル(Front Matter)をインポートします。", "View Site": "サイトを表示", diff --git a/src/lib/i18n/locales/zh-TW/dashboard.json b/src/lib/i18n/locales/zh-TW/dashboard.json index 656f67ec4e..9a27cace48 100644 --- a/src/lib/i18n/locales/zh-TW/dashboard.json +++ b/src/lib/i18n/locales/zh-TW/dashboard.json @@ -31,8 +31,6 @@ "posts description": "文章是按時間倒序在你的網站上列出的條目。可以將它們看作是更新,以提供新內容給讀者。<2>文章與頁面。", "pages description": "頁面是靜態的,不受日期影響。它們更像是你網站上的永久元素,比如“關於我們”、“聯繫我們”等。 <2>文章與頁面。", "pages add": "創建頁面後,你可以將其<2>添加到你網站的導航菜單中,以便瀏覽者可以找到它。", - "New Post": "新建文章", - "New Page": "新建頁面", "Import": "匯入", "Import markdown file with front matter supported": "匯入 Markdown 文件(支持 Front Matter)", "View Site": "查看網站", diff --git a/src/lib/i18n/locales/zh/common.json b/src/lib/i18n/locales/zh/common.json index c5af2c59c8..d61ebb5be5 100644 --- a/src/lib/i18n/locales/zh/common.json +++ b/src/lib/i18n/locales/zh/common.json @@ -106,5 +106,9 @@ "delete_confirmation_post": "你确定要删除这篇文章吗?", "delete_confirmation_page": "你确定要删除这个页面吗?", "delete_confirmation_comment": "你确定要删除这个评论吗?", - "delete_confirmation_portfolio": "你确定要删除这个作品吗?" + "delete_confirmation_portfolio": "你确定要删除这个作品吗?", + "New Post": "新建文章", + "New Page": "新建页面", + "New Portfolio": "新建作品", + "New Short": "新建图文" } diff --git a/src/lib/i18n/locales/zh/dashboard.json b/src/lib/i18n/locales/zh/dashboard.json index a36889e234..6c6cc82241 100644 --- a/src/lib/i18n/locales/zh/dashboard.json +++ b/src/lib/i18n/locales/zh/dashboard.json @@ -41,10 +41,6 @@ "shots add": "访问者可以在 <2>/shorts 查看你发布的图文,你可以将其<5>添加到导航菜单中,以便访问者可以找到它。", "pages add": "访问者只能通过链接访问你的页面,你可以将其<2>添加到导航菜单中,以便访问者可以找到它。", "portfolios add": "访问者可以在首页和 <2>/portfolios 查看你发布的作品,你可以将其<5>添加到导航菜单中,以便访问者可以找到它。", - "New Post": "新建文章", - "New Page": "新建页面", - "New Portfolio": "新建作品", - "New Short": "新建图文", "Import": "导入", "Import markdown file with front matter supported": "导入 Markdown 文件(支持 Front Matter)", "View Site": "查看站点",