diff --git a/public/locales/en/dashboard.json b/public/locales/en/dashboard.json index e13ef4d1..7a21d580 100644 --- a/public/locales/en/dashboard.json +++ b/public/locales/en/dashboard.json @@ -1,3 +1,5 @@ { - "link post-vs-page" : "https://wordpress.com/zh-cn/support/post-vs-page/" + "link post-vs-page" : "https://wordpress.com/zh-cn/support/post-vs-page/", + "delete_confirmation_post": "Are you sure you want to DELETE this post?", + "delete_confirmation_page": "Are you sure you want to DELETE this page?" } \ No newline at end of file diff --git a/public/locales/ja/dashboard.json b/public/locales/ja/dashboard.json index 2950c2a3..76ecccfb 100644 --- a/public/locales/ja/dashboard.json +++ b/public/locales/ja/dashboard.json @@ -13,7 +13,7 @@ "Site Duration": "サイトの運営期間", "days": "日", "Deleted!": "削除されました!", - "Fail to Deleted." : "削除できませんでした。", + "Fail to Deleted.": "削除できませんでした。", "Converted!": "変換されました!", "Failed to convert.": "変換に失敗しました。", "All Posts": "すべての記事", @@ -115,5 +115,7 @@ "Operator Character Check": "オペレーターキャラクターチェック", "Warning": "警告", "Operators have permissions to enter your dashboard, change your settings(excluding xLog subdomain) and post, modify, delete contents on your site.": "シャドー認証では、ダッシュボードへのアクセス、設定の変更(xLog サブドメインを除く)、サイトのコンテンツの公開・修正・削除が可能です。", - "Add": "新規" -} + "Add": "新規", + "delete_confirmation_post": "この記事を削除してもよろしいですか?", + "delete_confirmation_page": "このページを削除してもよろしいですか?" +} \ No newline at end of file diff --git a/public/locales/zh-TW/dashboard.json b/public/locales/zh-TW/dashboard.json index 338dc5b8..2b3bd2fb 100644 --- a/public/locales/zh-TW/dashboard.json +++ b/public/locales/zh-TW/dashboard.json @@ -15,7 +15,7 @@ "Site Duration": "網站運作時間", "days": "天", "Deleted!": "刪掉了哦!", - "Fail to Deleted." : "删除失败", + "Fail to Deleted.": "删除失败", "Converted!": "轉換成功!", "Failed to convert.": "轉換失敗。", "All Posts": "所有文章", @@ -180,5 +180,9 @@ "Today": "今天", "This month": "本月", "This week": "本周", - "All time": "全部" -} + "All time": "全部", + "delete_confirmation_post": "你確認要刪除這篇文章嗎?", + "delete_confirmation_page": "你確認要刪除這個頁面嗎?", + "Confirm": "確認", + "Cancel": "取消" +} \ No newline at end of file diff --git a/public/locales/zh/dashboard.json b/public/locales/zh/dashboard.json index 6a9afab5..7cdf5b72 100644 --- a/public/locales/zh/dashboard.json +++ b/public/locales/zh/dashboard.json @@ -14,10 +14,10 @@ "Total Views": "浏览总数", "Site Duration": "站点运行时间", "days": "天", - "Deleted!" : "已删除!", - "Fail to Deleted." : "删除失败", - "Converted!" : "已转换!", - "Failed to convert." : "转换失败。", + "Deleted!": "已删除!", + "Fail to Deleted.": "删除失败", + "Converted!": "已转换!", + "Failed to convert.": "转换失败。", "All Posts": "所有文章", "All Pages": "所有页面", "Published": "已发布", @@ -28,7 +28,7 @@ "scheduled": "定时发布", "published and local modified": "已发布并本地修改", "Others on Crossbell": "Crossbell上的其他内容", - "link post-vs-page" : "https://wordpress.com/zh-cn/support/post-vs-page/", + "link post-vs-page": "https://wordpress.com/zh-cn/support/post-vs-page/", "posts description": "文章是按时间倒序在你的网站上列出的条目。可以将它们看作是更新,以提供新内容给读者。<2>文章与页面。", "pages description": "页面是静态的,不受日期影响。它们更像是你网站上的永久元素,比如“关于我们”、“联系我们”等。<2>文章与页面。", "pages add": "创建页面后,你可以将其<2>添加到你网站的导航菜单中,以便访问者可以找到它。", @@ -37,8 +37,8 @@ "Import": "导入", "Import markdown file with front matter supported": "导入 Markdown 文件(支持 Front Matter)", "View Site": "查看站点", - "hello" : { - "welcome" : "

👋 你好哇,

欢迎使用 xLog!

以下是一些有用的链接,帮助你开始使用 xLog:

", + "hello": { + "welcome": "

👋 你好哇,

欢迎使用 xLog!

以下是一些有用的链接,帮助你开始使用 xLog:

", "hidden": "👋 你好哇", "community": "

加入我们的社区,认识新朋友或共同建设 xLog:

" }, @@ -120,22 +120,21 @@ "Operator Address": "授权地址", "Operator Character Check": "授权角色检查", "Warning": "警告", - "Operators have permissions to enter your dashboard, change your settings(excluding xLog subdomain) and post, modify, delete contents on your site.": - "影子授权可以进入你的仪表盘,更改你的设置(不包括 xLog 子域名)并在你的站点上发布、修改、删除内容。", + "Operators have permissions to enter your dashboard, change your settings(excluding xLog subdomain) and post, modify, delete contents on your site.": "影子授权可以进入你的仪表盘,更改你的设置(不包括 xLog 子域名)并在你的站点上发布、修改、删除内容。", "Add": "添加", "xLog News": "xLog 新鲜事", "More": "更多", "Meet New Friends": "认识新朋友", - "Need help?" : "需要帮助?", + "Need help?": "需要帮助?", "Your post has been securely stored on the blockchain. Now you may want to": "你的文章已经安全地存储在区块链上。现在你可能想要", "View the post": "查看文章", "View the transaction": "查看交易", "Share to Twitter": "分享到 Twitter", - "Got it, thanks!" : "好的,谢谢!", - "Published!" : "已发布!", + "Got it, thanks!": "好的,谢谢!", + "Published!": "已发布!", "Title goes here...": "标题在这里...", "Start writing...": "开始写作...", - "Slug can only contain letters, numbers, hyphens, and underscores." : "短链接只能包含字母、数字、连字符和下划线。", + "Slug can only contain letters, numbers, hyphens, and underscores.": "短链接只能包含字母、数字、连字符和下划线。", "Date": "日期", "Prize": "奖金", "Winners": "获奖者", @@ -149,14 +148,13 @@ "No files chosen": "未选择文件", "No entries": "无条目", "Preview your Mirror.xyz entries": "预览你的 Mirror.xyz 条目", - "Please select .md files, multiple files are supported, and front matter is supported.": - "请选择 .md 文件,支持多个文件,支持 front matter。", + "Please select .md files, multiple files are supported, and front matter is supported.": "请选择 .md 文件,支持多个文件,支持 front matter。", "Achievements": "成就", "Tokens": "代币", "1 MIRA ≈ 1 USDC, swap easily on cross-chain bridge and Uniswap.": "1 MIRA ≈ 1 USDC,可以在跨链桥和 Uniswap 上轻松兑换。", "In the early stage, xLog will use $MIRA to motivate creators.": "在早期阶段,xLog 将使用 $MIRA 激励创作者。", "You can obtain $MIRA through the following ways:": "你可以通过以下方式获得 $MIRA:", - "Creator incentive program." : "创作者激励计划。", + "Creator incentive program.": "创作者激励计划。", "Participate in events.": "参加活动。", "Swap from USDC.": "从 USDC 兑换。", "Received tips and sponsorships from readers.": "从读者收到打赏和赞助。", @@ -184,5 +182,10 @@ "Today": "今天", "This month": "本月", "This week": "本周", - "All time": "全部" + "All time": "全部", + "Confirm Deletion?": "确认删除?", + "delete_confirmation_post": "你确定要删除这篇文章吗?", + "delete_confirmation_page": "你确定要删除这个页面吗?", + "Confirm": "确认", + "Cancel": "取消" } \ No newline at end of file diff --git a/src/components/dashboard/DeleteConfirmationModal.tsx b/src/components/dashboard/DeleteConfirmationModal.tsx new file mode 100644 index 00000000..db40b2d2 --- /dev/null +++ b/src/components/dashboard/DeleteConfirmationModal.tsx @@ -0,0 +1,34 @@ +import { useTranslation } from "react-i18next" +import { Modal } from "../ui/Modal" +import { Button } from "../ui/Button" + +export const DeleteConfirmationModal: React.FC<{ + open: boolean + setOpen: (open: boolean) => void + onConfirm: () => void + isPost?: boolean +}> = ({ open, setOpen, onConfirm, isPost }) => { + const { t } = useTranslation("dashboard") + + return ( + +
+

{t("delete_confirmation", { context: isPost ? "post" : "page" })}

+
+ + +
+
+
+ ) +} diff --git a/src/components/dashboard/OptionsButton.tsx b/src/components/dashboard/OptionsButton.tsx index 6dba8324..603c0298 100644 --- a/src/components/dashboard/OptionsButton.tsx +++ b/src/components/dashboard/OptionsButton.tsx @@ -3,6 +3,7 @@ import { Dispatch, Fragment, SetStateAction, useState } from "react" import { useTranslation } from "react-i18next" import { PageVisibilityEnum } from "~/lib/types" import { cn } from "~/lib/utils" +import { DeleteConfirmationModal } from "./DeleteConfirmationModal" export const OptionsButton: React.FC<{ visibility: PageVisibilityEnum | undefined @@ -12,6 +13,7 @@ export const OptionsButton: React.FC<{ propertiesWidget: React.ReactNode isRendering: boolean published: boolean + isPost: boolean }> = ({ visibility, previewPage, @@ -20,9 +22,13 @@ export const OptionsButton: React.FC<{ renderPage, published, propertiesWidget, + isPost, }) => { const { t } = useTranslation("dashboard") + const [deleteConfirmModalOpen, setDeleteConfirmModalOpen] = + useState(false) + return ( <>
)} - - {({ active }) => ( - - )} - + {published && ( + + {({ active }) => ( + + )} + + )}
+ { + savePage(false) + }} + isPost={isPost} + /> ) }} diff --git a/src/pages/dashboard/[subdomain]/editor.tsx b/src/pages/dashboard/[subdomain]/editor.tsx index fba6e1f5..906d2c9a 100644 --- a/src/pages/dashboard/[subdomain]/editor.tsx +++ b/src/pages/dashboard/[subdomain]/editor.tsx @@ -625,6 +625,7 @@ export default function SubdomainEditor() { renderPage={setIsRendering} propertiesWidget={extraProperties} previewPage={onPreviewButtonClick} + isPost={isPost} /> ) : (