Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
多语言
daoyiand9ef82e0a024
diff --git a/@types/resources.d.ts b/@types/resources.d.tsindex defd8d33..1f2eee5b 100644--- a/@types/resources.d.ts+++ b/@types/resources.d.ts@@ -581,6 +581,52 @@ interface Resources {"fastExperience": "极速体验","morePrivileges": "更多特权"}+ },+ "publish": {+ "title": "发布作品",+ "confirmClose": {+ "title": "放弃更改?",+ "content": "您所做的任何更改都将永久丢失"+ },+ "buttons": {+ "customizePerAccount": "针对每个账户进行定制",+ "cancelPublish": "取消发布",+ "schedulePublish": "计划发布",+ "publishNow": "立即发布",+ "copyLink": "复制链接",+ "delete": "删除"+ },+ "tips": {+ "workSaved": "你的工作被保存了,选择一个账号来创建一个帖子。"+ },+ "status": {+ "publishFailed": "发布失败",+ "publishing": "发布中",+ "publishSuccess": "发布成功",+ "waitingPublish": "等待发布"+ },+ "form": {+ "title": "标题",+ "titlePlaceholder": "请输入标题",+ "partition": "分区",+ "partitionPlaceholder": "请选择分区",+ "type": "类型",+ "original": "原创",+ "reprint": "转载",+ "source": "转载来源",+ "sourcePlaceholder": "转载视频请注明来源、时间、地点(例:转自https://www.xxxx.com/yyyy)",+ "page": "页面",+ "pagePlaceholder": "请选择页面",+ "privacyStatus": "隐私状态",+ "public": "公开",+ "unlisted": "不公开",+ "private": "私人",+ "region": "国区",+ "regionPlaceholder": "请选择国区",+ "category": "视频分类",+ "categoryPlaceholder": "请选择视频分类",+ "categoryPlaceholderDisabled": "请先选择国区"+ }}}diff --git a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsxindex 22f26cff..eb07d012 100644--- a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx+++ b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx@@ -31,7 +31,8 @@ import type { MenuProps } from "antd";import { TooltipRef } from "antd/lib/tooltip";import { deletePublishRecordApi, nowPubTaskApi } from "@/api/plat/publish";import { getDays } from "@/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils";-import { getOssUrl } from "@/utils/oss";+import { getOssUrl } from "@/utils/oss";+import { useTransClient } from "@/app/i18n/client";@@ -42,26 +43,28 @@ export interface IRecordCoreProps {}const PubStatus = ({ status }: { status: PublishStatus }) => {+ const { t } = useTransClient("publish");+return (<div className={styles.pubStatus}>{status === PublishStatus.FAIL ? (<Tag color="error">- 发布失败+ {t("status.publishFailed")}<CloseCircleOutlined /></Tag>) : status === PublishStatus.PUB_LOADING ? (<Tag color="cyan">- 发布中+ {t("status.publishing")}<LoadingOutlined /></Tag>) : status === PublishStatus.RELEASED ? (<Tag color="success">- 发布成功+ {t("status.publishSuccess")}<CheckCircleOutlined /></Tag>) : status === PublishStatus.UNPUBLISH ? (<Tag color="processing">- 等待发布+ {t("status.waitingPublish")}<ClockCircleOutlined /></Tag>) : (@@ -92,10 +95,12 @@ const RecordCore = memo();const [popoverOpen, setPopoverOpen] = useState(false);const popoverRef = useRef<TooltipRef>(null);+ const { t } = useTransClient("publish");+const dropdownItems: MenuProps["items"] = [{key: "2",- label: "复制链接",+ label: t("buttons.copyLink"),onClick: async () => {await navigator.clipboard.writeText(publishRecord.workLink);},@@ -103,7 +108,7 @@ const RecordCore = memo({key: "3",danger: true,- label: "删除",+ label: t("buttons.delete"),onClick: async () => {setPopoverOpen(false);setListLoading(true);@@ -188,7 +193,7 @@ const RecordCore = memo(getPubRecord();}}>- 立即发布+ {t("buttons.publishNow")}</Button><Dropdown menu={{ items: dropdownItems }} placement="top"><Button icon={<MoreOutlined />} />diff --git a/src/app/i18n/locales/en/publish.json b/src/app/i18n/locales/en/publish.jsonindex 655b27d2..37488481 100644--- a/src/app/i18n/locales/en/publish.json+++ b/src/app/i18n/locales/en/publish.json@@ -20,5 +20,27 @@"publishing": "Publishing","publishSuccess": "Success","waitingPublish": "Waiting"+ },+ "form": {+ "title": "Title",+ "titlePlaceholder": "Enter title",+ "partition": "Partition",+ "partitionPlaceholder": "Select partition",+ "type": "Type",+ "original": "Original",+ "reprint": "Reprint",+ "source": "Source",+ "sourcePlaceholder": "Please specify source, time, location (e.g. from https://www.xxxx.com/yyyy)",+ "page": "Page",+ "pagePlaceholder": "Select page",+ "privacyStatus": "Privacy",+ "public": "Public",+ "unlisted": "Unlisted",+ "private": "Private",+ "region": "Region",+ "regionPlaceholder": "Select region",+ "category": "Category",+ "categoryPlaceholder": "Select category",+ "categoryPlaceholderDisabled": "Select region first"}}\ No newline at end of filediff --git a/src/app/i18n/locales/zh-CN/publish.json b/src/app/i18n/locales/zh-CN/publish.jsonindex a1c90b36..3d708d2c 100644--- a/src/app/i18n/locales/zh-CN/publish.json+++ b/src/app/i18n/locales/zh-CN/publish.json@@ -20,5 +20,27 @@"publishing": "发布中","publishSuccess": "发布成功","waitingPublish": "等待发布"+ },+ "form": {+ "title": "标题",+ "titlePlaceholder": "请输入标题",+ "partition": "分区",+ "partitionPlaceholder": "请选择分区",+ "type": "类型",+ "original": "原创",+ "reprint": "转载",+ "source": "转载来源",+ "sourcePlaceholder": "转载视频请注明来源、时间、地点(例:转自https://www.xxxx.com/yyyy)",+ "page": "页面",+ "pagePlaceholder": "请选择页面",+ "privacyStatus": "隐私状态",+ "public": "公开",+ "unlisted": "不公开",+ "private": "私人",+ "region": "国区",+ "regionPlaceholder": "请选择国区",+ "category": "视频分类",+ "categoryPlaceholder": "请选择视频分类",+ "categoryPlaceholderDisabled": "请先选择国区"}}\ No newline at end of filediff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsxindex c46acb91..977b8478 100644--- a/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput.tsx@@ -5,6 +5,7 @@ import { AccountPlatInfoMap } from "@/app/config/platConfig";import { PubItem } from "@/components/PublishDialog/publishDialog.type";import { usePublishDialog } from "@/components/PublishDialog/usePublishDialog";import { useShallow } from "zustand/react/shallow";+import { useTransClient } from "@/app/i18n/client";export interface ICommonTitleInputRef {}@@ -18,6 +19,7 @@ const CommonTitleInput = memo({ pubItem }: ICommonTitleInputProps,ref: ForwardedRef<ICommonTitleInputRef>,) => {+ const { t } = useTransClient("publish");const platConfig = useMemo(() => {return AccountPlatInfoMap.get(pubItem.account.type)!;}, [pubItem]);@@ -31,11 +33,11 @@ const CommonTitleInput = memo(return (<div className={styles.commonTitleInput}>- <div className="platParamsSetting-label">标题</div>+ <div className="platParamsSetting-label">{t("form.title")}</div><Inputvalue={pubItem.params.title}maxLength={platConfig.commonPubParamsConfig.titleMax || 20}- placeholder="请输入标题"+ placeholder={t("form.titlePlaceholder")}showCountonChange={(e) => {setOnePubParams(diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsxindex ff9faa7a..1b3c2444 100644--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/BilibParams.tsx@@ -10,10 +10,12 @@ import { usePublishDialogData } from "@/components/PublishDialog/usePublishDialoimport { useShallow } from "zustand/react/shallow";import styles from "../platParamsSetting.module.scss";import { Input, Radio, Select } from "antd";+import { useTransClient } from "@/app/i18n/client";const BilibParams = memo(forwardRef(({ pubItem }: IPlatsParamsProps, ref: ForwardedRef<IPlatsParamsRef>) => {+ const { t } = useTransClient("publish");const { pubParmasTextareaCommonParams, setOnePubParams } =usePlatParamsCommon(pubItem);const { getBilibiliPartitions, bilibiliPartitions } =@@ -39,7 +41,7 @@ const BilibParams = memo(className={styles.commonTitleInput}style={{ marginTop: "10px" }}>- <div className="platParamsSetting-label">分区</div>+ <div className="platParamsSetting-label">{t("form.partition")}</div><Selectstyle={{ width: "100%" }}options={bilibiliPartitions}@@ -55,7 +57,7 @@ const BilibParams = memo();}}showSearch={true}- placeholder="请选择分区"+ placeholder={t("form.partitionPlaceholder")}fieldNames={{label: "name",value: "id",@@ -67,12 +69,12 @@ const BilibParams = memo(className={styles.commonTitleInput}style={{ marginTop: "10px" }}>- <div className="platParamsSetting-label">类型</div>+ <div className="platParamsSetting-label">{t("form.type")}</div><Radio.Groupvalue={pubItem.params.option.bilibili?.copyright}options={[- { value: 1, label: "原创" },- { value: 2, label: "转载" },+ { value: 1, label: t("form.original") },+ { value: 2, label: t("form.reprint") },]}onChange={(e) => {const option = pubItem.params.option;@@ -96,8 +98,8 @@ const BilibParams = memo(className={styles.commonTitleInput}style={{ marginTop: "10px" }}>- <div className="platParamsSetting-label">转载来源</div>- <Input placeholder="转载视频请注明来源、时间、地点(例:转自https://www.xxxx.com/yyyy)" />+ <div className="platParamsSetting-label">{t("form.source")}</div>+ <Input placeholder={t("form.sourcePlaceholder")} /></div>)}</>diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/FacebookParams.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/FacebookParams.tsxindex 4d591125..70fab763 100644--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/FacebookParams.tsx+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/FacebookParams.tsx@@ -10,10 +10,12 @@ import { usePublishDialogData } from "@/components/PublishDialog/usePublishDialoimport { useShallow } from "zustand/react/shallow";import styles from "../platParamsSetting.module.scss";import { Select } from "antd";+import { useTransClient } from "@/app/i18n/client";const FacebookParams = memo(forwardRef(({ pubItem }: IPlatsParamsProps, ref: ForwardedRef<IPlatsParamsRef>) => {+ const { t } = useTransClient("publish");const { pubParmasTextareaCommonParams, setOnePubParams } =usePlatParamsCommon(pubItem);const { getFacebookPages, facebookPages } =@@ -39,7 +41,7 @@ const FacebookParams = memo(className={styles.commonTitleInput}style={{ marginTop: "10px" }}>- <div className="platParamsSetting-label">页面</div>+ <div className="platParamsSetting-label">{t("form.page")}</div><Selectstyle={{ width: "100%" }}options={facebookPages}@@ -58,7 +60,7 @@ const FacebookParams = memo();}}showSearch={true}- placeholder="请选择页面"+ placeholder={t("form.pagePlaceholder")}fieldNames={{label: "name",value: "id",diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/YouTubeParams.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/YouTubeParams.tsxindex 5ec8273c..c56c3f70 100644--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/YouTubeParams.tsx+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/YouTubeParams.tsx@@ -11,10 +11,12 @@ import { useShallow } from "zustand/react/shallow";import styles from "../platParamsSetting.module.scss";import { Radio, Select } from "antd";import { YouTubeCategoryItem } from "@/components/PublishDialog/publishDialog.type";+import { useTransClient } from "@/app/i18n/client";const YouTubeParams = memo(forwardRef(({ pubItem }: IPlatsParamsProps, ref: ForwardedRef<IPlatsParamsRef>) => {+ const { t } = useTransClient("publish");const { pubParmasTextareaCommonParams, setOnePubParams } =usePlatParamsCommon(pubItem);const {@@ -54,13 +56,13 @@ const YouTubeParams = memo(className={styles.commonTitleInput}style={{ marginTop: "10px" }}>- <div className="platParamsSetting-label">隐私状态</div>+ <div className="platParamsSetting-label">{t("form.privacyStatus")}</div><Radio.Groupvalue={pubItem.params.option.youtube?.privacyStatus}options={[- { value: "public", label: "公开" },- { value: "unlisted", label: "不公开" },- { value: "private", label: "私人" },+ { value: "public", label: t("form.public") },+ { value: "unlisted", label: t("form.unlisted") },+ { value: "private", label: t("form.private") },]}onChange={(e) => {const option = pubItem.params.option;@@ -82,7 +84,7 @@ const YouTubeParams = memo(className={styles.commonTitleInput}style={{ marginTop: "10px" }}>- <div className="platParamsSetting-label">国区</div>+ <div className="platParamsSetting-label">{t("form.region")}</div><Selectstyle={{ width: "100%" }}options={youTubeRegions.map((item) => ({@@ -106,7 +108,7 @@ const YouTubeParams = memo();}}showSearch={true}- placeholder="请选择国区"+ placeholder={t("form.regionPlaceholder")}/></div>@@ -114,7 +116,7 @@ const YouTubeParams = memo(className={styles.commonTitleInput}style={{ marginTop: "10px" }}>- <div className="platParamsSetting-label">视频分类</div>+ <div className="platParamsSetting-label">{t("form.category")}</div><Selectstyle={{ width: "100%" }}options={youTubeCategories}@@ -133,7 +135,7 @@ const YouTubeParams = memo();}}showSearch={true}- placeholder={pubItem.params.option.youtube?.regionCode ? "请选择视频分类" : "请先选择国区"}+ placeholder={pubItem.params.option.youtube?.regionCode ? t("form.categoryPlaceholder") : t("form.categoryPlaceholderDisabled")}disabled={!pubItem.params.option.youtube?.regionCode}fieldNames={{label: "etag",diff --git a/src/components/PublishDialog/hooks/usePubParamsVerify.tsx b/src/components/PublishDialog/hooks/usePubParamsVerify.tsxindex f578817b..c0cb96eb 100644--- a/src/components/PublishDialog/hooks/usePubParamsVerify.tsx+++ b/src/components/PublishDialog/hooks/usePubParamsVerify.tsx@@ -38,7 +38,7 @@ export default function usePubParamsVerify(data: PubItem[]) {(() => {// ------------------------ 通用参数校验 ------------------------- // 图片或者视频校验,视频和图片必须要上传一个+ // 图片或者视频校验,视频和图片必须要上传一个if (v.params.images?.length === 0 && !v.params.video) {return setErrorMsg("请上传图片或视频");}diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsxindex 0656023e..017a1f40 100644--- a/src/components/PublishDialog/index.tsx+++ b/src/components/PublishDialog/index.tsx@@ -210,9 +210,9 @@ const PublishDialog = memo(}}><div className="publishDialog-con">- <div className="publishDialog-con-head">- <span className="publishDialog-con-head-title">发布作品</span>- </div>+ <div className="publishDialog-con-head">+ <span className="publishDialog-con-head-title">{t("title")}</span>+ </div><div className="publishDialog-con-acconts">{pubList.map((pubItem) => {const platConfig = AccountPlatInfoMap.get(@@ -325,11 +325,11 @@ const PublishDialog = memo(</>)}- {pubListChoosed.length === 0 && (- <div className="publishDialog-con-tips">- 你的工作被保存了,选择一个账号来创建一个帖子。- </div>- )}+ {pubListChoosed.length === 0 && (+ <div className="publishDialog-con-tips">+ {t("tips.workSaved")}+ </div>+ )}</div></div><div@@ -340,43 +340,43 @@ const PublishDialog = memo(<div className="publishDialog-footer-btns">{step === 0 && pubListChoosed.length >= 2 ? (- <Button- size="large"- onClick={() => {- setExpandedPubItem(undefined);- setStep(1);- }}- >- 针对每个账户进行定制- <ArrowRightOutlined />- </Button>+ <Button+ size="large"+ onClick={() => {+ setExpandedPubItem(undefined);+ setStep(1);+ }}+ >+ {t("buttons.customizePerAccount")}+ <ArrowRightOutlined />+ </Button>) : (<>- <Button size="large" onClick={closeDialog}>- 取消发布- </Button>- <Button- size="large"- type="primary"- loading={createLoading}- onClick={() => {- for (const [key, errVideoItem] of errParamsMap) {- if (errVideoItem) {- const pubItem = pubListChoosed.find(- (v) => v.account.id === key,- )!;- if (step === 1) {- setExpandedPubItem(pubItem);- }- message.warning(errVideoItem.parErrMsg);- return;- }- }- pubClick();- }}- >- 计划发布- </Button>+ <Button size="large" onClick={closeDialog}>+ {t("buttons.cancelPublish")}+ </Button>+ <Button+ size="large"+ type="primary"+ loading={createLoading}+ onClick={() => {+ for (const [key, errVideoItem] of errParamsMap) {+ if (errVideoItem) {+ const pubItem = pubListChoosed.find(+ (v) => v.account.id === key,+ )!;+ if (step === 1) {+ setExpandedPubItem(pubItem);+ }+ message.warning(errVideoItem.parErrMsg);+ return;+ }+ }+ pubClick();+ }}+ >+ {t("buttons.schedulePublish")}+ </Button></>)}</div>