diff --git a/public/locales/en-US/dashboard.json b/public/locales/en-US/dashboard.json index 13de90e..9cabbe1 100644 --- a/public/locales/en-US/dashboard.json +++ b/public/locales/en-US/dashboard.json @@ -1587,7 +1587,9 @@ "sso": "SSO single sign-on", "more": "......", "later": "Maybe later", - "learnMore": "Learn more" + "learnMore": "Learn more", + "promotionTitle": "Community edition upgrade special discount", + "promotion": "Use the promotion code <0>{{code}} when purchasing to apply a <1>-{{discount}}% discount." }, "abuseReport": { "deleteXAbuseReports": "Delete {{num}} abuse reports", diff --git a/public/locales/ja-JP/dashboard.json b/public/locales/ja-JP/dashboard.json index bcdaa1e..02afa95 100644 --- a/public/locales/ja-JP/dashboard.json +++ b/public/locales/ja-JP/dashboard.json @@ -1574,7 +1574,9 @@ "sso": "SSOシングルサインオン", "more": "......", "later": "後で", - "learnMore": "Pro版の詳細を見る" + "learnMore": "Pro版の詳細を見る", + "promotionTitle": "コミュニティ版アップグレード特別割引", + "promotion": "購入時に<0>{{code}}を使用すると、<1>-{{discount}}%の割引が適用されます。" }, "abuseReport": { "deleteXAbuseReports": "{{num}} 個の舉報を削除", diff --git a/public/locales/zh-CN/dashboard.json b/public/locales/zh-CN/dashboard.json index 40b64c8..577775e 100644 --- a/public/locales/zh-CN/dashboard.json +++ b/public/locales/zh-CN/dashboard.json @@ -1573,7 +1573,9 @@ "sso": "SSO 单点登录", "more": "......", "later": "稍后再说", - "learnMore": "了解 Pro 版本详情" + "learnMore": "了解 Pro 版本详情", + "promotionTitle": "社区版升级特别优惠", + "promotion": "购买时使用优惠码 <0>{{code}},获得 <1>-{{discount}}% 折扣。" }, "abuseReport": { "deleteXAbuseReports": "删除 {{num}} 个举报", diff --git a/public/locales/zh-TW/dashboard.json b/public/locales/zh-TW/dashboard.json index 187db45..05c6b89 100644 --- a/public/locales/zh-TW/dashboard.json +++ b/public/locales/zh-TW/dashboard.json @@ -1570,7 +1570,9 @@ "sso": "SSO 單點登入", "more": "......", "later": "稍後再說", - "learnMore": "了解 Pro 版本詳情" + "learnMore": "了解 Pro 版本詳情", + "promotionTitle": "社區版升級特別優惠", + "promotion": "購買時使用優惠碼 <0>{{code}},獲得 <1>-{{discount}}% 折扣。" }, "abuseReport": { "deleteXAbuseReports": "刪除 {{num}} 個舉報", diff --git a/src/component/Admin/Common/ProDialog.tsx b/src/component/Admin/Common/ProDialog.tsx index e3f5627..aaebe0b 100644 --- a/src/component/Admin/Common/ProDialog.tsx +++ b/src/component/Admin/Common/ProDialog.tsx @@ -1,8 +1,22 @@ -import { Button, DialogContent, List, ListItem, ListItemIcon, ListItemText, Typography, styled } from "@mui/material"; -import { useCallback } from "react"; -import { useTranslation } from "react-i18next"; +import { + Alert, + AlertTitle, + Button, + DialogContent, + List, + ListItem, + ListItemIcon, + ListItemText, + Typography, + styled, +} from "@mui/material"; +import dayjs from "dayjs"; +import { useCallback, useMemo } from "react"; +import { Trans, useTranslation } from "react-i18next"; import DraggableDialog, { StyledDialogActions } from "../../Dialogs/DraggableDialog"; import CheckmarkCircleFilled from "../../Icons/CheckmarkCircleFilled"; +import Gift from "../../Icons/Gift"; +import { Code } from "./Code"; export interface ProDialogProps { open: boolean; @@ -28,12 +42,24 @@ const StyledButton = styled(Button)(({ theme }) => ({ transition: "all 300ms cubic-bezier(0.4, 0, 0.2, 1) !important", })); +// TODO: fetch from cloudreve.org +const currentPromotion = { + code: "FI5Q9668YV", + discount: 15, + start: "2025-08-12T00:00:00Z", + end: "2025-10-12T23:59:59Z", +}; + const ProDialog = ({ open, onClose }: ProDialogProps) => { const { t } = useTranslation("dashboard"); const openMore = useCallback((e: React.MouseEvent) => { e.stopPropagation(); window.open("https://cloudreve.org/pro", "_blank"); }, []); + const showPromotion = useMemo(() => { + const now = dayjs(); + return now >= dayjs(currentPromotion.start) && now <= dayjs(currentPromotion.end); + }, []); return ( { ))} + {showPromotion && ( + , + }} + severity="info" + sx={{ mt: 2 }} + > + {t("pro.promotionTitle")} + , ]} + /> + + )}