diff --git a/public/locales/ja/dashboard.json b/public/locales/ja/dashboard.json index ffb833bb..e33daacd 100644 --- a/public/locales/ja/dashboard.json +++ b/public/locales/ja/dashboard.json @@ -60,6 +60,7 @@ "Preview": "プレビュー", "Publish": "公開", "Update": "更新", + "Discard Changes": "変更を破棄", "Publish at": "公開日時", "This post will be accessible from this time": "この記事は、この時間からアクセス可能になります", "This page will be accessible from this time": "このページは、この時間からアクセス可能になります", diff --git a/public/locales/zh-TW/dashboard.json b/public/locales/zh-TW/dashboard.json index 8d169035..514b3dc3 100644 --- a/public/locales/zh-TW/dashboard.json +++ b/public/locales/zh-TW/dashboard.json @@ -65,6 +65,7 @@ "Preview": "預覽", "Publish": "發布", "Update": "更新", + "Discard Changes": "捨棄變更", "Publish at": "發布時間", "This post will be accessible from this time": "此文章將從此時間開始可瀏覽", "This page will be accessible from this time": "此頁面將從此時間開始可瀏覽", diff --git a/public/locales/zh/dashboard.json b/public/locales/zh/dashboard.json index 017a6a5e..be107594 100644 --- a/public/locales/zh/dashboard.json +++ b/public/locales/zh/dashboard.json @@ -66,6 +66,7 @@ "Preview": "预览", "Publish": "发布", "Update": "更新", + "Discard Changes": "放弃变更", "Publish at": "发布时间", "This post will be accessible from this time": "此文章将从此时间开始可访问", "This page will be accessible from this time": "此页面将从此时间开始可访问", diff --git a/src/components/dashboard/OptionsButton.tsx b/src/components/dashboard/OptionsButton.tsx index 2e739270..42ed9928 100644 --- a/src/components/dashboard/OptionsButton.tsx +++ b/src/components/dashboard/OptionsButton.tsx @@ -17,6 +17,8 @@ export const OptionsButton: React.FC<{ isRendering: boolean published: boolean isPost: boolean + isModified: boolean + discardChanges: () => void }> = ({ visibility, previewPage, @@ -26,6 +28,8 @@ export const OptionsButton: React.FC<{ published, propertiesWidget, isPost, + isModified, + discardChanges, }) => { const { t } = useTranslation("dashboard") @@ -111,6 +115,20 @@ export const OptionsButton: React.FC<{ )} + {isModified && ( + + {({ active }) => ( + + )} + + )} {published && ( {({ active }) => ( diff --git a/src/components/dashboard/PublishButton.tsx b/src/components/dashboard/PublishButton.tsx index 126243e0..34f46c14 100644 --- a/src/components/dashboard/PublishButton.tsx +++ b/src/components/dashboard/PublishButton.tsx @@ -12,7 +12,18 @@ export const PublishButton: React.FC<{ isDisabled: boolean twitterShareUrl?: string isPost: boolean -}> = ({ save, published, isSaving, isDisabled, twitterShareUrl, isPost }) => { + isModified: boolean + discardChanges: () => void +}> = ({ + save, + discardChanges, + published, + isSaving, + isDisabled, + isModified, + twitterShareUrl, + isPost, +}) => { const [showDropdown, setShowDropdown] = useState(false) const dropdownRef = useRef(null) const triggerRef = useRef(null) @@ -70,6 +81,15 @@ export const PublishButton: React.FC<{ {t("Share to Twitter")} + {isModified && ( + + )}