Skip to content

Let's use AI to Earn!

feat: 日历初步开发

gaoSir3bb94f4d4f92
diff --git a/.gitignore b/.gitignore
index f6966153..fd3dbb57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,5 +34,3 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
-
-certificates
\ No newline at end of file
diff --git a/@types/resources.d.ts b/@types/resources.d.ts
index dab23378..1704975c 100644
--- a/@types/resources.d.ts
+++ b/@types/resources.d.ts
@@ -1,99 +1,100 @@
interface Resources {
- account: {
- title: "账户";
- describe: "账户页面";
- };
- common: {
- profile: "个人中心";
- logout: "退出登录";
- unknownUser: "未知用户";
- login: "登录";
- };
- demo: {
- demoText: "测试文字";
- title: "测试页面标题";
- };
+ "account": {
+ "title": "账户",
+ "describe": "账户页面",
+ "today": "今天"
+ },
+ "common": {
+ "profile": "个人中心",
+ "logout": "退出登录",
+ "unknownUser": "未知用户",
+ "login": "登录"
+ },
+ "demo": {
+ "demoText": "测试文字",
+ "title": "测试页面标题"
+ },
"hot-content": {
- all: "全部";
- loading: "加载中...";
- noData: "暂无数据";
- rank: "排名";
- cover: "封面";
- title: "标题";
- author: "作者";
- category: "分类";
- likes: "点赞";
- shares: "分享";
- comments: "评论数";
- collections: "收藏数";
- publishTime: "发布于";
- fans: "粉丝";
- viewMore: "查看更多";
- timeRange: "时间范围";
- filter: "筛选";
- hotTopics: "热门专题";
- viralTitles: "爆款标题";
- topics: "专题";
- engagement: "互动量";
- rising: "热";
- noHotTopics: "暂无热点数据";
- noViralTitles: "暂无爆款标题数据";
- noTopicData: "暂无专题数据";
- total: "共";
- items: "条";
- video: "视频";
- noImage: "暂无图片";
- platform: "平台";
- hotEvents: "热点事件";
- hotContent: "热点内容";
- };
- login: {
- welcomeBack: "哎呦赚";
- emailPlaceholder: "邮箱";
- passwordPlaceholder: "密码";
- login: "登录";
- or: "或";
- forgotPassword: "忘记密码?";
- completeRegistration: "完成注册";
- setPassword: "设置密码";
- passwordRequired: "请输入密码";
- passwordMinLength: "密码长度不能小于6位";
- enterPassword: "请输入密码";
- inviteCode: "邀请码(选填)";
- enterInviteCode: "请输入邀请码";
- waitingForActivation: "等待激活中...";
- loginSuccess: "登录成功";
- loginFailed: "登录失败";
- loginError: "登录失败,请稍后重试";
- activationEmailSent: "激活链接已发送至邮箱,请查收并点击激活";
- registerSuccess: "注册成功,已自动登录";
- checkStatusError: "检查注册状态失败";
- registerError: "注册失败,请稍后重试";
- googleLoginFailed: "Google 登录失败";
- };
- route: {
- home: "首页";
- accounts: "账户";
- publish: "发布";
- hotContent: "热门内容";
- hotContentNew: "热门内容新";
- };
- translation: {
- title: "AIToEarn官方网站";
- content: "最好用的开源矩阵工具";
- };
- youtube: {
- youtubeAuth: "YouTube 授权";
- authDescription: "请输入您的邮箱地址以获取 YouTube 授权";
- email: "邮箱";
- enterEmail: "请输入邮箱地址";
- authorize: "授权";
- pleaseEnterEmail: "请输入邮箱地址";
- invalidEmail: "请输入有效的邮箱地址";
- authFailed: "授权失败,请稍后重试";
- checkAuth: "检查授权";
- notAuthorized: "未授权";
- };
+ "all": "全部",
+ "loading": "加载中...",
+ "noData": "暂无数据",
+ "rank": "排名",
+ "cover": "封面",
+ "title": "标题",
+ "author": "作者",
+ "category": "分类",
+ "likes": "点赞",
+ "shares": "分享",
+ "comments": "评论数",
+ "collections": "收藏数",
+ "publishTime": "发布于",
+ "fans": "粉丝",
+ "viewMore": "查看更多",
+ "timeRange": "时间范围",
+ "filter": "筛选",
+ "hotTopics": "热门专题",
+ "viralTitles": "爆款标题",
+ "topics": "专题",
+ "engagement": "互动量",
+ "rising": "热",
+ "noHotTopics": "暂无热点数据",
+ "noViralTitles": "暂无爆款标题数据",
+ "noTopicData": "暂无专题数据",
+ "total": "共",
+ "items": "条",
+ "video": "视频",
+ "noImage": "暂无图片",
+ "platform": "平台",
+ "hotEvents": "热点事件",
+ "hotContent": "热点内容"
+ },
+ "login": {
+ "welcomeBack": "哎呦赚",
+ "emailPlaceholder": "邮箱",
+ "passwordPlaceholder": "密码",
+ "login": "登录/注册",
+ "or": "或",
+ "forgotPassword": "忘记密码?",
+ "completeRegistration": "完成注册",
+ "setPassword": "设置密码",
+ "passwordRequired": "请输入密码",
+ "passwordMinLength": "密码长度不能小于6位",
+ "enterPassword": "请输入密码",
+ "inviteCode": "邀请码(选填)",
+ "enterInviteCode": "请输入邀请码",
+ "waitingForActivation": "等待激活中...",
+ "loginSuccess": "登录成功",
+ "loginFailed": "登录失败",
+ "loginError": "登录失败,请稍后重试",
+ "activationEmailSent": "激活链接已发送至邮箱,请查收并点击激活",
+ "registerSuccess": "注册成功,已自动登录",
+ "checkStatusError": "检查注册状态失败",
+ "registerError": "注册失败,请稍后重试",
+ "googleLoginFailed": "Google 登录失败"
+ },
+ "route": {
+ "home": "首页",
+ "accounts": "账户",
+ "publish": "发布",
+ "hotContent": "热门内容",
+ "hotContentNew": "热门内容新"
+ },
+ "translation": {
+ "title": "AIToEarn官方网站",
+ "content": "最好用的开源矩阵工具"
+ },
+ "youtube": {
+ "youtubeAuth": "YouTube 授权",
+ "authDescription": "请输入您的邮箱地址以获取 YouTube 授权",
+ "email": "邮箱",
+ "enterEmail": "请输入邮箱地址",
+ "authorize": "授权",
+ "pleaseEnterEmail": "请输入邮箱地址",
+ "invalidEmail": "请输入有效的邮箱地址",
+ "authFailed": "授权失败,请稍后重试",
+ "checkAuth": "检查授权",
+ "notAuthorized": "未授权"
+ }
}
export default Resources;
diff --git a/package-lock.json b/package-lock.json
index 10541c8e..8922ad89 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,9 @@
"@ant-design/colors": "^7.2.1",
"@ant-design/icons": "^6.0.0",
"@ant-design/nextjs-registry": "^1.0.2",
+ "@fullcalendar/core": "^6.1.17",
+ "@fullcalendar/daygrid": "^6.1.17",
+ "@fullcalendar/react": "^6.1.17",
"@kwooshung/react-no-ssr": "^1.1.4",
"@react-oauth/google": "^0.12.2",
"@szhsin/react-menu": "^4.4.1",
@@ -33,6 +36,7 @@
"react-i18next": "15.4.1",
"react-icons": "^5.5.0",
"react-sortablejs": "^6.1.4",
+ "react-transition-group": "^4.4.5",
"sass": "^1.59.2",
"sortablejs": "^1.15.6",
"zustand": "^5.0.5"
@@ -44,6 +48,7 @@
"@types/qs": "^6.14.0",
"@types/react": "^18",
"@types/react-dom": "^18",
+ "@types/react-transition-group": "^4.4.12",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^9",
@@ -385,6 +390,35 @@
"npm": ">=7.0.0"
}
},
+ "node_modules/@fullcalendar/core": {
+ "version": "6.1.17",
+ "resolved": "https://registry.npmjs.org/@fullcalendar/core/-/core-6.1.17.tgz",
+ "integrity": "sha512-0W7lnIrv18ruJ5zeWBeNZXO8qCWlzxDdp9COFEsZnyNjiEhUVnrW/dPbjRKYpL0edGG0/Lhs0ghp1z/5ekt8ZA==",
+ "license": "MIT",
+ "dependencies": {
+ "preact": "~10.12.1"
+ }
+ },
+ "node_modules/@fullcalendar/daygrid": {
+ "version": "6.1.17",
+ "resolved": "https://registry.npmjs.org/@fullcalendar/daygrid/-/daygrid-6.1.17.tgz",
+ "integrity": "sha512-K7m+pd7oVJ9fW4h7CLDdDGJbc9szJ1xDU1DZ2ag+7oOo1aCNLv44CehzkkknM6r8EYlOOhgaelxQpKAI4glj7A==",
+ "license": "MIT",
+ "peerDependencies": {
+ "@fullcalendar/core": "~6.1.17"
+ }
+ },
+ "node_modules/@fullcalendar/react": {
+ "version": "6.1.17",
+ "resolved": "https://registry.npmjs.org/@fullcalendar/react/-/react-6.1.17.tgz",
+ "integrity": "sha512-AA8soHhlfRH5dUeqHnfAtzDiXa2vrgWocJSK/F5qzw/pOxc9MqpuoS/nQBROWtHHg6yQUg3DoGqOOhi7dmylXQ==",
+ "license": "MIT",
+ "peerDependencies": {
+ "@fullcalendar/core": "~6.1.17",
+ "react": "^16.7.0 || ^17 || ^18 || ^19",
+ "react-dom": "^16.7.0 || ^17 || ^18 || ^19"
+ }
+ },
"node_modules/@humanfs/core": {
"version": "0.19.1",
"resolved": "https://registry.npmmirror.com/@humanfs/core/-/core-0.19.1.tgz",
@@ -1340,6 +1374,16 @@
"@types/react": "^18.0.0"
}
},
+ "node_modules/@types/react-transition-group": {
+ "version": "4.4.12",
+ "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.12.tgz",
+ "integrity": "sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "*"
+ }
+ },
"node_modules/@types/sortablejs": {
"version": "1.15.8",
"resolved": "https://registry.npmmirror.com/@types/sortablejs/-/sortablejs-1.15.8.tgz",
@@ -2819,6 +2863,16 @@
"node": ">=0.10.0"
}
},
+ "node_modules/dom-helpers": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz",
+ "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.8.7",
+ "csstype": "^3.0.2"
+ }
+ },
"node_modules/dom-serializer": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/dom-serializer/-/dom-serializer-2.0.0.tgz",
@@ -5292,7 +5346,6 @@
"version": "4.1.1",
"resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
@@ -5655,6 +5708,16 @@
"node": "^10 || ^12 || >=14"
}
},
+ "node_modules/preact": {
+ "version": "10.12.1",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.12.1.tgz",
+ "integrity": "sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/preact"
+ }
+ },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -5708,7 +5771,6 @@
"version": "15.8.1",
"resolved": "https://registry.npmmirror.com/prop-types/-/prop-types-15.8.1.tgz",
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
- "dev": true,
"license": "MIT",
"dependencies": {
"loose-envify": "^1.4.0",
@@ -6454,7 +6516,6 @@
"version": "16.13.1",
"resolved": "https://registry.npmmirror.com/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
- "dev": true,
"license": "MIT"
},
"node_modules/react-sortablejs": {
@@ -6479,6 +6540,22 @@
"integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==",
"license": "MIT"
},
+ "node_modules/react-transition-group": {
+ "version": "4.4.5",
+ "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",
+ "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@babel/runtime": "^7.5.5",
+ "dom-helpers": "^5.0.1",
+ "loose-envify": "^1.4.0",
+ "prop-types": "^15.6.2"
+ },
+ "peerDependencies": {
+ "react": ">=16.6.0",
+ "react-dom": ">=16.6.0"
+ }
+ },
"node_modules/react-transition-state": {
"version": "2.3.1",
"resolved": "https://registry.npmmirror.com/react-transition-state/-/react-transition-state-2.3.1.tgz",
diff --git a/package.json b/package.json
index 92368227..196e22ba 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,9 @@
"@ant-design/colors": "^7.2.1",
"@ant-design/icons": "^6.0.0",
"@ant-design/nextjs-registry": "^1.0.2",
+ "@fullcalendar/core": "^6.1.17",
+ "@fullcalendar/daygrid": "^6.1.17",
+ "@fullcalendar/react": "^6.1.17",
"@kwooshung/react-no-ssr": "^1.1.4",
"@react-oauth/google": "^0.12.2",
"@szhsin/react-menu": "^4.4.1",
@@ -40,6 +43,7 @@
"react-i18next": "15.4.1",
"react-icons": "^5.5.0",
"react-sortablejs": "^6.1.4",
+ "react-transition-group": "^4.4.5",
"sass": "^1.59.2",
"sortablejs": "^1.15.6",
"zustand": "^5.0.5"
@@ -51,6 +55,7 @@
"@types/qs": "^6.14.0",
"@types/react": "^18",
"@types/react-dom": "^18",
+ "@types/react-transition-group": "^4.4.12",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^9",
diff --git a/src/app/[lng]/accounts/accountCore.tsx b/src/app/[lng]/accounts/accountCore.tsx
index ba353411..4a606530 100644
--- a/src/app/[lng]/accounts/accountCore.tsx
+++ b/src/app/[lng]/accounts/accountCore.tsx
@@ -6,6 +6,7 @@ import { useShallow } from "zustand/react/shallow";
import { useEffect, useState } from "react";
import { NoSSR } from "@kwooshung/react-no-ssr";
import AccountSidebar from "@/app/[lng]/accounts/components/AccountSidebar/AccountSidebar";
+import CalendarTiming from "@/app/[lng]/accounts/components/CalendarTiming";
export default function AccountPageCore() {
const { accountInit } = useAccountStore(
@@ -29,6 +30,7 @@ export default function AccountPageCore() {
setActiveAccountId(account.id);
}}
/>
+ <CalendarTiming />
</div>
</NoSSR>
);
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
index f21ada41..a1bbafb1 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
+++ b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
@@ -12,6 +12,17 @@
}
:global {
+ .ant-skeleton-paragraph {
+ margin-top: 15px !important;
+ }
+
+ .ant-skeleton {
+ display: flex !important;
+ align-items: center !important;
+ padding: 0 10px;
+ margin-bottom: 10px;
+ }
+
.accountSidebar-userCount {
display: inline-block;
margin-left: 10px;
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
index 7c8bb1b6..49bdcbce 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
+++ b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
@@ -7,7 +7,7 @@ import {
useState,
} from "react";
import styles from "./AccountSidebar.module.scss";
-import { Avatar, Button, Collapse, Popover, Tooltip } from "antd";
+import { Avatar, Button, Collapse, Popover, Skeleton, Tooltip } from "antd";
// import { accountLogin, acpAccountLoginCheck } from "@/icp/account";
import AddAccountModal from "../AddAccountModal";
import {
@@ -135,11 +135,13 @@ const AccountSidebar = memo(
accountList: fullAccountList,
getAccountList,
accountGroupList,
+ accountLoading,
} = useAccountStore(
useShallow((state) => ({
accountList: state.accountList,
getAccountList: state.getAccountList,
accountGroupList: state.accountGroupList,
+ accountLoading: state.accountLoading,
})),
);
const [userManageModalOpen, setUserManageModalOpen] = useState(false);
@@ -200,84 +202,100 @@ const AccountSidebar = memo(
</div>
</div>
- <Collapse
- key={defaultActiveKey}
- defaultActiveKey={defaultActiveKey}
- items={accountGroupList.map((v) => {
- return {
- key: v.id,
- label: (
- <>
- {v.name}
- <span className="accountSidebar-userCount">
- {v.children?.length}/
- {
- v.children?.map(
- (v) => v.status === AccountStatus.USABLE,
- ).length
- }
- </span>
- </>
- ),
- children: (
- <ul key={v.id} className="accountList">
- {v.children?.map((account) => {
- if (excludePlatforms.includes(account.type)) return "";
- const platInfo = AccountPlatInfoMap.get(account.type)!;
- return (
- <li
- className={[
- "accountList-item",
- `${activeAccountId === account.id ? "accountList-item--active" : ""}`,
- // 失效状态
- account.status === AccountStatus.DISABLE &&
- "accountList-item--disable",
- ].join(" ")}
- key={account.id}
- onClick={async () => {
- if (account.status === AccountStatus.DISABLE) {
- // TODO 账户登录
- // const res = await accountLogin(account.type);
- // if (!res) return;
- // message.success("账号登录成功!");
- // return;
- }
- onAccountChange(account);
- }}
- >
- <Avatar src={getOssUrl(account.avatar)} size="large" />
- <div className="accountList-item-right">
- <div
- className="accountList-item-right-name"
- title={account.nickname}
- >
- <Tooltip title={undefined}>
- {account.nickname}
- </Tooltip>
- </div>
- <div className="accountList-item-right-footer">
- <p className="accountList-item-right-plat">
- <img src={platInfo.icon} />
- <span>{platInfo.name}</span>
- </p>
- <Popover
- content={
- <AccountPopoverInfo accountInfo={account} />
- }
- placement="right"
+ {accountLoading ? (
+ <>
+ <Skeleton avatar paragraph={{ rows: 1 }} active />
+ <Skeleton avatar paragraph={{ rows: 1 }} active />
+ <Skeleton avatar paragraph={{ rows: 1 }} active />
+ </>
+ ) : (
+ <Collapse
+ key={defaultActiveKey}
+ defaultActiveKey={defaultActiveKey}
+ items={accountGroupList.map((v) => {
+ return {
+ key: v.id,
+ label: (
+ <>
+ {v.name}
+ <span className="accountSidebar-userCount">
+ {v.children?.length}/
+ {
+ v.children?.map(
+ (v) => v.status === AccountStatus.USABLE,
+ ).length
+ }
+ </span>
+ </>
+ ),
+ children: (
+ <ul key={v.id} className="accountList">
+ {v.children?.map((account) => {
+ if (excludePlatforms.includes(account.type))
+ return "";
+ const platInfo = AccountPlatInfoMap.get(
+ account.type,
+ )!;
+ return (
+ <li
+ className={[
+ "accountList-item",
+ `${activeAccountId === account.id ? "accountList-item--active" : ""}`,
+ // 失效状态
+ account.status === AccountStatus.DISABLE &&
+ "accountList-item--disable",
+ ].join(" ")}
+ key={account.id}
+ onClick={async () => {
+ if (account.status === AccountStatus.DISABLE) {
+ // TODO 账户登录
+ // const res = await accountLogin(account.type);
+ // if (!res) return;
+ // message.success("账号登录成功!");
+ // return;
+ }
+ onAccountChange(account);
+ }}
+ >
+ <Avatar
+ src={getOssUrl(account.avatar)}
+ size="large"
+ />
+ <div className="accountList-item-right">
+ <div
+ className="accountList-item-right-name"
+ title={account.nickname}
>
- ...
- </Popover>
+ <Tooltip title={undefined}>
+ {account.nickname}
+ </Tooltip>
+ </div>
+ <div className="accountList-item-right-footer">
+ <p className="accountList-item-right-plat">
+ <img src={platInfo.icon} />
+ <span>{platInfo.name}</span>
+ </p>
+ <Popover
+ content={
+ <AccountPopoverInfo
+ accountInfo={account}
+ />
+ }
+ placement="right"
+ >
+ ...
+ </Popover>
+ </div>
</div>
- </div>
- </li>
- );
- })}
- </ul>
- ),
- };
- })}
- />
+ </li>
+ );
+ })}
+ </ul>
+ ),
+ };
+ })}
+ />
+ )}
<div className="accountSidebar-footer">
<Button
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss b/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss
new file mode 100644
index 00000000..f20d1b28
--- /dev/null
+++ b/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss
@@ -0,0 +1,91 @@
+.calendarTiming {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ padding: 15px;
+ box-sizing: border-box;
+
+ :global {
+ .calendarTiming-toolbar {
+ display: flex;
+ align-items: center;
+ margin-bottom: 10px;
+ h1 {
+ margin: 0 10px;
+ }
+ }
+ .calendarTiming-calendar {
+ position: relative;
+ overflow: auto;
+ height: 100%;
+ .fc-scrollgrid {
+ border-top: none !important;
+ }
+ thead {
+ position: sticky;
+ top: 0;
+ background: var(--whiteColor);
+ z-index: 5;
+ .fc-scroller-harness {
+ border-top: 1px solid var(--fc-border-color);
+ }
+ .fc-scrollgrid-sync-inner {
+ padding: 5px 0;
+ }
+ }
+ }
+ }
+}
+
+.slideLeftEnter {
+ opacity: 0;
+ transform: translateX(50px);
+}
+.slideLeftEnterActive {
+ opacity: 1;
+ transform: translateX(0);
+ transition: opacity 300ms, transform 300ms;
+}
+.slideLeftExit {
+ opacity: 1;
+ transform: translateX(0);
+}
+.slideLeftExitActive {
+ opacity: 0;
+ transform: translateX(-50px);
+ transition: opacity 300ms, transform 300ms;
+}
+.slideRightEnter {
+ opacity: 0;
+ transform: translateX(-50px);
+}
+.slideRightEnterActive {
+ opacity: 1;
+ transform: translateX(0);
+ transition: opacity 300ms, transform 300ms;
+}
+.slideRightExit {
+ opacity: 1;
+ transform: translateX(0);
+}
+.slideRightExitActive {
+ opacity: 0;
+ transform: translateX(50px);
+ transition: opacity 300ms, transform 300ms;
+}
+.fadeEnter {
+ opacity: 0;
+}
+.fadeEnterActive {
+ opacity: 1;
+ transition: opacity 300ms;
+}
+.fadeExit {
+ opacity: 1;
+}
+.fadeExitActive {
+ opacity: 0;
+ transition: opacity 300ms;
+}
\ No newline at end of file
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils.ts b/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils.ts
new file mode 100644
index 00000000..2b302bce
--- /dev/null
+++ b/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils.ts
@@ -0,0 +1,39 @@
+import styles from "./calendarTiming.module.scss";
+
+// 日历国际化
+export const getFullCalendarLang = (lang: string) => {
+ switch (lang) {
+ case "zh-CN":
+ return "zh-cn";
+ case "en":
+ return "en-gb";
+ }
+ return "en-gb";
+};
+
+// 封装classNames切换方法
+export function getTransitionClassNames(direction: "left" | "right" | "fade") {
+ if (direction === "left") {
+ return {
+ enter: styles.slideLeftEnter,
+ enterActive: styles.slideLeftEnterActive,
+ exit: styles.slideLeftExit,
+ exitActive: styles.slideLeftExitActive,
+ };
+ } else if (direction === "right") {
+ return {
+ enter: styles.slideRightEnter,
+ enterActive: styles.slideRightEnterActive,
+ exit: styles.slideRightExit,
+ exitActive: styles.slideRightExitActive,
+ };
+ } else {
+ // fade 动画
+ return {
+ enter: styles.fadeEnter,
+ enterActive: styles.fadeEnterActive,
+ exit: styles.fadeExit,
+ exitActive: styles.fadeExitActive,
+ };
+ }
+}
\ No newline at end of file
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/index.tsx b/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
new file mode 100644
index 00000000..92b2e222
--- /dev/null
+++ b/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
@@ -0,0 +1,118 @@
+import { ForwardedRef, forwardRef, memo, useRef, useState } from "react";
+import styles from "./calendarTiming.module.scss";
+import FullCalendar from "@fullcalendar/react";
+import dayGridPlugin from "@fullcalendar/daygrid";
+import { useGetClientLng } from "@/hooks/useSystem";
+import {
+ getFullCalendarLang,
+ getTransitionClassNames,
+} from "@/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils";
+import { CSSTransition } from "react-transition-group";
+import { DatesSetArg } from "@fullcalendar/core";
+import { Button } from "antd";
+import { LeftOutlined, RightOutlined } from "@ant-design/icons";
+import { useTransClient } from "@/app/i18n/client";
+
+const events = [{ title: "Meeting", start: new Date() }];
+
+function renderEventContent(eventInfo: any) {
+ return (
+ <>
+ <b>{eventInfo.timeText}</b>
+ <i>{eventInfo.event.title}</i>
+ </>
+ );
+}
+
+export interface ICalendarTimingRef {}
+export interface ICalendarTimingProps {}
+
+const CalendarTiming = memo(
+ forwardRef(
+ ({}: ICalendarTimingProps, ref: ForwardedRef<ICalendarTimingRef>) => {
+ const lng = useGetClientLng();
+ const calendarRef = useRef<FullCalendar | null>(null);
+ const [animating, setAnimating] = useState(false);
+ // 方向:'left'(下月)、'right'(上月)、'fade'(今天)
+ const [direction, setDirection] = useState<"left" | "right" | "fade">(
+ "left",
+ );
+ const { t } = useTransClient("account");
+ const [currentDate, setCurrentDate] = useState<Date>(new Date());
+ const handleDatesSet = (arg: DatesSetArg) => {
+ const date = calendarRef.current?.getApi().getDate();
+ if (date) {
+ setCurrentDate(date);
+ }
+ };
+
+ // 动画触发函数
+ const triggerAnimation = (dir: "left" | "right" | "fade") => {
+ setDirection(dir);
+ setAnimating(true);
+ };
+
+ // 点击上/下月按钮时
+ const handlePrev = () => {
+ triggerAnimation("right");
+ setTimeout(() => {
+ calendarRef.current?.getApi().prev();
+ setAnimating(false);
+ }, 300);
+ };
+
+ const handleNext = () => {
+ triggerAnimation("left");
+ setTimeout(() => {
+ calendarRef.current?.getApi().next();
+ setAnimating(false);
+ }, 300);
+ };
+
+ // 点击Today按钮时
+ const handleToday = () => {
+ triggerAnimation("fade");
+ setTimeout(() => {
+ calendarRef.current?.getApi().today();
+ setAnimating(false);
+ }, 300);
+ };
+
+ return (
+ <div className={styles.calendarTiming}>
+ <div className="calendarTiming-toolbar">
+ <Button type="text" icon={<LeftOutlined />} onClick={handlePrev} />
+ <Button type="text" icon={<RightOutlined />} onClick={handleNext} />
+ <h1>
+ {currentDate.getFullYear()}-{currentDate.getMonth() + 1}
+ </h1>
+ <Button onClick={handleToday}>{t("today")}</Button>
+ </div>
+ <CSSTransition
+ in={!animating}
+ timeout={300}
+ classNames={getTransitionClassNames(direction)}
+ unmountOnExit
+ >
+ <div className="calendarTiming-calendar">
+ <FullCalendar
+ ref={calendarRef}
+ locale={getFullCalendarLang(lng)}
+ plugins={[dayGridPlugin]}
+ initialView="dayGridMonth"
+ initialDate={currentDate}
+ headerToolbar={false}
+ stickyFooterScrollbar={true}
+ events={events}
+ eventContent={renderEventContent}
+ datesSet={handleDatesSet}
+ />
+ </div>
+ </CSSTransition>
+ </div>
+ );
+ },
+ ),
+);
+
+export default CalendarTiming;
diff --git a/src/app/i18n/locales/en/account.json b/src/app/i18n/locales/en/account.json
index 8ee1f4d6..fa00500b 100644
--- a/src/app/i18n/locales/en/account.json
+++ b/src/app/i18n/locales/en/account.json
@@ -1,4 +1,5 @@
{
"title": "account",
- "describe": "account Page"
+ "describe": "account Page",
+ "today": "Today"
}
\ No newline at end of file
diff --git a/src/app/i18n/locales/zh-CN/account.json b/src/app/i18n/locales/zh-CN/account.json
index 3b10e78e..32a8d8ae 100644
--- a/src/app/i18n/locales/zh-CN/account.json
+++ b/src/app/i18n/locales/zh-CN/account.json
@@ -1,4 +1,5 @@
{
"title": "账户",
- "describe": "账户页面"
+ "describe": "账户页面",
+ "today": "今天"
}
\ No newline at end of file