Skip to content

Let's use AI to Earn!

feat: 发布大改

gaoSir54207e5501cb
diff --git a/.gitignore b/.gitignore
index f6966153..81f8e8fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,4 +35,6 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
-certificates
\ No newline at end of file
+certificates
+
+.idea
diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml
index 2f7ddf7a..71f9e938 100644
--- a/.idea/material_theme_project_new.xml
+++ b/.idea/material_theme_project_new.xml
@@ -3,7 +3,9 @@
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
- <option name="userId" value="5a44ed5:1979c884888:-7ffa" />
+ <option name="migrated" value="true" />
+ <option name="pristineConfig" value="false" />
+ <option name="userId" value="3bd64bd8:1912071e97e:-7ffe" />
</MTProjectMetadataState>
</option>
</component>
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a9d8980f..3a3c3bfc 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,12 +5,17 @@
</component>
<component name="ChangeListManager">
<list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="fix: 日历调整">
+ <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" afterDir="false" />
+ <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/usePublishDialog.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/.idea/material_theme_project_new.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/material_theme_project_new.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/@types/resources.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/@types/resources.d.ts" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/demo/demoMaterial.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/demo/demoMaterial.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/youtube/page.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/youtube/page.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/i18n/locales/en/youtube.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/i18n/locales/en/youtube.json" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/i18n/locales/zh-CN/youtube.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/i18n/locales/zh-CN/youtube.json" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/index.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/layout.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/layout.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/layout/LyaoutFooter.tsx" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -45,6 +50,8 @@
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
+ "ASKED_ADD_EXTERNAL_FILES": "true",
+ "ASKED_MARK_IGNORED_FILES_AS_EXCLUDED": "true",
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
@@ -56,7 +63,7 @@
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"run.code.analysis.last.selected.profile": "pProject Default",
- "settings.editor.selected.configurable": "project.propVCSSupport.CommitDialog",
+ "settings.editor.selected.configurable": "editor.reader.mode",
"ts.external.directory.path": "E:\\project-dev\\web\\艺咖\\aitoearn-web\\node_modules\\typescript\\lib",
"vue.rearranger.settings.migration": "true"
}
@@ -131,8 +138,9 @@
<component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" />
+ <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="feat: 日历完善" />
<MESSAGE value="fix: 日历调整" />
- <option name="LAST_COMMIT_MESSAGE" value="fix: 日历调整" />
+ <option name="LAST_COMMIT_MESSAGE" value="" />
</component>
</project>
\ No newline at end of file
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx
index b8e87bd3..94eab534 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx
+++ b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx
@@ -9,12 +9,13 @@ export interface ICalendarTimingItemRef {}
export interface ICalendarTimingItemProps {
arg: DayCellContentArg;
+ onClickPub: () => void;
}
const CalendarTimingItem = memo(
forwardRef(
(
- { arg }: ICalendarTimingItemProps,
+ { arg, onClickPub }: ICalendarTimingItemProps,
ref: ForwardedRef<ICalendarTimingItemRef>,
) => {
const { t } = useTransClient("account");
@@ -45,19 +46,37 @@ const CalendarTimingItem = memo(
</div>
{argDate >= nowDate && (
- <Button size="small" icon={<PlusOutlined />} />
+ <Button
+ size="small"
+ icon={<PlusOutlined />}
+ onClick={() => {
+ onClickPub();
+ }}
+ />
)}
</div>
{argDate >= nowDate && (
<div className="calendarTimingItem-con">
- <Button size="small" type="dashed">
+ <Button
+ size="small"
+ type="dashed"
+ onClick={() => {
+ onClickPub();
+ }}
+ >
<div className="calendarTimingItem-con-btn1">04:12 PM</div>
<div className="calendarTimingItem-con-btn2">
{t("addPost")}
</div>
</Button>
- <Button size="small" type="dashed">
+ <Button
+ size="small"
+ type="dashed"
+ onClick={() => {
+ onClickPub();
+ }}
+ >
<div className="calendarTimingItem-con-btn1">05:34 PM</div>
<div className="calendarTimingItem-con-btn2">
{t("addPost")}
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss
index 9476953d..9b4b15f8 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss
+++ b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss
@@ -32,7 +32,7 @@
margin-bottom: 8px;
font-size: var(--fs-xs);
padding: 0;
- height: 26px !important;
+ height: 30px !important;
&:hover {
.calendarTimingItem-con-btn2 {
display: block;
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/index.tsx b/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
index ffa73d01..9c10e109 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
+++ b/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
@@ -13,6 +13,7 @@ import { Button } from "antd";
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
import { useTransClient } from "@/app/i18n/client";
import CalendarTimingItem from "@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem";
+import PublishDialog from "@/components/PublishDialog";
export interface ICalendarTimingRef {}
export interface ICalendarTimingProps {}
@@ -36,6 +37,7 @@ const CalendarTiming = memo(
}
};
const calendarTimingCalendarRef = useRef<HTMLDivElement>(null);
+ const [publishDialogOpen, setPublishDialogOpen] = useState(false);
// 动画触发函数
const triggerAnimation = (dir: "left" | "right" | "fade") => {
@@ -72,6 +74,11 @@ const CalendarTiming = memo(
return (
<div className={styles.calendarTiming}>
+ <PublishDialog
+ open={publishDialogOpen}
+ onClose={() => setPublishDialogOpen(false)}
+ />
+
<div className="calendarTiming-toolbar">
<div className="calendarTiming-toolbar-left">
<Button
@@ -110,7 +117,14 @@ const CalendarTiming = memo(
headerToolbar={false}
stickyFooterScrollbar={true}
dayCellContent={(arg) => {
- return <CalendarTimingItem arg={arg} />;
+ return (
+ <CalendarTimingItem
+ arg={arg}
+ onClickPub={() => {
+ setPublishDialogOpen(true);
+ }}
+ />
+ );
}}
datesSet={handleDatesSet}
/>
diff --git a/src/app/[lng]/layout.tsx b/src/app/[lng]/layout.tsx
index 51167ff6..f4af06db 100644
--- a/src/app/[lng]/layout.tsx
+++ b/src/app/[lng]/layout.tsx
@@ -6,7 +6,6 @@ import { dir } from "i18next";
import { languages, fallbackLng } from "@/app/i18n/settings";
import { useTranslation } from "@/app/i18n";
import LyaoutHeader from "@/app/layout/LyaoutHeader";
-import LyaoutFooter from "@/app/layout/LyaoutFooter";
export async function generateMetadata({
params,
@@ -36,7 +35,6 @@ export default async function RootLayout({
<Providers lng={lng}>
<LyaoutHeader />
{children}
- <LyaoutFooter lng={lng} />
</Providers>
</body>
</html>
diff --git a/src/app/layout/LyaoutFooter.tsx b/src/app/layout/LyaoutFooter.tsx
deleted file mode 100644
index 19d5ae2e..00000000
--- a/src/app/layout/LyaoutFooter.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import { ForwardedRef, forwardRef, memo } from "react";
-import styles from "./styles/lyaoutFooter.module.scss";
-import Image from "next/image";
-import Link from "next/link";
-import QRCode1 from "./images/QRCode1.jpg";
-import QRCode2 from "./images/QRCode2.png";
-import { useTranslation } from "@/app/i18n";
-
-export interface ILyaoutFooterRef {}
-
-export interface ILyaoutFooterProps {
- lng: string;
-}
-
-function getLinkList() {
- return [
- {
- name: "新华网",
- link: "http://www.news.cn",
- },
- {
- name: "财经网",
- link: "https://www.caijing.com.cn",
- },
- {
- name: "腾讯网",
- link: "https://www.qq.com",
- },
- ];
-}
-
-const LyaoutFooter = memo(
- forwardRef(
- async (
- { lng }: ILyaoutFooterProps,
- ref: ForwardedRef<ILyaoutFooterRef>,
- ) => {
- const linkList = getLinkList();
- const { t } = await useTranslation(lng);
-
- return (
- <div className={styles.layoutFooter}>
- <div className={styles.layoutFooter_wrapper}>
- <div className={styles["layoutFooter_wrapper-left"]}>
- <h2>{t("title")}</h2>
- <p>
- <a
- href="https://beian.miit.gov.cn/#/Integrated/recordQuery"
- target="_blank"
- >
- Copyright@2020艺咖(北京)科技有限公司 京ICP备19059131号-1
- </a>
- </p>
- </div>
- <div className={styles["layoutFooter_wrapper-center"]}>
- <h3>友情链接</h3>
- <ul>
- {linkList.map((item, i) => (
- <li key={i}>
- <Link href={item.link} target="_blank">
- {item.name}
- </Link>
- </li>
- ))}
- </ul>
- </div>
- <ul className={styles["layoutFooter_wrapper-right"]}>
- <li>
- <Image src={QRCode1} alt="商务合作" width={88} />
- <p>商务合作</p>
- </li>
- <li>
- <Image src={QRCode2} alt="公众号" width={88} />
- <p>公众号</p>
- </li>
- </ul>
- </div>
- </div>
- );
- },
- ),
-);
-
-export default LyaoutFooter;
diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsx
new file mode 100644
index 00000000..53112cce
--- /dev/null
+++ b/src/components/PublishDialog/index.tsx
@@ -0,0 +1,72 @@
+import { ForwardedRef, forwardRef, memo, useCallback } from "react";
+import styles from "./publishDialog.module.scss";
+import { Button, Modal } from "antd";
+import { ExclamationCircleFilled } from "@ant-design/icons";
+
+export interface IPublishDialogRef {}
+
+export interface IPublishDialogProps {
+ open: boolean;
+ onClose: () => void;
+}
+
+const { confirm } = Modal;
+
+// 发布作品弹框
+const PublishDialog = memo(
+ forwardRef(
+ (
+ { open, onClose }: IPublishDialogProps,
+ ref: ForwardedRef<IPublishDialogRef>,
+ ) => {
+ // 关闭弹框并确认关闭
+ const closeDialog = useCallback(() => {
+ confirm({
+ title: "放弃更改?",
+ icon: <ExclamationCircleFilled />,
+ content: "您所做的任何更改都将永久丢失 ",
+ okType: "danger",
+ okButtonProps: {
+ type: "primary",
+ },
+ cancelButtonProps: {
+ type: "text",
+ },
+ centered: true,
+ onOk() {
+ onClose();
+ },
+ });
+ }, [onClose]);
+
+ return (
+ <>
+ <Modal
+ className={styles.publishDialog}
+ closeIcon={false}
+ width={710}
+ open={open}
+ onCancel={closeDialog}
+ footer={
+ <div className={styles.publishDialogFooter}>
+ time
+ <div className="publishDialogFooter-btns">
+ <Button size="large" onClick={closeDialog}>
+ 取消
+ </Button>
+ <Button size="large" type="primary">
+ 确认
+ </Button>
+ </div>
+ </div>
+ }
+ >
+ <div className="publishDialog-con"></div>
+ </Modal>
+ </>
+ );
+ },
+ ),
+);
+
+export default PublishDialog;
diff --git a/src/components/PublishDialog/publishDialog.module.scss b/src/components/PublishDialog/publishDialog.module.scss
new file mode 100644
index 00000000..4a7cf447
--- /dev/null
+++ b/src/components/PublishDialog/publishDialog.module.scss
@@ -0,0 +1,25 @@
+.publishDialog {
+ :global {
+ .ant-modal-content {
+ padding: 0 !important;
+ }
+ .publishDialog-con {
+ padding: 20px;
+ }
+ }
+}
+
+.publishDialogFooter {
+ display: flex;
+ align-items: center;
+ border-top: 1px solid var(--grayColor4);
+ padding: 20px;
+ justify-content: space-between;
+ :global {
+ .publishDialogFooter-btns {
+ button {
+ margin-right: 10px;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/components/PublishDialog/usePublishDialog.ts b/src/components/PublishDialog/usePublishDialog.ts
new file mode 100644
index 00000000..d97fc562
--- /dev/null
+++ b/src/components/PublishDialog/usePublishDialog.ts
@@ -0,0 +1,30 @@
+import { create } from "zustand";
+import { combine } from "zustand/middleware";
+import lodash from "lodash";
+
+export interface IPublishDialogStore {}
+
+const store: IPublishDialogStore = {};
+
+const getStore = () => {
+ return lodash.cloneDeep(store);
+};
+
+export const usePublishDialog = create(
+ combine(
+ {
+ ...getStore(),
+ },
+ (set, get, storeApi) => {
+ const methods = {
+ // 清空所有数据
+ clear() {
+ set({
+ ...getStore(),
+ });
+ },
+ };
+ return methods;
+ },
+ ),
+);