feat: publishing menu in connect button
This commit is contained in:
@@ -42,7 +42,7 @@ async function SiteShortsPage({
|
||||
type: "short",
|
||||
visibility: PageVisibilityEnum.Published,
|
||||
useStat: true,
|
||||
limit: 18,
|
||||
limit: 20,
|
||||
},
|
||||
queryClient,
|
||||
)
|
||||
|
||||
@@ -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 (
|
||||
<div
|
||||
{...(!ssrReady && {
|
||||
@@ -229,19 +253,57 @@ export const ConnectButton = ({
|
||||
{isAllRead ? (
|
||||
<BellIcon
|
||||
className={`${
|
||||
size === "base" ? "w-7 h-7" : "w-6 h-6"
|
||||
size === "base" ? "w-6 h-6" : "w-5 h-5"
|
||||
} text-zinc-500 cursor-pointer sm:hover:animate-buzz-out`}
|
||||
onClick={showNotificationModal}
|
||||
/>
|
||||
) : (
|
||||
<BellAlertIcon
|
||||
className={`${
|
||||
size === "base" ? "w-7 h-7" : "w-6 h-6"
|
||||
size === "base" ? "w-6 h-6" : "w-5 h-5"
|
||||
} text-accent cursor-pointer sm:hover:animate-buzz-out`}
|
||||
onClick={showNotificationModal}
|
||||
/>
|
||||
)}
|
||||
<div className="h-full w-[2px] py-1 ml-3">
|
||||
<Menu
|
||||
placement="bottom"
|
||||
target={
|
||||
<PlusCircleIcon
|
||||
className={`${
|
||||
size === "base" ? "w-6 h-6 ml-2" : "w-5 h-5 ml-1"
|
||||
} text-zinc-500 cursor-pointer`}
|
||||
/>
|
||||
}
|
||||
dropdown={
|
||||
<div
|
||||
className={`min-w-[140px] ${
|
||||
size === "base" ? "text-base" : "text-sm"
|
||||
}`}
|
||||
>
|
||||
{addDropdownLinks.map((link, i) => (
|
||||
<Menu.Item
|
||||
key={i}
|
||||
icon={<i className={cn(link.icon, "text-base")} />}
|
||||
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}
|
||||
</Menu.Item>
|
||||
))}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<div className="h-full w-[2px] py-1 ml-2">
|
||||
<div className="w-full h-full bg-zinc-200 rounded-full"></div>
|
||||
</div>
|
||||
</>
|
||||
@@ -250,7 +312,7 @@ export const ConnectButton = ({
|
||||
placement="bottom-end"
|
||||
target={
|
||||
<button
|
||||
className="flex items-center w-full hover:bg-hover transition-colors py-1 px-2 rounded-lg ml-1 focus-visible:outline focus-visible:outline-accent focus-visible:outline-offset-1"
|
||||
className="flex items-center hover:bg-hover transition-colors py-1 px-2 rounded-lg ml-1 focus-visible:outline focus-visible:outline-accent focus-visible:outline-offset-1"
|
||||
type="button"
|
||||
aria-label="connector"
|
||||
>
|
||||
|
||||
@@ -55,6 +55,7 @@ export const PagesManager = ({ type }: { type: NoteType }) => {
|
||||
|
||||
const { t, i18n } = useTranslation("dashboard")
|
||||
const { t: siteT } = useTranslation("site")
|
||||
const { t: commonT } = useTranslation("common")
|
||||
const date = useDate()
|
||||
|
||||
const pages = useGetPagesBySite({
|
||||
@@ -299,7 +300,7 @@ export const PagesManager = ({ type }: { type: NoteType }) => {
|
||||
>
|
||||
<span className="icon-[mingcute--add-line] inline-block"></span>
|
||||
<span>
|
||||
{t(`New ${type.charAt(0).toUpperCase() + type.slice(1)}`)}
|
||||
{commonT(`New ${type.charAt(0).toUpperCase() + type.slice(1)}`)}
|
||||
</span>
|
||||
</Button>
|
||||
{(type === "post" || type === "page") && (
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
"posts description": "記事は、時間順に表示されます。読者に新しいコンテンツを提供し続けることで、ブログのフォローワが増えるでしょう。<2>記事</2>",
|
||||
"pages description": "ページは日付に影響を受けることがありません。「私たちについて」「お問い合わせ」などのようにページを活用しましょう。<2>ページ</2>",
|
||||
"pages add": "ページを作成した後、<2>ナビゲーションメニューに追加する</2>ことができます。ナビゲーションメニューに追加することで訪問者がそれを見つけやすくなります。",
|
||||
"New Post": "新しい記事",
|
||||
"New Page": "新しいページ",
|
||||
"Import": "インポート",
|
||||
"Import markdown file with front matter supported": "Markdown ファイル(Front Matter)をインポートします。",
|
||||
"View Site": "サイトを表示",
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
"posts description": "文章是按時間倒序在你的網站上列出的條目。可以將它們看作是更新,以提供新內容給讀者。<2>文章與頁面</2>。",
|
||||
"pages description": "頁面是靜態的,不受日期影響。它們更像是你網站上的永久元素,比如“關於我們”、“聯繫我們”等。 <2>文章與頁面</2>。",
|
||||
"pages add": "創建頁面後,你可以將其<2>添加到你網站的導航菜單中</2>,以便瀏覽者可以找到它。",
|
||||
"New Post": "新建文章",
|
||||
"New Page": "新建頁面",
|
||||
"Import": "匯入",
|
||||
"Import markdown file with front matter supported": "匯入 Markdown 文件(支持 Front Matter)",
|
||||
"View Site": "查看網站",
|
||||
|
||||
@@ -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": "新建图文"
|
||||
}
|
||||
|
||||
@@ -41,10 +41,6 @@
|
||||
"shots add": "访问者可以在 <2>/shorts</2> 查看你发布的图文,你可以将其<5>添加到导航菜单中</5>,以便访问者可以找到它。",
|
||||
"pages add": "访问者只能通过链接访问你的页面,你可以将其<2>添加到导航菜单中</2>,以便访问者可以找到它。",
|
||||
"portfolios add": "访问者可以在首页和 <2>/portfolios</2> 查看你发布的作品,你可以将其<5>添加到导航菜单中</5>,以便访问者可以找到它。",
|
||||
"New Post": "新建文章",
|
||||
"New Page": "新建页面",
|
||||
"New Portfolio": "新建作品",
|
||||
"New Short": "新建图文",
|
||||
"Import": "导入",
|
||||
"Import markdown file with front matter supported": "导入 Markdown 文件(支持 Front Matter)",
|
||||
"View Site": "查看站点",
|
||||
|
||||
Reference in New Issue
Block a user