Skip to content

Let's use AI to Earn!

feat(日历):日历在同一个单元格发布记录太多会自动隐藏,并且显示按钮让用户点击查看更多

gaoSir9467ad50cb3e
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f58e5c33..b0ae2f7a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,15 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="fix(发布): 默认返回快手参数">
+ <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat(日历):细节调整,1. 发布记录查看,添加图片、视频分别处理。 2. 发布API添加图片处理">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/api/plat/types/publish.types.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/plat/types/publish.types.ts" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.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/config/platConfig.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/config/platConfig.ts" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/config/publishConfig.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/config/publishConfig.ts" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" 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" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -98,7 +93,7 @@
<workItem from="1752118620733" duration="566000" />
<workItem from="1752130881346" duration="11774000" />
<workItem from="1752200550278" duration="253000" />
- <workItem from="1752200816463" duration="10299000" />
+ <workItem from="1752200816463" duration="12806000" />
</task>
<task id="LOCAL-00001" summary="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 修改 CalendarTimingItem 组件,移除不必要的 Fragment&#10;-调整 index.tsx 中的日期格式化逻辑">
<option name="closed" value="true" />
@@ -196,7 +191,15 @@
<option name="project" value="LOCAL" />
<updated>1752219562256</updated>
</task>
- <option name="localTasksCounter" value="13" />
+ <task id="LOCAL-00013" summary="feat(日历):细节调整,1. 发布记录查看,添加图片、视频分别处理。 2. 发布API添加图片处理">
+ <option name="closed" value="true" />
+ <created>1752229429479</created>
+ <option name="number" value="00013" />
+ <option name="presentableId" value="LOCAL-00013" />
+ <option name="project" value="LOCAL" />
+ <updated>1752229429479</updated>
+ </task>
+ <option name="localTasksCounter" value="14" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -228,6 +231,7 @@
<MESSAGE value="feat: 删除不需要的文件" />
<MESSAGE value="feat(日历): 删除任务、修改任务时间接入API,删除任务完成" />
<MESSAGE value="fix(发布): 默认返回快手参数" />
- <option name="LAST_COMMIT_MESSAGE" value="fix(发布): 默认返回快手参数" />
+ <MESSAGE value="feat(日历):细节调整,1. 发布记录查看,添加图片、视频分别处理。 2. 发布API添加图片处理" />
+ <option name="LAST_COMMIT_MESSAGE" value="feat(日历):细节调整,1. 发布记录查看,添加图片、视频分别处理。 2. 发布API添加图片处理" />
</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 2947198c..e3f5ab62 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx
+++ b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx
@@ -1,9 +1,9 @@
-import { ForwardedRef, forwardRef, memo } from "react";
+import { ForwardedRef, forwardRef, memo, useMemo, useState } from "react";
import styles from "./calendarTimingItem.module.scss";
import { DayCellContentArg } from "@fullcalendar/core";
import { Button, Skeleton } from "antd";
import { useTransClient } from "@/app/i18n/client";
-import { PlusOutlined } from "@ant-design/icons";
+import { DownOutlined, PlusOutlined, UpOutlined } from "@ant-design/icons";
import { useDrop } from "react-dnd";
import CalendarRecord from "@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarRecord";
import { CustomDragLayer } from "@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CustomDragLayer";
@@ -40,6 +40,8 @@ const CalendarTimingItem = memo(
today.getMonth(),
today.getDate(),
);
+ // [[小时,分钟]]
+ const [reservationsTimes, setReservationsTimes] = useState([[4, 12]]);
const [{ canDrop, isOver }, drop] = useDrop(
() => ({
accept: "box",
@@ -53,6 +55,16 @@ const CalendarTimingItem = memo(
}),
[],
);
+ const [isMore, setIsMore] = useState(false);
+
+ const recordsLast = useMemo(() => {
+ if (!records) return [];
+ if (isMore) {
+ return records;
+ } else {
+ return records?.slice(0, 3 - reservationsTimes.length);
+ }
+ }, [isMore, records, reservationsTimes]);
return (
<div
@@ -96,25 +108,31 @@ const CalendarTimingItem = memo(
</>
) : (
<div className="calendarTimingItem-con">
- {argDate >= nowDate && (
- <Button
- size="small"
- type="dashed"
- onClick={() => {
- const days = dayjs(arg.date)
- .set("hour", 16)
- .set("minute", 12);
- onClickPub(days.format());
- }}
- >
- <div className="calendarTimingItem-con-btn1">04:12 PM</div>
- <div className="calendarTimingItem-con-btn2">
- {t("addPost")}
- </div>
- </Button>
- )}
+ {argDate >= nowDate &&
+ reservationsTimes.map((v, i) => {
+ return (
+ <Button
+ key={i}
+ size="small"
+ type="dashed"
+ onClick={() => {
+ const days = dayjs(arg.date)
+ .set("hour", v[0])
+ .set("minute", v[1]);
+ onClickPub(days.format());
+ }}
+ >
+ <div className="calendarTimingItem-con-btn1">
+ {v[0]}:{v[1]} PM
+ </div>
+ <div className="calendarTimingItem-con-btn2">
+ {t("addPost")}
+ </div>
+ </Button>
+ );
+ })}
{records &&
- records.map((v) => {
+ recordsLast.map((v) => {
return (
<div key={v.id}>
<CustomDragLayer publishRecord={v} snapToGrid={false} />
@@ -122,6 +140,34 @@ const CalendarTimingItem = memo(
</div>
);
})}
+
+ {records && records.length > 3 - reservationsTimes.length && (
+ <Button
+ type="text"
+ style={{
+ height: "auto",
+ width: "auto",
+ padding: "3px 10px",
+ fontSize: "var(--fs-sm)",
+ marginBottom: "0",
+ }}
+ onClick={() => {
+ setIsMore(!isMore);
+ }}
+ >
+ {isMore ? (
+ <>
+ <UpOutlined style={{ marginRight: "8px" }} />
+ 隐藏更多
+ </>
+ ) : (
+ <>
+ <DownOutlined style={{ marginRight: "8px" }} />
+ 显示更多
+ </>
+ )}
+ </Button>
+ )}
</div>
)}
</div>
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 6581e7c9..976c4d76 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss
+++ b/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss
@@ -3,8 +3,9 @@
padding: 10px;
display: flex;
flex-direction: column;
- min-height: 200px;
font-weight: 600;
+ min-height: 200px;
+ height: 100%;
:global {
.calendarTimingItem-top {
display: flex;
@@ -32,7 +33,7 @@
margin-bottom: 8px;
font-size: var(--fs-xs);
padding: 0;
- height: 34px !important;
+ height: 34px;
&:hover {
.calendarTimingItem-con-btn2 {
display: block;