Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 将写作助手和选择草稿放到描述下方
gaoSirff9445de9e2d
diff --git a/src/components/AvatarPlat/index.tsx b/src/components/AvatarPlat/index.tsxindex 8e8e1666..04f4dd03 100644--- a/src/components/AvatarPlat/index.tsx+++ b/src/components/AvatarPlat/index.tsx@@ -4,7 +4,7 @@ import { AvatarSize } from "antd/es/avatar/AvatarContext";import { SocialAccount } from "@/api/types/account.type";import { Avatar } from "antd";import { AccountPlatInfoMap } from "@/app/config/platConfig";-import { OSS_DOMAIN } from "@/utils/oss";+import { OSS_URL } from "@/constant";export interface IAvatarPlatRef {}@@ -21,7 +21,7 @@ const getAvatar = (url: string) => {if (url?.includes("https://")) {return url;} else {- return `${OSS_DOMAIN}/` + url;+ return `${OSS_URL}/` + url;}};diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsxindex 89d5c0d1..5d84aba9 100644--- a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx@@ -13,7 +13,11 @@ import { Button, Image, Input, message, Tooltip, Upload } from "antd";import styles from "@/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss";import { ReactSortable } from "react-sortablejs";import { CSSTransition, TransitionGroup } from "react-transition-group";-import { CaretRightOutlined, CloseOutlined } from "@ant-design/icons";+import {+ CaretRightOutlined,+ CloseOutlined,+ FileTextOutlined,+} from "@ant-design/icons";import { TextAreaRef } from "antd/es/input/TextArea";import {IImgFile,@@ -28,6 +32,9 @@ import { useTransClient } from "@/app/i18n/client";import PubParmasTextuploadImage from "@/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextuploadImage";import VideoPreviewModal from "@/components/VideoPreviewModal";import dynamic from "next/dynamic";+import Aibrush from "@/components/PublishDialog/svgs/aibrush.svg";+import { usePublishDialog } from "@/components/PublishDialog/usePublishDialog";+import { useShallow } from "zustand/react/shallow";const { TextArea } = Input;const { Dragger } = Upload;@@ -82,6 +89,11 @@ const PubParmasTextarea = memo(}: IPubParmasTextareaProps,ref: ForwardedRef<IPubParmasTextareaRef>,) => {+ const { setOpenLeft } = usePublishDialog(+ useShallow((state) => ({+ setOpenLeft: state.setOpenLeft,+ })),+ );const [value, setValue] = useState(desValue);const [previewData, setPreviewData] = useState<IImgFile | IVideoFile | undefined@@ -460,14 +472,48 @@ const PubParmasTextarea = memo({t("actions.cropCover")}</Button>)}-- <div className="pubParmasTextarea-maxLength">- {desMax - value.length}- </div></div>{centerExtend}- {extend && <div className="pubParmasTextarea-other">{extend}</div>}+ <div className="pubParmasTextarea-footer">+ <div className="pubParmasTextarea-footer-options">+ <div className="pubParmasTextarea-footer-options-left">+ <div className="pubParmasTextarea-footer-options-left-item">+ <Button+ icon={<FileTextOutlined />}+ type="text"+ onClick={(e) => {+ e.stopPropagation();+ setOpenLeft(true);+ }}+ >+ {t("actions.selectDraft")}+ </Button>+ </div>+ <div className="pubParmasTextarea-footer-options-left-item">+ <Button+ className="pubParmasTextarea-footer-options-aibrush"+ icon={<Aibrush />}+ type="text"+ onClick={(e) => {+ e.stopPropagation();+ setOpenLeft(true);+ }}+ >+ {t("writingAssistant")}+ </Button>+ </div>+ </div>+ <div className="pubParmasTextarea-footer-options-right">+ <div className="pubParmasTextarea-maxLength">+ {desMax - value.length}+ </div>+ </div>+ </div>+ {extend && (+ <div className="pubParmasTextarea-footer-extend">{extend}</div>+ )}+ </div></div></>);diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss b/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scssindex 69f0e7e9..2c3a5f39 100644--- a/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss@@ -15,14 +15,6 @@ $boxHegiht: 110px;box-shadow: none !important;padding: 0;}- .pubParmasTextarea-maxLength {- position: absolute;- bottom: 20px;- right: 20px;- border: 1px solid #505050;- border-radius: 6px;- padding: 0 6px;- }}.ant-upload-wrapper {@@ -143,9 +135,48 @@ $boxHegiht: 110px;}}- .pubParmasTextarea-other {+ .pubParmasTextarea-footer {border-top: 1px solid var(--grayColor4);- padding: 10px 15px;+ &-options {+ padding: 10px 15px;+ position: relative;++ &-left {+ display: flex;+ align-items: center;+ &-item {+ border-left: 1px solid var(--grayColor4);+ padding: 0 5px;+ &:first-child {+ border-left: none;+ }+ }+ }+ &-aibrush {+ background: linear-gradient(90deg, #fff, #fff) !important;+ transition: 0.3s;+ &:hover {+ background: linear-gradient(90deg, #ba6bff1a, #0715ff1a) !important;+ }+ &:active {+ background: linear-gradient(90deg, #ba6bff33, #0715ff33) !important;+ }+ }+ .pubParmasTextarea-maxLength {+ position: absolute;+ border: 1px solid #505050;+ border-radius: 6px;+ padding: 0 6px;+ top: 50%;+ transform: translateY(-50%);+ right: 15px;+ }++ }+ &-extend {+ border-top: 1px solid var(--grayColor4);+ padding: 0 15px 10px 15px;+ }}}}diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsxindex 8a76d299..e74637af 100644--- a/src/components/PublishDialog/index.tsx+++ b/src/components/PublishDialog/index.tsx@@ -16,7 +16,6 @@ import {ExclamationCircleFilled,FileTextOutlined,FolderOpenOutlined,- PictureOutlined,InfoCircleOutlined,} from "@ant-design/icons";import PublishDialogAi from "@/components/PublishDialog/compoents/PublishDialogAi";@@ -60,7 +59,6 @@ import { pinterestSkip } from "@/app/[lng]/accounts/plat/PinterestLogin";import { linkedinSkip } from "@/app/[lng]/accounts/plat/LinkedinLogin";import { useAccountStore } from "@/store/account";import PublishDialogPreview from "@/components/PublishDialog/compoents/PublishDialogPreview";-import Aibrush from "./svgs/aibrush.svg";import { useWindowSize } from "react-use";export interface IPublishDialogRef {@@ -94,7 +92,6 @@ const PublishDialog = memo(ref: ForwardedRef<IPublishDialogRef>,) => {const { width } = useWindowSize();- const [openLeft, setOpenLeft] = useState(false);const {pubListChoosed,setPubListChoosed,@@ -112,6 +109,8 @@ const PublishDialog = memo(pubTime,setOnePubParams,setWarningParamsMap,+ setOpenLeft,+ openLeft,} = usePublishDialog(useShallow((state) => ({pubListChoosed: state.pubListChoosed,@@ -130,6 +129,8 @@ const PublishDialog = memo(setPubTime: state.setPubTime,pubTime: state.pubTime,setOnePubParams: state.setOnePubParams,+ openLeft: state.openLeft,+ setOpenLeft: state.setOpenLeft,})),);const { errParamsMap, warningParamsMap } =@@ -646,16 +647,6 @@ const PublishDialog = memo(>{t("actions.selectDraft")}</Button>- <Button- size="small"- icon={<Aibrush />}- onClick={(e) => {- e.stopPropagation();- setOpenLeft(true);- }}- >- {t("writingAssistant")}- </Button></div></div><div className="publishDialog-con-acconts">diff --git a/src/components/PublishDialog/usePublishDialog.ts b/src/components/PublishDialog/usePublishDialog.tsindex e91ed5a6..c1e5635b 100644--- a/src/components/PublishDialog/usePublishDialog.ts+++ b/src/components/PublishDialog/usePublishDialog.ts@@ -26,6 +26,7 @@ export interface IPublishDialogStore {warningParamsMap?: ErrPubParamsMapType;// 发布时间pubTime?: string;+ openLeft: boolean;}const store: IPublishDialogStore = {@@ -55,6 +56,7 @@ const store: IPublishDialogStore = {expandedPubItem: undefined,errParamsMap: undefined,warningParamsMap: undefined,+ openLeft: false,};const getStore = () => {@@ -68,6 +70,11 @@ export const usePublishDialog = create(},(set, get, storeApi) => {const methods = {+ setOpenLeft(openLeft: boolean) {+ set({+ openLeft,+ });+ },setPubListChoosed(pubListChoosed: PubItem[]) {set({pubListChoosed,