Skip to content

Let's use AI to Earn!

refactor: Reconstruction of the old release page (#421)

Gao98c2fbe0c4bb
diff --git a/project/web/.claude/rules/data-fetching-rules.md b/project/web/.claude/rules/data-fetching-rules.md
new file mode 100644
index 00000000..632aa0f8
--- /dev/null
+++ b/project/web/.claude/rules/data-fetching-rules.md
@@ -0,0 +1,37 @@
+---
+paths: "**/app/**/*.tsx"
+---
+
+# Next.js 14 数据获取规则
+
+## 服务端组件数据获取
+
+在服务端组件中使用 fetch API 进行数据获取:
+
+```tsx
+async function getData() {
+ const res = await fetch('https://api.example.com/data', {
+ next: { revalidate: 3600 }
+ })
+
+ if (!res.ok) {
+ throw new Error('Failed to fetch data')
+ }
+
+ return res.json()
+}
+
+export default async function Page() {
+ const data = await getData()
+
+ // 使用数据渲染组件
+ return <div>{/* 渲染逻辑 */}</div>
+}
+```
+
+## 关键要点
+
+- 服务端组件可以是 async 函数
+- 使用 `fetch` API 的 `next` 选项配置缓存和重新验证
+- 适当处理错误情况
+- 数据获取在服务器端完成,减少客户端负担
diff --git a/project/web/.claude/rules/default.md b/project/web/.claude/rules/default.md
new file mode 100644
index 00000000..a393d76d
--- /dev/null
+++ b/project/web/.claude/rules/default.md
@@ -0,0 +1,295 @@
+# 项目主题色
+
+1. 项目使用shadcnui 默认的中性灰色系即可,不需要其它主题色。
+2. 注意项目要实现主题色 深色/浅色 切换,不要使用硬编码的颜色类(如 text-gray-900、bg-white),要使用shadcn/ui 的语义化颜色变量,全局css `/src/app/globals.css`。
+3. 不要使用 `/src/app/var.css` 中的颜色,我现在在过渡阶段,项目中所有用到 var.css 的地方我都会逐渐全改了。
+
+# 测试和文档规则
+
+1. **测试文件**:
+ - 除非用户明确要求编写测试,否则不要创建测试文件(`*.test.ts`, `*.test.tsx`, `*.spec.ts` 等)。
+ - 不要自动创建 `__tests__` 目录。
+ - 只在用户明确说"写测试"、"添加测试"、"需要测试"等时才创建测试文件。
+
+2. **文档文件**:
+ - 对于小的功能修改或 bug 修复,不要自动创建或更新 markdown 文档。
+ - 只在以下情况下创建/更新文档:
+ - 用户明确要求("写文档"、"更新文档"等)
+ - 添加新的重大功能或模块(结构性变动)
+ - 添加新的公共组件到 `src/components`
+ - 添加新的工具函数到 `src/lib`
+ - 不要创建 `IMPLEMENTATION_SUMMARY.md`, `CHANGELOG.md` 等总结性文档,除非用户明确要求。
+
+# 注意事项
+
+1. 目前项目正在从 ant-design 迁移到 shadcnui,之前使用 ant-design 的地方,碰到就改一下,然后新做的功能,都使用 shadcnui开发页面。
+
+# Tailwind CSS v4 语法规范
+
+项目使用 **Tailwind CSS v4**,引用 CSS 变量时必须使用新语法:
+
+```tsx
+// ✅ 正确写法(Tailwind CSS v4)
+<div className="bg-(--primary-color) text-(--text-color) border-(--border-color)" />
+
+// ❌ 错误写法(旧语法,会触发警告)
+<div className="bg-[var(--primary-color)] text-[var(--text-color)] border-[var(--border-color)]" />
+```
+
+**规则说明:**
+- 使用 `(--xxx)` 替代 `[var(--xxx)]`
+- 不需要 `var()` 包裹
+- 不需要方括号 `[]`
+- 适用于所有 Tailwind 属性:`bg-`, `text-`, `border-`, `ring-`, `shadow-` 等
+
+# 必须遵守
+
+1. **开发之前,先查阅 `src/lib/README.md` 文档**,确认是否已存在相同或类似的工具方法,避免重复造轮子。
+
+2. **在 `src/lib` 下添加新方法时,必须同步更新 `src/lib/README.md` 文档**。
+
+3. **开发组件之前,先查阅 `src/components/README.md` 文档**,确认是否已存在相同或类似的组件,避免重复开发。
+
+4. **在 `src/components` 下添加新组件时,必须同步更新 `src/components/README.md` 文档**。
+
+# 代码质量要求
+
+1. 尽量复用已有类型,不要写相同的重复类型。
+2. 一定要复用已有的组件,不能重复造轮子,先去 src/components 目录下找。
+3. 代码必须符合组件库的设计规范,不能随意更改样式。
+4. 代码必须符合 lint 规范,不能有 lint 错误。
+5. 代码必须符合 prettier 规范,不能有 prettier 错误。
+6. 代码必须符合 typescript 规范,不能有 typescript 错误。
+7. 代码必须符合最佳实践,不能有性能问题。
+8. 代码必须符合安全规范,不能有安全漏洞。
+9. 代码必须符合可维护性规范,不能有难以维护的代码。
+10. 代码必须符合可读性规范,不能有难以阅读的代码,代码注释要全。
+11. 页面顶部要有注释,包含组件名称、功能描述,其它信息就没必要了。
+12. 所有涉及到API的操作,必须加loading,最典型的案例,一个弹框,填一些表单,点击创建按钮调用API创建数据,这时按钮一定要loading。
+13. 所有涉及UI的开发,必须添加骨架屏loading状态,让用户体验更好。
+14. 项目中所有 oss url的资源,都要包一层 getOssUrl做兼容,代码:`/src/utils/oss.ts`。
+15. 一个文件别放太多代码,一个文件代码太多一定要拆出来,代码一定要易于扩展。
+16. 按钮必须加上样式:`cursor: pointer;`。
+
+# 目录规范
+
+一个页面要包含多个组件,只有这个页面用到的私有组件就放到这个页面的文件夹下面,如:
+
+- pages
+ - dashboard
+ - index.tsx
+ - components
+ - chart
+ - index.tsx
+ - stats
+ - index.tsx
+
+如果一个组件是多个页面公用的,就放到 src/components 目录下,如:
+- components
+ - button
+ - index.tsx
+ - modal
+ - index.tsx
+
+如果一个页面或者组件,功能比较多,需要跨多个组件共享状态,那么一定到创建要给store来管理组件的状态,如:
+- chat // chat组件或页面
+ -- components // chat 组件私有组件
+ - message-list
+ -- index.tsx
+ - message-input
+ -- index.tsx
+ -- index.tsx // chat 组件或页面主文件
+ -- chatStore // 存放 chat 相关的 store
+ - index.ts // chatStore 主文件
+ - chatStore.utils.ts // chatStore 工具函数
+ - chatStore.types.ts // chatStore 类型定义
+ - chatStore.constants.ts // chatStore 常量定义
+
+# store
+
+## 普通 store
+
+方法不需要写类型,只有属性写类型即可,然后方法写到 methods 里面。
+这样方法类型可以自动推断,然后也可以在内部使用 methods.fn() 互相调用,并且类型安全。
+
+```ts
+import lodash from 'lodash'
+import { create } from 'zustand'
+import { combine } from 'zustand/middleware'
+
+export interface IAccountStore {
+ ...
+}
+
+const store: IAccountStore = {
+ ...
+}
+
+function getStore() {
+ return lodash.cloneDeep(store)
+}
+
+// 视频发布所有组件的共享状态和方法
+export const useAccountStore = create(
+ combine(
+ {
+ ...getStore(),
+ },
+ (set, get) => {
+ const methods = {
+ ...
+ }
+ return methods
+ },
+ ),
+)
+```
+
+## 持久化 store
+
+可以用封装的工具函数来创建持久化store:
+
+/src/lib/store.ts
+
+用法:
+
+```ts
+import { createPersistStore } from '@/lib/store'
+
+export interface IUserStore {
+ ...
+}
+
+const state: IUserStore = {
+ ...
+}
+
+export const useUserStore = createPersistStore(
+ {
+ ...state,
+ },
+ (set, _get) => {
+ const methods = {
+ ...
+ }
+
+ return methods
+ },
+ {
+ name: 'User',
+ },
+)
+```
+
+注意事项,注意,持久化的store使用了的 indexedDB,读取数据是异步的,需要通过_hasHydrated 来同步
+
+```tsx
+const {
+ _hasHydrated,
+} = usePublishDialogStorageStore(
+ useShallow(state => ({
+ _hasHydrated: state._hasHydrated,
+ })),
+)
+
+useEffect(() => {
+ if (_hasHydrated) {
+ console.log('持久化数据同步完成')
+ }
+}, [_hasHydrated]);
+
+```
+
+## store 使用
+
+使用useShallow,用于优化
+
+
+```tsx
+const {
+ _hasHydrated,
+} = usePublishDialogStorageStore(
+ useShallow(state => ({
+ _hasHydrated: state._hasHydrated,
+ })),
+)
+
+```
+
+# 国际化
+
+页面上的所有文本必须做国际化处理。
+
+国际化目录 `/src/app/i18n`
+
+语法:
+
+```tsx
+function Chat() {
+ return (
+ <>
+ t('media.uploadFailed')
+ </>
+ )
+}
+```
+
+# SEO 元数据规范
+
+页面的 SEO 元数据必须使用 `getMetadata` 方法,**不要自己拼接 title**:
+
+```tsx
+import { getMetadata } from '@/utils/general'
+
+export async function generateMetadata({
+ params,
+}: {
+ params: Promise<{ lng: string }>
+}): Promise<Metadata> {
+ let { lng } = await params
+ if (!languages.includes(lng)) lng = fallbackLng
+ const { t } = await useTranslation(lng, 'namespace')
+
+ // ✅ 正确写法:使用 getMetadata,title 只传页面名称
+ return getMetadata(
+ {
+ title: t('page.title'), // 只传页面标题,不要拼接 "| AiToEarn"
+ description: t('page.description'),
+ keywords: 'keyword1, keyword2',
+ },
+ lng,
+ )
+
+ // ❌ 错误写法:自己拼接 title
+ // return {
+ // title: `${t('page.title')} | AiToEarn`,
+ // ...
+ // }
+}
+```
+
+**规则说明:**
+- `getMetadata` 方法内部会自动拼接 title 格式为 `{页面标题} —— AiToEarn`
+- 不需要手动添加 openGraph 和 twitter 的 title(除非有特殊需求)
+- 方法位置:`/src/utils/general.ts`
+
+# 页面跳转链接规范
+
+页面内部跳转链接**不需要指定语言前缀 `lng`**,系统会自动重定向到当前语言:
+
+```tsx
+// ✅ 正确写法:不需要语言前缀
+<Link href="/pricing">定价</Link>
+<a href="/accounts">账户</a>
+router.push('/tasks')
+
+// ❌ 错误写法:手动拼接语言前缀
+<Link href={`/${lng}/pricing`}>定价</Link>
+<a href={`/${lng}/accounts`}>账户</a>
+router.push(`/${lng}/tasks`)
+```
+
+**规则说明:**
+- 项目使用 Next.js 国际化路由,中间件会自动处理语言重定向
+- 直接使用不带语言前缀的路径即可,如 `/pricing`、`/accounts`
+- 系统会根据用户当前语言自动重定向到正确的路径
diff --git a/project/web/.claude/rules/documentation-rules.md b/project/web/.claude/rules/documentation-rules.md
new file mode 100644
index 00000000..777c9304
--- /dev/null
+++ b/project/web/.claude/rules/documentation-rules.md
@@ -0,0 +1,51 @@
+---
+paths: "*.md"
+---
+
+# Markdown 文档编写规则
+
+## 通用要求
+
+- 所有文档使用 Markdown 格式
+- 使用简洁、清晰的语言
+- 文档内容应保持最新
+- 避免拼写和语法错误
+- 使用中文作为主要语言
+
+## 目录结构
+
+- `README.md`: 项目根目录,提供项目概述
+- `docs/`: 存放详细文档
+ - `guide/`: 使用指南
+ - `api/`: API 文档
+ - `examples/`: 示例代码文档
+
+## README.md 内容规范
+
+- 项目名称和简短描述
+- 技术栈说明
+- 项目结构说明
+- 使用说明
+- 许可证信息
+
+## 版本记录规范
+
+- 使用 `CHANGELOG.md` 记录版本变更
+- 遵循语义化版本(Semantic Versioning)规范
+- 每个版本应包含: 新增功能、修复问题、破坏性变更
+
+## 文档内容组织
+
+- 从整体到局部,从简单到复杂
+- 重要信息放在前面
+- 相关内容应当放在一起
+- 使用小标题和列表增强可读性
+- 避免过长段落,保持内容简洁
+
+## 代码示例规范
+
+- 提供完整可运行的示例
+- 代码应当简洁且易于理解
+- 添加适当的注释解释关键部分
+- 说明代码的预期输出或行为
+- 更新示例以匹配最新 API
diff --git a/project/web/.claude/rules/error-handling-rules.md b/project/web/.claude/rules/error-handling-rules.md
new file mode 100644
index 00000000..51c037df
--- /dev/null
+++ b/project/web/.claude/rules/error-handling-rules.md
@@ -0,0 +1,36 @@
+---
+paths: "**/app/error.tsx"
+---
+
+# Next.js 14 错误处理规则
+
+## error.tsx 文件格式
+
+在 Next.js 14 中,使用 error.tsx 文件处理错误:
+
+```tsx
+'use client'
+
+export default function Error({
+ error,
+ reset,
+}: {
+ error: Error & { digest?: string }
+ reset: () => void
+}) {
+ return (
+ <div>
+ <h2>出错了!</h2>
+ <p>{error.message}</p>
+ <button onClick={reset}>重试</button>
+ </div>
+ )
+}
+```
+
+## 关键要点
+
+- error.tsx 必须是客户端组件(使用 `'use client'`)
+- 接收 `error` 和 `reset` 两个参数
+- `error` 对象可能包含 `digest` 属性用于错误追踪
+- `reset` 函数用于重新渲染错误边界内的内容
diff --git a/project/web/.claude/rules/general-guidelines.md b/project/web/.claude/rules/general-guidelines.md
new file mode 100644
index 00000000..2016c391
--- /dev/null
+++ b/project/web/.claude/rules/general-guidelines.md
@@ -0,0 +1,26 @@
+# Next.js 14 通用指南
+
+## 项目设置
+
+- 假设用户已经使用 Tailwind CSS 设置了 Next.js 项目。
+- 使用环境变量进行配置,遵循 Next.js 约定。
+
+## 性能优化
+
+- 在适当的地方实现性能优化,如:
+ - 代码分割
+ - 懒加载
+ - 并行数据获取
+- 利用 Next.js 14 的内置缓存和重新验证功能以获得最佳性能。
+
+## 可访问性
+
+- 确保所有组件和页面都具有可访问性,遵循 WCAG 指南。
+- 使用语义化 HTML 标签。
+- 提供适当的 ARIA 属性。
+
+## 代码质量
+
+- 提供清晰、简洁的注释,解释复杂的逻辑或设计决策。
+- 遵循 Next.js 14 最佳实践的文件结构和命名约定。
+- 保持代码模块化和可复用。
diff --git a/project/web/.claude/rules/metadata-rules.md b/project/web/.claude/rules/metadata-rules.md
new file mode 100644
index 00000000..bfa2dfb1
--- /dev/null
+++ b/project/web/.claude/rules/metadata-rules.md
@@ -0,0 +1,49 @@
+---
+paths: "**/app/**/*.tsx"
+---
+
+# Next.js 14 元数据规则
+
+## 元数据定义
+
+在 Next.js 14 页面组件中定义元数据用于 SEO 优化:
+
+```tsx
+import type { Metadata } from 'next'
+
+export const metadata: Metadata = {
+ title: 'Page Title',
+ description: 'Page description',
+}
+```
+
+## 动态元数据生成
+
+对于需要动态生成的元数据,使用 `generateMetadata` 函数:
+
+```tsx
+import type { Metadata } from 'next'
+
+export async function generateMetadata({
+ params,
+}: {
+ params: Promise<{ id: string }>
+}): Promise<Metadata> {
+ const { id } = await params
+
+ // 根据 params 获取数据
+ const data = await fetchData(id)
+
+ return {
+ title: data.title,
+ description: data.description,
+ }
+}
+```
+
+## 关键要点
+
+- 使用 Next.js 的 Metadata 类型确保类型安全
+- 静态元数据使用 `export const metadata`
+- 动态元数据使用 `generateMetadata` 函数
+- 元数据会自动注入到页面的 `<head>` 标签中
diff --git a/project/web/.claude/rules/nextjs-rules.md b/project/web/.claude/rules/nextjs-rules.md
new file mode 100644
index 00000000..c14e1020
--- /dev/null
+++ b/project/web/.claude/rules/nextjs-rules.md
@@ -0,0 +1,38 @@
+---
+paths: "**/app/**/*.*"
+---
+
+# Next.js 14 开发规则
+
+## App Router 规范
+
+- 使用 App Router: 所有组件应在 `app` 目录中创建,遵循 Next.js 14 约定。
+- 默认使用服务端组件: 仅在绝对需要交互性或客户端状态管理时才使用客户端组件。
+- 使用现代 TypeScript 语法: 为所有组件和函数使用当前的函数声明语法和正确的 TypeScript 类型。
+- 遵循响应式设计原则: 使用 Tailwind CSS 类确保在各种屏幕尺寸上的响应性。
+- 遵循基于组件的架构: 创建模块化、可复用的组件,与提供的设计部分保持一致。
+
+## 性能优化
+
+- 使用服务端组件和 `fetch` API 实现高效的数据获取,采用适当的缓存和重新验证策略。
+- 使用 Next.js 14 的元数据 API 进行 SEO 优化。
+- 使用 Next.js Image 组件进行优化的图像加载。
+- 使用环境变量进行配置,遵循 Next.js 约定。
+- 在适当的地方实现性能优化,如代码分割、懒加载和并行数据获取。
+
+## 错误处理和加载状态
+
+- 确保可访问性,使用适当的 ARIA 属性和语义化 HTML。
+- 使用错误边界和 error.tsx 文件实现错误处理。
+- 使用 loading.tsx 文件管理加载状态。
+
+## 路由和渲染
+
+- 在 App Router 中使用路由处理器 (route.ts) 处理 API 路由。
+- 在适当的时候使用 App Router 约定实现静态站点生成 (SSG) 和服务端渲染 (SSR)。
+- 利用 Next.js 14 的内置缓存和重新验证功能以获得最佳性能。
+
+## 通用规则
+
+- 假设用户已经使用 Tailwind CSS 设置了 Next.js 项目。
+- 确保所有组件和页面都具有可访问性,遵循 WCAG 指南。
diff --git a/project/web/.claude/rules/scss-rules.md b/project/web/.claude/rules/scss-rules.md
new file mode 100644
index 00000000..2d6dc54e
--- /dev/null
+++ b/project/web/.claude/rules/scss-rules.md
@@ -0,0 +1,140 @@
+---
+paths: "*.scss"
+---
+
+# SCSS 编写规范
+
+## CSS Modules 中的 :global() 语法
+
+### 问题: :global() 选择器不能使用 & 后缀
+
+在 CSS Modules 中使用 `:global()` 时,**不能** 使用 Sass 的 `&` 父选择器后缀语法。
+
+#### ❌ 错误写法
+
+```scss
+:global(.feedDetailModal_media_content) {
+ opacity: 0;
+ transition: opacity 0.3s ease;
+
+ // 错误: :global() 选择器不支持 & 后缀
+ &-loaded {
+ opacity: 1;
+ }
+}
+```
+
+**报错信息**:
+```
+SassError: Selector ":global(.feedDetailModal_media_content)" can't have a suffix
+```
+
+#### ✅ 正确写法
+
+将修饰符选择器单独声明:
+
+```scss
+:global(.feedDetailModal_media_content) {
+ opacity: 0;
+ transition: opacity 0.3s ease;
+}
+
+// 修饰符样式单独声明
+:global(.feedDetailModal_media_content-loaded) {
+ opacity: 1;
+}
+```
+
+### 替代方案: 使用嵌套 :global
+
+如果需要在同一个块中编写相关样式,可以这样:
+
+```scss
+.wrapper {
+ :global {
+ .feedDetailModal_media_content {
+ opacity: 0;
+ transition: opacity 0.3s ease;
+ }
+
+ .feedDetailModal_media_content-loaded {
+ opacity: 1;
+ }
+ }
+}
+```
+
+## BEM 命名规范(单下划线变体)
+
+项目采用 BEM 命名规范的单下划线变体:
+
+- **Block**: `.block`
+- **Element**: `.block_element`(使用单下划线)
+- **Modifier**: `.block_element-modifier`(使用短横线)
+
+### 示例
+
+```scss
+.feedCard {
+ :global {
+ .feedCard_header {
+ // Element 样式
+ }
+
+ .feedCard_header-active {
+ // Modifier 样式
+ }
+ }
+}
+```
+
+## 常见陷阱
+
+### 1. :global() 中不能使用 & 后缀
+
+如上所述,`:global(.className)` 形式的选择器不支持 Sass 的 `&` 语法。
+
+### 2. 嵌套 :global 块的选择器权重
+
+使用 `:global { }` 块时,内部选择器是全局的,但仍受外层选择器约束:
+
+```scss
+.wrapper {
+ :global {
+ .inner {
+ // 实际生成: .wrapper .inner
+ }
+ }
+}
+```
+
+### 3. 动态类名拼接
+
+在 React 中拼接类名时,确保使用模板字符串或 classnames 库:
+
+```tsx
+// 正确
+<div className={`feedDetailModal_media_content ${loaded ? 'feedDetailModal_media_content-loaded' : ''}`}>
+
+// 使用 classnames 库更清晰
+import cn from 'classnames'
+<div className={cn('feedDetailModal_media_content', {
+ 'feedDetailModal_media_content-loaded': loaded
+})}>
+```
+
+## CSS 变量使用
+
+样式中应使用项目定义的 CSS 变量:
+
+```scss
+.element {
+ color: var(--text-color);
+ background: var(--bg-color);
+ border-color: var(--border-color);
+}
+```
+
+参考文件:
+- `src/app/var.css` - CSS 变量定义
+- `src/app/styles/mixin.scss` - 公共 mixin
diff --git a/project/web/.claude/rules/styling-rules.md b/project/web/.claude/rules/styling-rules.md
new file mode 100644
index 00000000..3d23cf8f
--- /dev/null
+++ b/project/web/.claude/rules/styling-rules.md
@@ -0,0 +1,11 @@
+---
+paths: "**/*.tsx"
+---
+
+# Tailwind CSS 样式规则
+
+## 基本原则
+
+- 专门使用 Tailwind CSS 类进行样式设置。避免内联样式。
+- 使用 Tailwind 的响应式修饰符确保在各种屏幕尺寸上的适配性。
+- 遵循 Tailwind 的实用程序优先方法,保持一致的设计系统。
diff --git a/project/web/.claude/rules/typescript-rules.md b/project/web/.claude/rules/typescript-rules.md
new file mode 100644
index 00000000..ce8e2591
--- /dev/null
+++ b/project/web/.claude/rules/typescript-rules.md
@@ -0,0 +1,84 @@
+---
+paths: "**/*.tsx"
+---
+
+# TypeScript 代码生成规则
+
+## 基本原则
+
+- 始终使用 TypeScript 确保类型安全。提供适当的类型定义和接口。
+- 将组件实现为函数式组件,在需要状态管理时使用 hooks。
+- 提供清晰、简洁的注释,解释复杂的逻辑或设计决策。
+- 建议遵循与 Next.js 14 最佳实践一致的文件结构和命名约定。
+- 仅在创建客户端组件时使用 `'use client'` 指令。
+
+## 组件定义语法
+
+在 .tsx 文件中使用以下组件定义语法,让 TypeScript 推断返回类型:
+
+```tsx
+const ComponentName = () => {
+ // 组件逻辑
+};
+```
+
+## Props 定义
+
+使用接口定义 props:
+
+```tsx
+interface ComponentNameProps {
+ // Props 定义
+}
+
+const ComponentName = ({ prop1, prop2 }: ComponentNameProps) => {
+ // 组件逻辑
+};
+```
+
+## 导出规范
+
+### 命名导出
+
+.tsx 文件中的组件使用命名导出:
+
+```tsx
+export const ComponentName = () => {
+ // 组件逻辑
+};
+```
+
+### 默认导出
+
+页面组件在 .tsx 文件中使用默认导出:
+
+```tsx
+const Page = () => {
+ // 页面组件逻辑
+};
+
+export default Page;
+```
+
+## 显式类型标注
+
+如果需要显式类型标注,首选 `React.FC` 或 `React.ReactNode`:
+
+```tsx
+import React from 'react';
+
+const ComponentName: React.FC = () => {
+ // 组件逻辑
+};
+
+// 或者
+const ComponentName = (): React.ReactNode => {
+ // 组件逻辑
+};
+```
+
+## 类型推断原则
+
+- 定义 React 组件时,避免不必要的类型标注,尽可能让 TypeScript 推断类型。
+- 仅在必要时使用 `React.FC` 或 `React.ReactNode` 进行显式类型标注,避免使用 `JSX.Element`。
+- 编写简洁的组件定义,不要添加冗余的类型标注。
diff --git a/project/web/.claude/settings.local.json b/project/web/.claude/settings.local.json
new file mode 100644
index 00000000..99a0ae14
--- /dev/null
+++ b/project/web/.claude/settings.local.json
@@ -0,0 +1,10 @@
+{
+ "permissions": {
+ "allow": [
+ "Bash",
+ "Write",
+ "Edit",
+ "Read"
+ ]
+ }
+}
diff --git a/project/web/package.json b/project/web/package.json
index 4d30eb60..c2d8f637 100644
--- a/project/web/package.json
+++ b/project/web/package.json
@@ -36,6 +36,7 @@
"@radix-ui/react-dropdown-menu": "^2.1.16",
"@radix-ui/react-label": "^2.1.8",
"@radix-ui/react-popover": "^1.1.15",
+ "@radix-ui/react-scroll-area": "^1.2.10",
"@radix-ui/react-select": "^2.2.6",
"@radix-ui/react-slot": "^1.2.4",
"@radix-ui/react-tabs": "^1.1.13",
diff --git a/project/web/pnpm-lock.yaml b/project/web/pnpm-lock.yaml
index 6529c843..a7ec87da 100644
--- a/project/web/pnpm-lock.yaml
+++ b/project/web/pnpm-lock.yaml
@@ -62,6 +62,9 @@ importers:
'@radix-ui/react-popover':
specifier: ^1.1.15
+ '@radix-ui/react-scroll-area':
+ specifier: ^1.2.10
'@radix-ui/react-select':
specifier: ^2.2.6
@@ -1931,6 +1934,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-tAXIa1g3sM5CGpVT0uIbUx/U3Gs5N8T52IICuCtObaos1S8fzsrPXG5WObkQN3S6NVl6wKgPhAIiBGbWnvc97A==}
+ peerDependencies:
+ '@types/react': '*'
+ '@types/react-dom': '*'
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-I30RydO+bnn2PQztvo25tswPH+wFBjehVGtmagkU78yMdwTwVf12wnAOF+AeP8S2N8xD+5UPbGhkUfPyvT+mwQ==}
peerDependencies:
@@ -8377,6 +8393,23 @@ snapshots:
'@types/react': 18.3.23
'@types/react-dom': 18.3.7(@types/[email protected])
+ dependencies:
+ '@radix-ui/number': 1.1.1
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.1(@types/[email protected])([email protected])
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+ optionalDependencies:
+ '@types/react': 18.3.23
+ '@types/react-dom': 18.3.7(@types/[email protected])
+
dependencies:
'@radix-ui/number': 1.1.1
diff --git a/project/web/public/sitemap-0.xml b/project/web/public/sitemap-0.xml
index bac7e2a5..37e28a72 100644
--- a/project/web/public/sitemap-0.xml
+++ b/project/web/public/sitemap-0.xml
@@ -1,52 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
-<url><loc>https://aitoearn.ai/healthz</loc><lastmod>2025-12-18T10:26:51.048Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en</loc><lastmod>2025-12-17T16:35:41.143Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url>
-<url><loc>https://aitoearn.ai/en/websit/terms-of-service</loc><lastmod>2025-12-12T06:46:42.350Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/websit/privacy-policy</loc><lastmod>2025-12-12T06:46:42.349Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/websit/plugin-guide</loc><lastmod>2025-12-17T09:57:08.650Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/websit/extension-privacy-policy</loc><lastmod>2025-12-17T08:29:59.847Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/healthz</loc><lastmod>2025-12-19T09:19:51.550Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en</loc><lastmod>2025-12-18T11:52:18.735Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url>
+<url><loc>https://aitoearn.ai/en/websit/terms-of-service</loc><lastmod>2025-12-19T03:13:18.752Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/websit/privacy-policy</loc><lastmod>2025-12-19T03:13:47.800Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/websit/plugin-guide</loc><lastmod>2025-12-19T03:09:16.800Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/websit/extension-privacy-policy</loc><lastmod>2025-12-19T03:12:31.547Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/en/websit/data-protection-agreement</loc><lastmod>2025-12-12T06:46:42.348Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/websit/data-deletion</loc><lastmod>2025-12-12T06:46:42.348Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/tasks-history</loc><lastmod>2025-12-18T10:04:48.181Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/websit/data-deletion</loc><lastmod>2025-12-19T03:12:48.680Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/tasks-history</loc><lastmod>2025-12-19T02:55:09.033Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/en/tasks</loc><lastmod>2025-11-18T02:51:00.256Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/pricing</loc><lastmod>2025-12-17T09:57:08.643Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/pinterest</loc><lastmod>2025-12-17T09:57:08.642Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/pricing</loc><lastmod>2025-12-18T11:52:18.737Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/pinterest</loc><lastmod>2025-12-18T11:52:18.736Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/en/material</loc><lastmod>2025-11-18T02:51:00.224Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/interactiveNew</loc><lastmod>2025-12-17T09:57:08.631Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/interactive</loc><lastmod>2025-12-17T09:57:08.625Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/interactiveNew</loc><lastmod>2025-12-18T11:52:18.730Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/interactive</loc><lastmod>2025-12-18T11:52:18.725Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/en/hotContent</loc><lastmod>2025-11-18T02:51:00.185Z</lastmod><changefreq>daily</changefreq><priority>0.9</priority></url>
<url><loc>https://aitoearn.ai/en/dataStatistics</loc><lastmod>2025-11-18T02:51:00.115Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/data-monitoring</loc><lastmod>2025-12-18T10:04:48.178Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/chat/test</loc><lastmod>2025-12-17T16:17:11.228Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/data-monitoring</loc><lastmod>2025-12-18T11:52:18.722Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/chat/test</loc><lastmod>2025-12-18T11:52:18.720Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/en/cgmaterial</loc><lastmod>2025-11-18T02:51:00.099Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/auth/login</loc><lastmod>2025-12-17T12:40:50.846Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/en/auth/forgot-password</loc><lastmod>2025-12-17T12:40:45.463Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/auth/login</loc><lastmod>2025-12-18T11:52:18.715Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/en/auth/forgot-password</loc><lastmod>2025-12-18T11:52:18.710Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/en/aiRank</loc><lastmod>2025-11-18T02:51:00.092Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
<url><loc>https://aitoearn.ai/en/aiRank/aiRanking</loc><lastmod>2025-11-18T02:51:00.078Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
<url><loc>https://aitoearn.ai/en/accounts</loc><lastmod>2025-11-21T10:43:08.009Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/en/accounts/auth</loc><lastmod>2025-11-18T02:50:59.996Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN</loc><lastmod>2025-12-17T16:35:41.143Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/websit/terms-of-service</loc><lastmod>2025-12-12T06:46:42.350Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/websit/privacy-policy</loc><lastmod>2025-12-12T06:46:42.349Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/websit/plugin-guide</loc><lastmod>2025-12-17T09:57:08.650Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/websit/extension-privacy-policy</loc><lastmod>2025-12-17T08:29:59.847Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN</loc><lastmod>2025-12-18T11:52:18.735Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/websit/terms-of-service</loc><lastmod>2025-12-19T03:13:18.752Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/websit/privacy-policy</loc><lastmod>2025-12-19T03:13:47.800Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/websit/plugin-guide</loc><lastmod>2025-12-19T03:09:16.800Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/websit/extension-privacy-policy</loc><lastmod>2025-12-19T03:12:31.547Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/zh-CN/websit/data-protection-agreement</loc><lastmod>2025-12-12T06:46:42.348Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/websit/data-deletion</loc><lastmod>2025-12-12T06:46:42.348Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/tasks-history</loc><lastmod>2025-12-18T10:04:48.181Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/websit/data-deletion</loc><lastmod>2025-12-19T03:12:48.680Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/tasks-history</loc><lastmod>2025-12-19T02:55:09.033Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/zh-CN/tasks</loc><lastmod>2025-11-18T02:51:00.256Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/pricing</loc><lastmod>2025-12-17T09:57:08.643Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/pinterest</loc><lastmod>2025-12-17T09:57:08.642Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/pricing</loc><lastmod>2025-12-18T11:52:18.737Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/pinterest</loc><lastmod>2025-12-18T11:52:18.736Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/zh-CN/material</loc><lastmod>2025-11-18T02:51:00.224Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/interactiveNew</loc><lastmod>2025-12-17T09:57:08.631Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/interactive</loc><lastmod>2025-12-17T09:57:08.625Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/interactiveNew</loc><lastmod>2025-12-18T11:52:18.730Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/interactive</loc><lastmod>2025-12-18T11:52:18.725Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/zh-CN/hotContent</loc><lastmod>2025-11-18T02:51:00.185Z</lastmod><changefreq>daily</changefreq><priority>0.9</priority></url>
<url><loc>https://aitoearn.ai/zh-CN/dataStatistics</loc><lastmod>2025-11-18T02:51:00.115Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/data-monitoring</loc><lastmod>2025-12-18T10:04:48.178Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/chat/test</loc><lastmod>2025-12-17T16:17:11.228Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/data-monitoring</loc><lastmod>2025-12-18T11:52:18.722Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/chat/test</loc><lastmod>2025-12-18T11:52:18.720Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/zh-CN/cgmaterial</loc><lastmod>2025-11-18T02:51:00.099Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/auth/login</loc><lastmod>2025-12-17T12:40:50.846Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
-<url><loc>https://aitoearn.ai/zh-CN/auth/forgot-password</loc><lastmod>2025-12-17T12:40:45.463Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/auth/login</loc><lastmod>2025-12-18T11:52:18.715Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+<url><loc>https://aitoearn.ai/zh-CN/auth/forgot-password</loc><lastmod>2025-12-18T11:52:18.710Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://aitoearn.ai/zh-CN/aiRank</loc><lastmod>2025-11-18T02:51:00.092Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
<url><loc>https://aitoearn.ai/zh-CN/aiRank/aiRanking</loc><lastmod>2025-11-18T02:51:00.078Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
<url><loc>https://aitoearn.ai/zh-CN/accounts</loc><lastmod>2025-11-21T10:43:08.009Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
diff --git a/project/web/src/app/[lng]/accounts/accountCore.tsx b/project/web/src/app/[lng]/accounts/accountCore.tsx
index 61ae3c66..3a4fff60 100644
--- a/project/web/src/app/[lng]/accounts/accountCore.tsx
+++ b/project/web/src/app/[lng]/accounts/accountCore.tsx
@@ -7,10 +7,9 @@ import { useEffect, useState, useRef } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { driver } from 'driver.js'
import 'driver.js/dist/driver.css'
-import AccountSidebar from '@/app/[lng]/accounts/components/AccountSidebar/AccountSidebar'
+import AccountsTopNav from '@/app/[lng]/accounts/components/AccountsTopNav'
import AddAccountModal from '@/app/[lng]/accounts/components/AddAccountModal'
import CalendarTiming from '@/app/[lng]/accounts/components/CalendarTiming'
-import AllPlatIcon from '@/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon'
import { PlatType, AccountPlatInfoMap } from '@/app/config/platConfig'
import { AccountStatus } from '@/app/config/accountConfig'
import { useTransClient } from '@/app/i18n/client'
@@ -20,8 +19,6 @@ import type { IPublishDialogRef } from '@/components/PublishDialog'
import { useAccountStore } from '@/store/account'
import { useUserStore } from '@/store/user'
-import styles from './accounts.module.scss'
-
interface AccountPageCoreProps {
searchParams?: {
platform?: string
@@ -57,6 +54,7 @@ export default function AccountPageCore({
const [addAccountModalOpen, setAddAccountModalOpen] = useState(false)
const [targetPlatform, setTargetPlatform] = useState<PlatType | undefined>()
const [targetSpaceId, setTargetSpaceId] = useState<string | undefined>()
+
const { t } = useTransClient('account')
const userStore = useUserStore()
@@ -718,38 +716,26 @@ export default function AccountPageCore({
return (
<NoSSR>
- <div className={styles.accounts}>
- <AccountSidebar
- activeAccountId={accountActive?.id || ''}
- onAccountChange={(account) => {
- setAccountActive(account)
+ <div className="flex flex-col h-screen bg-background">
+ {/* Row 1: 顶部导航栏 */}
+ <AccountsTopNav
+ onNewWork={() => {
+ // 检查是否有可用账户
+ const hasAccounts = allAccounts.some(
+ account => account.status === AccountStatus.USABLE
+ )
+
+ if (!hasAccounts) {
+ // 没有可用账户时的逻辑可以保留原来的
+ setPublishDialogOpen(true)
+ } else {
+ setPublishDialogOpen(true)
+ }
}}
- sidebarTopExtra={(
- <>
- <div
- className={[
- 'accountList-item',
- `${!accountActive?.id ? 'accountList-item--active' : ''}`,
- ].join(' ')}
- style={{
- border: '1px solid #d9d9d9',
- borderRight: 'none',
- borderLeft: 'none',
- }}
- onClick={async () => {
- setAccountActive(undefined)
- }}
- >
- <AllPlatIcon size={38} />
- <div className="accountList-item-right">
- <div className="accountList-item-right-name">
- {t('allPlatforms')}
- </div>
- </div>
- </div>
- </>
- )}
+ onAddAccount={() => setAddAccountModalOpen(true)}
/>
+
+ {/* 主内容区域: CalendarTiming (包含 Row 2 工具栏和日历/列表视图) */}
<CalendarTiming />
{/* 添加账号弹窗 */}
@@ -765,34 +751,42 @@ export default function AccountPageCore({
{/* 微信浏览器提示(遮罩 + 箭头指向右上角) */}
{showWechatBrowserTip && (
<>
- <div className={styles.mobileDownloadOverlay} onClick={closeWechatBrowserTip} />
- <Image src={rightArrow} alt="rightArrow" width={120} height={120} className={styles.rightArrow} />
- <div className={styles.wechatTipContainer}>
- <div className={styles.wechatTipContent}>
- <div className={styles.wechatTipTitle}>{wechatBrowserTexts.title}</div>
- <div className={styles.wechatTipSteps}>
- <div className={styles.wechatTipStep}>
- <span className={styles.stepNumber}>1</span>
- <span className={styles.stepText}>
+ <div className="fixed inset-0 bg-black/85 z-[1000] animate-[fadeIn_0.2s_ease-out]" onClick={closeWechatBrowserTip} />
+ <Image
+ src={rightArrow}
+ alt="rightArrow"
+ width={120}
+ height={120}
+ className="fixed top-[10%] right-5 z-[1002] pointer-events-none bg-accent animate-[arrowPulse_2s_ease-in-out_infinite] rounded-full p-2.5"
+ />
+ <div className="fixed inset-0 z-[1001] flex items-center justify-center pointer-events-none">
+ <div className="bg-background/95 rounded-2xl p-6 mx-5 max-w-[320px] shadow-[0_10px_40px_rgba(0,0,0,0.3)] backdrop-blur-[10px] pointer-events-auto animate-[tipFadeIn_0.3s_ease-out]">
+ <div className="text-lg font-bold text-foreground text-center mb-5">{wechatBrowserTexts.title}</div>
+ <div className="mb-5">
+ <div className="flex items-center gap-3 mb-3 text-sm text-foreground leading-normal">
+ <span className="bg-primary text-primary-foreground w-6 h-6 rounded-full flex items-center justify-center text-xs font-semibold flex-shrink-0">1</span>
+ <span className="flex-1">
{t('wechatBrowserTip.clickCorner')}
- <span className={styles.dotsButton}>⋯</span>
+ <span className="bg-muted text-muted-foreground px-2 py-0.5 rounded text-xs mx-1 inline-block">⋯</span>
{t('wechatBrowserTip.dotsButton')}
</span>
</div>
- <div className={styles.wechatTipStep}>
- <span className={styles.stepNumber}>2</span>
- <span className={styles.stepText}>
+ <div className="flex items-center gap-3 mb-3 text-sm text-foreground leading-normal">
+ <span className="bg-primary text-primary-foreground w-6 h-6 rounded-full flex items-center justify-center text-xs font-semibold flex-shrink-0">2</span>
+ <span className="flex-1">
{t('wechatBrowserTip.selectBrowser')}
- <span className={styles.browserButton}>🌐</span>
+ <span className="bg-muted text-muted-foreground px-1.5 py-0.5 rounded text-xs mx-1 inline-block">🌐</span>
{t('wechatBrowserTip.openInBrowser')}
</span>
</div>
</div>
- <button className={styles.wechatTipClose} onClick={closeWechatBrowserTip}>
+ <button
+ className="w-full bg-primary text-primary-foreground border-none px-3 py-3 rounded-lg font-semibold cursor-pointer transition-all hover:bg-primary/90"
+ onClick={closeWechatBrowserTip}
+ >
{wechatBrowserTexts.cta}
</button>
</div>
-
</div>
</>
)}
@@ -800,24 +794,28 @@ export default function AccountPageCore({
{/* 移动端下载提示(遮罩 + 底部弹窗) */}
{showMobileDownload && (
<>
- <div className={styles.mobileDownloadOverlay} />
- <div className={styles.mobileDownloadSheet} role="dialog" aria-modal="true">
- <div className={styles.sheetHeader}>
- <div className={styles.sheetTitle}>
+ <div className="fixed inset-0 bg-black/85 z-[1000] animate-[fadeIn_0.2s_ease-out]" />
+ <div className="fixed left-0 right-0 bottom-0 bg-background rounded-t-2xl shadow-[0_-10px_40px_rgba(0,0,0,0.2)] z-[1001] animate-[slideUp_0.25s_ease-out] p-4 pb-5" role="dialog" aria-modal="true">
+ <div className="flex items-center justify-between gap-2">
+ <div className="text-lg font-bold text-foreground">
{downloadTexts.title}
{' '}
👋
</div>
- <button className={styles.sheetClose} aria-label="Close" onClick={closeMobileDownload}>
+ <button
+ className="bg-transparent border-none text-[22px] text-muted-foreground cursor-pointer px-2 py-1 rounded-md transition-all hover:bg-accent"
+ aria-label="Close"
+ onClick={closeMobileDownload}
+ >
×
</button>
</div>
- <div className={styles.sheetBody}>
- <p className={styles.sheetDesc}>{downloadTexts.desc}</p>
+ <div className="py-3 px-1">
+ <p className="m-0 text-sm text-muted-foreground leading-relaxed">{downloadTexts.desc}</p>
</div>
- <div className={styles.sheetFooter}>
+ <div className="pt-3 flex justify-center">
<a
- className={styles.sheetCta}
+ className="inline-block bg-primary text-primary-foreground no-underline px-[18px] py-2.5 rounded-lg font-semibold shadow-[0_6px_18px_rgba(79,70,229,0.35)]"
href={getDownloadHref()}
target="_blank"
rel="noopener noreferrer"
diff --git a/project/web/src/app/[lng]/accounts/accounts.module.scss b/project/web/src/app/[lng]/accounts/accounts.module.scss
deleted file mode 100644
index cfebf427..00000000
--- a/project/web/src/app/[lng]/accounts/accounts.module.scss
+++ /dev/null
@@ -1,241 +0,0 @@
-.accounts {
- display: flex;
- height: 100%;
- min-height: 0;
- overflow: auto;
-}
-
-// 移动端下载提示:遮罩
-.mobileDownloadOverlay {
- position: fixed;
- inset: 0;
- background: rgba(0, 0, 0, 0.85);
- z-index: 1000;
- animation: fadeIn 0.2s ease-out;
-}
-
-// 移动端下载提示:底部弹窗
-.mobileDownloadSheet {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- background: #fff;
- border-radius: 16px 16px 0 0;
- box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
- z-index: 1001;
- animation: slideUp 0.25s ease-out;
- padding: 16px 16px 20px;
-}
-
-.sheetHeader {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 8px;
-}
-
-.sheetTitle {
- font-size: 18px;
- font-weight: 700;
- color: #111827;
-}
-
-.sheetClose {
- background: transparent;
- border: none;
- font-size: 22px;
- color: #6b7280;
- cursor: pointer;
- padding: 4px 8px;
- border-radius: 6px;
- transition: background 0.2s ease;
-
- &:hover {
- background: #f3f4f6;
- }
-}
-
-.sheetBody {
- padding: 12px 4px 4px;
-}
-
-.sheetDesc {
- margin: 0;
- color: #4b5563;
- font-size: 14px;
- line-height: 1.6;
-}
-
-.sheetFooter {
- padding-top: 12px;
- display: flex;
- justify-content: center;
-}
-
-.sheetCta {
- display: inline-block;
- background: #4f46e5;
- color: #fff;
- text-decoration: none;
- padding: 10px 18px;
- border-radius: 8px;
- font-weight: 600;
- box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
-}
-
-@keyframes slideUp {
- from {
- transform: translateY(20px);
- opacity: 0.6;
- }
- to {
- transform: translateY(0);
- opacity: 1;
- }
-}
-
-@keyframes fadeIn {
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
-}
-
-// 微信浏览器提示:容器
-.wechatTipContainer {
- position: fixed;
- inset: 0;
- z-index: 1001;
- display: flex;
- align-items: center;
- justify-content: center;
- pointer-events: none;
-}
-
-// 微信浏览器提示:内容区域
-.wechatTipContent {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 16px;
- padding: 24px;
- margin: 20px;
- max-width: 320px;
- box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
- backdrop-filter: blur(10px);
- pointer-events: auto;
- animation: tipFadeIn 0.3s ease-out;
-}
-
-.wechatTipTitle {
- font-size: 18px;
- font-weight: 700;
- color: #111827;
- text-align: center;
- margin-bottom: 20px;
-}
-
-.wechatTipSteps {
- margin-bottom: 20px;
-}
-
-.wechatTipStep {
- display: flex;
- align-items: center;
- gap: 12px;
- margin-bottom: 12px;
- font-size: 14px;
- color: #374151;
- line-height: 1.5;
-}
-
-.stepNumber {
- background: #4f46e5;
- color: white;
- width: 24px;
- height: 24px;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 12px;
- font-weight: 600;
- flex-shrink: 0;
-}
-
-.stepText {
- flex: 1;
-}
-
-.dotsButton {
- background: #374151;
- color: white;
- padding: 2px 8px;
- border-radius: 4px;
- font-size: 12px;
- margin: 0 4px;
- display: inline-block;
-}
-
-.browserButton {
- background: #374151;
- color: white;
- padding: 2px 6px;
- border-radius: 4px;
- font-size: 12px;
- margin: 0 4px;
- display: inline-block;
-}
-
-.wechatTipClose {
- width: 100%;
- background: #4f46e5;
- color: white;
- border: none;
- padding: 12px;
- border-radius: 8px;
- font-weight: 600;
- cursor: pointer;
- transition: background 0.2s ease;
-
- &:hover {
- background: #4338ca;
- }
-}
-
-// 微信浏览器提示:箭头指向右上角
-.rightArrow {
- position: fixed;
- top: 10%;
- right: 20px;
- z-index: 1002;
- pointer-events: none;
- background-color: #e9f6ff;
- animation: arrowPulse 2s ease-in-out infinite;
- border-radius: 50%;
- padding: 10px;
-}
-
-@keyframes arrowPulse {
- 0%,
- 100% {
- opacity: 0.8;
- transform: translateY(-50%) scale(1);
- }
- 50% {
- opacity: 1;
- transform: translateY(-50%) scale(1.1);
- }
-}
-
-@keyframes tipFadeIn {
- from {
- opacity: 0;
- transform: scale(0.9);
- }
- to {
- opacity: 1;
- transform: scale(1);
- }
-}
diff --git a/project/web/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss b/project/web/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
deleted file mode 100644
index cc218be3..00000000
--- a/project/web/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
+++ /dev/null
@@ -1,588 +0,0 @@
-.accountSidebar {
- border-right: 1px solid var(--grayColor3);
- width: 200px;
- height: 100%;
- min-height: 0;
- flex-shrink: 0;
- display: flex;
- flex-direction: column;
-
- p {
- margin: 0;
- }
-
- :global {
- .accountSidebar-content {
- height: 100%;
- display: flex;
- flex-direction: column;
- min-height: 0;
- overflow-y: auto;
- }
-
- .ant-collapse {
- height: 100%;
- }
-
- .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;
- color: var(--grayColor6);
- }
-
- .accountSidebar-groupLabel {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 8px;
- width: 100%;
- position: relative;
- }
-
- .accountSidebar-groupSort {
- position: absolute;
- right: -15px;
- top: 50%;
- transform: translateY(-50%);
- opacity: 0;
- transition: opacity 0.2s;
- display: flex;
- flex-direction: column;
- gap: 2px;
- }
-
- .accountSidebar-groupLabel:hover .accountSidebar-groupSort {
- opacity: 1;
- }
-
- .accountSidebar-ipType {
- display: inline-block;
- background-color: var(--grayColor2);
- color: #8a5bf2;
- padding: 1px 2px;
- border-radius: 4px;
- font-size: 10px;
- font-weight: 500;
- margin-right: 4px;
- }
-
- .accountSidebar-ipType[data-type='direct'] {
- background-color: #e6f7ff;
- color: #1890ff;
- // border: 1px solid #91d5ff;
- }
-
- .accountSidebar-ipType[data-type='proxy'] {
- background-color: #fff7e6;
- color: #fa8c16;
- // border: 1px solid #ffd591;
- }
-
- .accountSidebar-groupName {
- font-weight: 500;
- }
-
- .accountSidebar-ipInfo {
- font-size: var(--fs-xs);
- color: var(--grayColor6);
- max-width: 130px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .accountSidebar-ipLoading {
- color: var(--colorPrimary5);
- font-style: italic;
- }
-
- .accountSidebar-ipText {
- cursor: help;
- padding: 2px 6px;
- background: var(--grayColor2);
- border-radius: 4px;
- transition: all 0.2s ease;
-
- &:hover {
- background: var(--grayColor3);
- color: var(--grayColor7);
- }
- }
-
- .accountSidebar-ipError {
- color: var(--errorColor);
- font-style: italic;
- }
-
- .accountSidebar-top {
- flex-shrink: 0;
- padding: 0 10px;
- button {
- width: 100%;
- }
- &-box {
- display: flex;
- margin: 10px 0;
- }
- &-addUser {
- margin-left: 10px;
- width: 60px !important;
- }
- }
-
- .accountSidebar-footer {
- padding: 10px;
- border-top: 1px solid var(--grayColor3);
- text-align: center;
- }
-
- .accountList {
- width: 100%;
- height: 100%;
- min-width: 0;
- display: flex;
- flex-direction: column;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: auto;
- &-item {
- width: 100%;
- min-width: 0;
- display: flex;
- align-items: center;
- padding: 10px 15px;
- box-sizing: border-box;
- cursor: pointer;
- background: #fff;
- transition: 0.3s;
- color: #333;
- position: relative;
-
- .accountList-item-dragHandle {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 20px;
- height: 20px;
- margin-right: 8px;
- cursor: grab;
- color: var(--grayColor5);
- opacity: 0;
- transition: opacity 0.2s;
- flex-shrink: 0;
-
- &:active {
- cursor: grabbing;
- }
-
- &:hover {
- color: var(--grayColor7);
- }
- }
-
- &:hover .accountList-item-dragHandle {
- opacity: 1;
- }
-
- &--dragging {
- transform: rotate(5deg);
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
- z-index: 1000;
- }
- .ant-avatar {
- flex-shrink: 0;
- }
- &-right {
- margin-left: 10px;
- box-sizing: border-box;
- width: 100%;
- overflow: hidden;
- &-name {
- text-align: left;
- margin-bottom: 5px;
- font-size: var(--fs-sm);
- overflow: hidden;
- text-overflow: ellipsis;
- }
- &-footer {
- display: flex;
- justify-content: space-between;
- font-size: var(--fs-sm);
- }
- &-plat {
- display: flex;
- align-items: center;
- img {
- width: 15px;
- margin-right: 5px;
- }
- span {
- font-size: var(--fs-xs);
- }
- }
- }
-
- &:hover {
- color: var(--colorPrimary5);
- background: var(--colorPrimary1);
- }
-
- &--active {
- background: var(--colorPrimary1);
- }
-
- &--abnormal {
- color: red !important;
- }
-
- &--disable {
- filter: grayscale(100%) !important;
- opacity: 0.5 !important;
- }
-
- &--mobile-only {
- position: relative;
- filter: grayscale(100%) !important;
- opacity: 0.6 !important;
- }
- }
- }
-
- .accountList-item-overlay {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.3);
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 10;
- cursor: pointer;
-
- &-text {
- color: white;
- font-size: 12px;
- font-weight: 500;
- text-align: center;
- background: rgba(0, 0, 0, 0.6);
- padding: 4px 8px;
- border-radius: 4px;
- white-space: nowrap;
- }
- }
-
- .ant-collapse {
- border: none;
- background: transparent;
- .ant-collapse-content-box {
- padding: 0 !important;
- }
- .ant-collapse-header {
- background: transparent;
- padding: 10px;
- }
- }
- }
-}
-
-.accountPopoverInfo {
- padding: 10px;
- width: 250px;
- :global {
- .accountPopoverInfo_top {
- display: flex;
- font-size: var(--fs-sm);
- padding: 5px 0 10px 0;
- border-bottom: 1px solid #dedede;
- margin-bottom: 15px;
- color: var(--grayColor7);
- &-right {
- margin-left: 10px;
- }
- }
- .accountPopoverInfo-item {
- display: flex;
- align-items: center;
- margin-bottom: 5px;
- p {
- display: flex;
- align-items: center;
- &:nth-of-type(1) {
- color: var(--grayColor7);
- }
- img {
- width: 15px;
- margin-right: 5px;
- }
-
- .anticon {
- margin-right: 3px;
- }
- }
- }
-
- // 客户端来源标签样式
- .accountPopoverInfo-clientType {
- display: inline-block;
- padding: 2px 8px;
- border-radius: 4px;
- font-size: 12px;
- font-weight: 500;
-
- // Web 来源标签 - 蓝色调
- &[data-type='web'] {
- background-color: #e6f7ff;
- color: #1890ff;
- border: 1px solid #91d5ff;
- }
-
- // App/Flutter 来源标签 - 绿色调
- &[data-type='app'] {
- background-color: #f6ffed;
- color: #52c41a;
- border: 1px solid #b7eb8f;
- }
- }
- }
-}
-
-.userManageDeleteHitModal {
- .userManageDeleteHitModal-users {
- display: grid;
- gap: 15px;
- grid-template-columns: repeat(7, 1fr);
- margin-top: 10px;
- li {
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- white-space: nowrap;
- & > span {
- text-overflow: ellipsis;
- display: block;
- margin-top: 5px;
- overflow: hidden;
- width: 100%;
- text-align: center;
- font-size: var(--fs-xs);
- color: var(--grayColor9);
- }
- }
- }
-}
-.userManageModal {
- :global {
- .ant-modal-header {
- margin-bottom: 0;
- }
- .ant-modal-content {
- padding: 0 !important;
- .ant-modal-title {
- padding: 15px;
- border-bottom: 1px solid var(--grayColor3);
- }
- }
- }
-}
-.userManage {
- display: flex;
- min-width: 0;
- height: 500px;
- :global {
- display: flex;
- flex-direction: column;
- min-height: 0;
- height: 100%;
- max-height: none !important;
-
- .ant-table-cell {
- padding: 10px !important;
- }
-
- .userManage-sidebar {
- width: 200px;
- height: 100%;
- border-right: 1px solid var(--grayColor3);
- flex-shrink: 0;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- box-sizing: border-box;
- padding-top: 10px;
- &-top {
- display: flex;
- flex-direction: column;
- min-height: 0;
- }
- &-bottom {
- padding: 0 12px;
- margin-bottom: 15px;
- button {
- width: 100%;
- }
- }
- &-allUser,
- .userManage-sidebar-list-item {
- display: flex;
- justify-content: space-between;
- padding-right: 10px;
- padding-left: 10px;
- background: transparent;
- &:hover {
- background: var(--colorPrimary2);
- cursor: pointer;
- }
- }
- &-allUser {
- padding-top: 5px;
- padding-bottom: 5px;
- }
- &-sortHandle {
- cursor: move;
- margin-right: 10px;
- }
- &-left {
- display: flex;
- align-items: center;
- flex: 1;
- min-width: 0;
- }
- &-name {
- font-weight: 500;
- }
- &-count {
- color: var(--grayColor8);
- }
- &-list {
- display: flex;
- flex-direction: column;
- min-height: 0;
- height: 100%;
-
- &-title {
- margin: 10px 0 10px 10px;
- font-size: var(--fs-xs);
- color: var(--grayColor8);
- }
-
- &-item {
- padding-top: 10px;
- padding-bottom: 10px;
- }
-
- &-sortable {
- height: 100%;
- overflow: auto;
- padding-bottom: 15px;
- }
- }
- &--active {
- background: var(--colorPrimary2) !important;
- }
- }
-
- .userManage-content {
- width: 100%;
- overflow: hidden;
- position: relative;
- padding: 10px;
- display: flex;
- flex-direction: column;
-
- &-head {
- display: flex;
- justify-content: space-between;
- margin-bottom: 10px;
- &-proxy {
- }
- }
-
- .ant-drawer-header {
- height: 40px;
- .ant-drawer-close {
- position: absolute;
- right: 10px;
- }
- }
-
- .ant-drawer-content-wrapper {
- border: 1px solid var(--grayColor3);
- border-radius: 20px 20px 0 0;
- overflow: hidden;
- .ant-drawer-content {
- }
- .ant-drawer-body {
- overflow: hidden;
- }
- }
-
- &-multiple {
- display: flex;
- gap: 40px;
- justify-content: center;
- &-item {
- cursor: pointer;
- display: flex;
- flex-direction: column;
- align-items: center;
- &-icon {
- background: var(--grayColor1);
- width: 36px;
- height: 36px;
- font-size: var(--fs-md);
- border-radius: 50%;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-bottom: 5px;
- }
- &:hover {
- opacity: 0.6;
- }
- }
- }
-
- &-user {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- display: flex;
- align-items: center;
- &-name {
- margin-left: 15px;
- }
- &--disable {
- filter: grayscale(100%);
- opacity: 0.5;
- }
- .ant-avatar {
- margin-right: 5px;
- }
- }
- }
- }
-}
-
-.createGroup {
- display: flex;
- align-items: center;
- margin: 30px 0 50px 0;
- label {
- white-space: nowrap;
- margin-right: 10px;
- }
-}
diff --git a/project/web/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx b/project/web/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
deleted file mode 100644
index 69713e86..00000000
--- a/project/web/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
+++ /dev/null
@@ -1,1137 +0,0 @@
-import type {
- ForwardedRef,
-} from 'react'
-import type { IMCPManagerModalRef } from './MCPManagerModal'
-import type { IUserManageModalRef } from './UserManageModal'
-import type { SocialAccount } from '@/api/types/account.type'
-import { ClientType } from '@/app/[lng]/accounts/accounts.enums'
-import type {
- IpLocationInfo,
-} from '@/utils/ipLocation'
-
-// import { accountLogin, acpAccountLoginCheck } from "@/icp/account";
-import {
- CheckCircleOutlined,
- DeleteOutlined,
- DownOutlined,
- DragOutlined,
- PlusOutlined,
- UpOutlined,
- UserOutlined,
- WarningOutlined,
-} from '@ant-design/icons'
-import { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd'
-import {
- Avatar,
- Button,
- Collapse,
- Input,
- Modal,
- Popover,
- Skeleton,
- Tooltip,
-} from 'antd'
-import { toast } from '@/lib/toast'
-import Image from 'next/image'
-import {
- forwardRef,
- memo,
- useCallback,
- useEffect,
- useMemo,
- useRef,
- useState,
-} from 'react'
-import { useShallow } from 'zustand/react/shallow'
-import { createAccountGroupApi, updateAccountApi } from '@/api/account'
-import { apiUpdateAccountGroupSortRank, apiUpdateAccountSortRank } from '@/api/accountSort'
-import { bilibiliSkip } from '@/app/[lng]/accounts/plat/BilibiliLogin'
-import { FacebookPagesModal, facebookSkip } from '@/app/[lng]/accounts/plat/FacebookLogin'
-import { instagramSkip } from '@/app/[lng]/accounts/plat/InstagramLogin'
-// 导入各平台授权函数
-import { kwaiSkip } from '@/app/[lng]/accounts/plat/kwaiLogin'
-import { linkedinSkip } from '@/app/[lng]/accounts/plat/LinkedinLogin'
-import { pinterestSkip } from '@/app/[lng]/accounts/plat/PinterestLogin'
-import { threadsSkip } from '@/app/[lng]/accounts/plat/ThreadsLogin'
-import { tiktokSkip } from '@/app/[lng]/accounts/plat/TiktokLogin'
-import { twitterSkip } from '@/app/[lng]/accounts/plat/TwtterLogin'
-import { wxGzhSkip } from '@/app/[lng]/accounts/plat/WxGzh'
-import { youtubeSkip } from '@/app/[lng]/accounts/plat/YoutubeLogin'
-import { AccountStatus } from '@/app/config/accountConfig'
-import { AccountPlatInfoMap, PlatType } from '@/app/config/platConfig'
-import { useTransClient } from '@/app/i18n/client'
-import DownloadAppModal from '@/components/common/DownloadAppModal'
-import { useAccountStore } from '@/store/account'
-import {
- extractCountry,
- formatLocationInfo,
- getIpLocation,
-} from '@/utils/ipLocation'
-import { getOssUrl } from '@/utils/oss'
-import AddAccountModal from '../AddAccountModal'
-import styles from './AccountSidebar.module.scss'
-import DeleteUserConfirmModal from './DeleteUserConfirmModal'
-import MCPManagerModal from './MCPManagerModal'
-import UserManageModal from './UserManageModal'
-
-// 六点拖拽图标组件
-function SixDotsIcon() {
- return (
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none">
- <circle cx="2" cy="2" r="1" fill="currentColor" />
- <circle cx="6" cy="2" r="1" fill="currentColor" />
- <circle cx="10" cy="2" r="1" fill="currentColor" />
- <circle cx="2" cy="6" r="1" fill="currentColor" />
- <circle cx="6" cy="6" r="1" fill="currentColor" />
- <circle cx="10" cy="6" r="1" fill="currentColor" />
- </svg>
- )
-}
-
-export interface IAccountSidebarRef {}
-
-export interface IAccountSidebarProps {
- // 选择的账户id
- activeAccountId: string
- // 切换选择的账户
- onAccountChange: (info: SocialAccount) => void
- // 排除的平台类型
- excludePlatforms?: PlatType[]
- // 侧边栏内容顶部扩展内容
- sidebarTopExtra?: React.ReactNode
- // 是否在interactive页面(用于应用特殊的平台过滤和蒙层效果)
- isInteractivePage?: boolean
-}
-
-function AccountStatusView({ account }: { account: SocialAccount }) {
- const { t } = useTransClient('account')
- if (account.status === AccountStatus.USABLE) {
- return (
- <>
- <CheckCircleOutlined style={{ color: 'var(--successColor)' }} />
- {t('online')}
- </>
- )
- }
-
- return (
- <>
- <WarningOutlined style={{ color: 'var(--warningColor)' }} />
- {t('offline')}
- </>
- )
-}
-
-function AccountPopoverInfo({
- accountInfo,
- onDeleteClick,
-}: {
- accountInfo: SocialAccount
- onDeleteClick?: (account: SocialAccount) => void
-}) {
- const { t } = useTransClient('account')
- const platInfo = AccountPlatInfoMap.get(accountInfo.type)!
- const [detLoading, setDetLoading] = useState(false)
-
- /**
- * 根据 clientType 获取显示的标签文本
- * @param clientType 客户端类型(web/app)
- * @returns 标签显示文本
- */
- const getClientTypeLabel = (clientType?: ClientType) => {
- if (!clientType) return null
- if (clientType === ClientType.WEB) {
- return t('clientType.web' as any)
- }
- if (clientType === ClientType.APP) {
- return t('clientType.app' as any)
- }
- return null
- }
-
- return (
- <div
- className={styles.accountPopoverInfo}
- onClick={e => e.stopPropagation()}
- >
- <div className="accountPopoverInfo_top">
- <Avatar src={getOssUrl(accountInfo.avatar)} size="large" />
- <div className="accountPopoverInfo_top-right">
- <div className="accountPopoverInfo-item">
- <p>
- {t('nickname')}
- :
- </p>
- <p>{accountInfo.nickname}</p>
- </div>
- {/* <div className="accountPopoverInfo-item">
- <p>{t("platform")}:</p>
- <p>
- <img src={platInfo?.icon} />
- {platInfo.name}
- </p>
- </div> */}
- <div className="accountPopoverInfo-item">
- <p>
- {t('fansCount')}
- :
- </p>
- <p>{accountInfo.fansCount ?? 0}</p>
- </div>
- </div>
- </div>
-
- <div className="accountPopoverInfo-item">
- <p>
- {t('loginStatus')}
- :
- </p>
- <p>
- <AccountStatusView account={accountInfo} />
-
- <Button
- type="primary"
- danger
- ghost
- size="small"
- icon={<DeleteOutlined />}
- style={{ marginLeft: 18, border: 'none' }}
- onClick={() => onDeleteClick?.(accountInfo)}
- >
- {t('deleteAccount' as any)}
- </Button>
- </p>
- </div>
-
- {/* 客户端来源标签(web/flutter app),为空不显示 */}
- {accountInfo.clientType && (
- <div className="accountPopoverInfo-item">
- <p>
- {t('clientType.label' as any)}
- :
- </p>
- <p>
- <span
- className="accountPopoverInfo-clientType"
- data-type={accountInfo.clientType}
- >
- {getClientTypeLabel(accountInfo.clientType)}
- </span>
- </p>
- </div>
- )}
- </div>
- )
-}
-
-const AccountSidebar = memo(
- forwardRef(
- (
- {
- activeAccountId,
- onAccountChange,
- excludePlatforms = [],
- sidebarTopExtra,
- isInteractivePage = false,
- }: IAccountSidebarProps,
- ref: ForwardedRef<IAccountSidebarRef>,
- ) => {
- const { t } = useTransClient('account')
- const pubAccountDetModuleRef = useRef<any>(null)
- const {
- accountList: fullAccountList,
- getAccountList,
- getAccountGroup,
- accountGroupList,
- accountLoading,
- } = useAccountStore(
- useShallow(state => ({
- accountList: state.accountList,
- getAccountList: state.getAccountList,
- getAccountGroup: state.getAccountGroup,
- accountGroupList: state.accountGroupList,
- accountLoading: state.accountLoading,
- })),
- )
- const [userManageModalOpen, setUserManageModalOpen] = useState(false)
- const userManageModalRef = useRef<IUserManageModalRef>(null)
- const [mcpManagerModalOpen, setMcpManagerModalOpen] = useState(false)
- const mcpManagerModalRef = useRef<IMCPManagerModalRef>(null)
- const [deleteHitOpen, setDeleteHitOpen] = useState(false)
- const [deleteLoading, setDeleteLoading] = useState(false)
- const [deleteTarget, setDeleteTarget] = useState<SocialAccount | null>(
- null,
- )
-
- // IP地理位置信息状态
- const [ipLocationInfo, setIpLocationInfo]
- = useState<IpLocationInfo | null>(null)
- const [ipLocationLoading, setIpLocationLoading] = useState(false)
-
- // 新建空间状态
- const [openCreateGroup, setOpenCreateGroup] = useState(false)
- const [groupName, setGroupName] = useState('')
- const [createGroupLoading, setCreateGroupLoading] = useState(false)
-
- // 新建空间相关函数
- const createGroupCancel = () => {
- setOpenCreateGroup(false)
- setGroupName('')
- }
-
- // 添加账号相关状态
- const [isAddAccountOpen, setIsAddAccountOpen] = useState(false)
- const preAccountIds = useRef<Set<string>>(new Set())
- const pendingGroupIdRef = useRef<string | null>(null)
- const isAssigningRef = useRef(false)
- const snapshotReadyRef = useRef(false)
- const allUser = useRef('-1')
-
- // 掉线账号重新登录确认弹窗状态
- const [showReauthConfirm, setShowReauthConfirm] = useState(false)
- const [reauthAccount, setReauthAccount] = useState<SocialAccount | null>(null)
-
- // Facebook页面选择弹窗状态
- const [showFacebookPagesModal, setShowFacebookPagesModal] = useState(false)
-
- // App下载提示弹窗状态
- const [showAppDownloadModal, setShowAppDownloadModal] = useState(false)
- const [mobileOnlyPlatform, setMobileOnlyPlatform] = useState<string>('')
-
- // 排序相关状态
- const [isGroupSorting, setIsGroupSorting] = useState(false)
- const [isAccountSorting, setIsAccountSorting] = useState(false)
-
- // 本地账户排序状态,用于临时存储拖拽后的顺序
- const [localAccountSort, setLocalAccountSort] = useState<Record<string, string[]>>({})
-
- // 自动保存定时器引用
- const saveTimeoutRef = useRef<NodeJS.Timeout | null>(null)
-
- // 在组件内部过滤账号列表,根据页面类型决定过滤逻辑
- const accountList = useMemo(() => {
- if (isInteractivePage) {
- // 在interactive页面,只显示指定的平台
- const allowedPlatforms = [
- PlatType.Facebook,
- PlatType.Instagram,
- PlatType.Threads,
- PlatType.Douyin,
- PlatType.Xhs,
- ]
- return fullAccountList.filter(
- account => !excludePlatforms.includes(account.type) && allowedPlatforms.includes(account.type),
- )
- }
- else {
- // 在其他页面,正常过滤
- return fullAccountList.filter(
- account => !excludePlatforms.includes(account.type),
- )
- }
- }, [fullAccountList, excludePlatforms, isInteractivePage])
-
- const defaultActiveKey = useMemo(() => {
- return accountGroupList.find(v => v.isDefault)?.id
- }, [accountGroupList])
-
- // 获取IP地理位置信息
- useEffect(() => {
- const fetchIpLocation = async () => {
- try {
- setIpLocationLoading(true)
- const info = await getIpLocation()
- setIpLocationInfo(info)
- }
- catch (error) {
- console.error(t('messages.ipLocationError' as any), error)
- }
- finally {
- setIpLocationLoading(false)
- }
- }
-
- // 只在组件挂载时获取一次IP信息
- fetchIpLocation()
- }, [])
-
- // 处理离线账户点击,显示确认弹窗
- const handleOfflineAccountClick = useCallback((account: SocialAccount) => {
- setReauthAccount(account)
- setShowReauthConfirm(true)
- }, [])
-
- // 确认重新登录
- const handleConfirmReauth = useCallback(async () => {
- if (!reauthAccount)
- return
-
- const platform = reauthAccount.type
- const targetSpaceId = reauthAccount.groupId // 使用账户原本的空间ID
-
- setShowReauthConfirm(false)
-
- try {
- // 根据平台类型调用对应的授权函数,传递目标空间ID
- switch (platform) {
- case PlatType.KWAI:
- await kwaiSkip(platform, targetSpaceId)
- break
- case PlatType.BILIBILI:
- await bilibiliSkip(platform, targetSpaceId)
- break
- case PlatType.YouTube:
- await youtubeSkip(platform, targetSpaceId)
- break
- case PlatType.Twitter:
- await twitterSkip(platform, targetSpaceId)
- break
- case PlatType.Tiktok:
- await tiktokSkip(platform, targetSpaceId)
- break
- case PlatType.Facebook:
- try {
- await facebookSkip(platform, targetSpaceId)
- // Facebook授权成功后显示页面选择弹窗
- setShowFacebookPagesModal(true)
- }
- catch (error) {
- console.error(t('messages.facebookAuthFailed' as any), error)
- }
- break
- case PlatType.Instagram:
- await instagramSkip(platform, targetSpaceId)
- break
- case PlatType.Threads:
- await threadsSkip(platform, targetSpaceId)
- break
- case PlatType.WxGzh:
- await wxGzhSkip(platform, targetSpaceId)
- break
- case PlatType.Pinterest:
- await pinterestSkip(platform, targetSpaceId)
- break
- case PlatType.LinkedIn:
- await linkedinSkip(platform, targetSpaceId)
- break
- default:
- console.warn(`${t('messages.unsupportedPlatform' as any)}: ${platform}`)
- toast.warning(t('messages.platformNotSupported' as any, { platform }))
- return
- }
-
- // 授权完成后刷新账号列表
- setTimeout(async () => {
- try {
- await getAccountList()
- console.log(t('messages.accountListRefreshed' as any))
- }
- catch (error) {
- console.error(t('messages.refreshAccountListFailed' as any), error)
- }
- }, 3000) // 等待3秒让授权完成
- }
- catch (error) {
- console.error(t('messages.authFailed' as any), error)
- toast.error(`${t('messages.authFailed' as any)},${t('messages.pleaseRetry' as any)}`)
- }
- finally {
- setReauthAccount(null)
- }
- }, [reauthAccount, getAccountList, t])
-
- // 处理Facebook页面选择成功
- const handleFacebookPagesSuccess = () => {
- setShowFacebookPagesModal(false)
- // 可以在这里添加成功提示或其他逻辑
- }
-
- // 分组排序函数
- const handleGroupSort = async (groupId: string, direction: 'up' | 'down') => {
- const sortedGroups = [...accountGroupList].sort((a, b) => (a.rank || 0) - (b.rank || 0))
- const currentIndex = sortedGroups.findIndex(g => g.id === groupId)
-
- if (currentIndex === -1)
- return
-
- const newIndex = direction === 'up' ? currentIndex - 1 : currentIndex + 1
- if (newIndex < 0 || newIndex >= sortedGroups.length)
- return;
-
- // 交换位置
- [sortedGroups[currentIndex], sortedGroups[newIndex]] = [sortedGroups[newIndex], sortedGroups[currentIndex]]
-
- // 更新rank
- const updateList = sortedGroups.map((group, index) => ({
- id: group.id,
- rank: index,
- }))
-
- try {
- await apiUpdateAccountGroupSortRank({ list: updateList })
- await getAccountGroup()
- toast.success(t('messages.sortSuccess' as any))
- }
- catch (error) {
- toast.error(t('messages.sortFailed' as any))
- }
- }
-
- // 账户拖拽排序
- const handleAccountDragEnd = (result: any) => {
- if (!result.destination)
- return
-
- const { source, destination } = result
- const groupId = source.droppableId
-
- // 获取该分组的账户列表
- const groupAccounts = isInteractivePage
- ? accountList.filter(account => account.groupId === groupId)
- : accountGroupList.find(g => g.id === groupId)?.children || []
-
- // 获取当前分组的本地排序,如果没有则使用原始排序
- const currentSort = localAccountSort[groupId] || groupAccounts
- .sort((a, b) => (a.rank || 0) - (b.rank || 0))
- .map(account => account.id)
-
- // 创建新的排序数组
- const newSort = [...currentSort]
- const [movedId] = newSort.splice(source.index, 1)
- newSort.splice(destination.index, 0, movedId)
-
- // 更新本地排序状态
- setLocalAccountSort(prev => ({
- ...prev,
- [groupId]: newSort,
- }))
-
- const updateList = newSort.map((accountId, index) => ({
- id: accountId,
- rank: index,
- }))
-
- apiUpdateAccountSortRank({ groupId, list: updateList })
-
- // // 清除之前的定时器
- // if (saveTimeoutRef.current) {
- // clearTimeout(saveTimeoutRef.current);
- // }
-
- // // 设置新的定时器,2秒后自动保存
- // saveTimeoutRef.current = setTimeout(async () => {
- // try {
- // const updateList = newSort.map((accountId, index) => ({
- // id: accountId,
- // rank: index
- // }));
-
- // await apiUpdateAccountSortRank({ groupId, list: updateList });
- // // 保存成功后清除本地排序状态,让界面使用服务器数据
- // setLocalAccountSort(prev => {
- // const newState = { ...prev };
- // delete newState[groupId];
- // return newState;
- // });
- // // await getAccountList();
- // } catch (error) {
- // console.error('自动保存排序失败:', error);
- // toast.error(t("messages.sortFailed" as any));
- // }
- // }, 2000);
- }
-
- // 添加账号流程
- const openAddAccountFlow = async () => {
- if (accountGroupList.length === 0) {
- toast.error(t('messages.createSpaceFirst' as any))
- return
- }
-
- // 直接打开AddAccountModal,让用户选择空间
- if ((useAccountStore.getState().accountList || []).length === 0) {
- await getAccountList()
- }
- preAccountIds.current = new Set(
- (useAccountStore.getState().accountList || []).map(v => v.id),
- )
- snapshotReadyRef.current = true
- setIsAddAccountOpen(true)
- }
-
- // 监听自定义事件,打开添加账号流程
- useEffect(() => {
- const handleOpenAddAccount = async () => {
- // 先获取最新的空间列表
- // await getAccountGroup()
-
- // 从 store 获取最新的 accountGroupList
- const latestAccountGroupList = useAccountStore.getState().accountGroupList
-
- if (latestAccountGroupList.length === 0) {
- toast.error(t('messages.createSpaceFirst' as any))
- return
- }
-
- // 直接打开AddAccountModal
- if ((useAccountStore.getState().accountList || []).length === 0) {
- await getAccountList()
- }
- preAccountIds.current = new Set(
- (useAccountStore.getState().accountList || []).map(v => v.id),
- )
- snapshotReadyRef.current = true
- setIsAddAccountOpen(true)
- }
-
- window.addEventListener('openAddAccountFlow', handleOpenAddAccount as EventListener)
-
- return () => {
- window.removeEventListener('openAddAccountFlow', handleOpenAddAccount as EventListener)
- }
- }, [])
-
- // 监听账号列表变化,自动分配新账号到当前空间
- useEffect(() => {
- const maybeAssign = async () => {
- if (!pendingGroupIdRef.current)
- return
- if (isAssigningRef.current)
- return
- if (!snapshotReadyRef.current)
- return
- const currList = fullAccountList || []
- const newAccounts = currList.filter(
- a => !preAccountIds.current.has(a.id),
- )
- if (newAccounts.length === 0)
- return
- isAssigningRef.current = true
- try {
- const targetGroupId = pendingGroupIdRef.current!
- for (const acc of newAccounts) {
- try {
- await updateAccountApi({ id: acc.id, groupId: targetGroupId })
- }
- catch {}
- }
- await getAccountList()
- toast.success(t('accountAddedToSpace'))
- }
- finally {
- pendingGroupIdRef.current = null
- preAccountIds.current = new Set()
- isAssigningRef.current = false
- snapshotReadyRef.current = false
- }
- }
- maybeAssign()
- }, [fullAccountList])
-
- // 组件卸载时清理定时器
- useEffect(() => {
- return () => {
- if (saveTimeoutRef.current) {
- clearTimeout(saveTimeoutRef.current)
- }
- }
- }, [])
-
- return (
- <>
- <UserManageModal
- ref={userManageModalRef}
- open={userManageModalOpen}
- onCancel={() => setUserManageModalOpen(false)}
- />
- <MCPManagerModal
- ref={mcpManagerModalRef}
- open={mcpManagerModalOpen}
- onClose={setMcpManagerModalOpen}
- />
-
- <AddAccountModal
- open={isAddAccountOpen}
- onClose={async () => {
- setIsAddAccountOpen(false)
- }}
- onAddSuccess={async (acc) => {
- try {
- if (pendingGroupIdRef.current) {
- await updateAccountApi({
- id: acc.id,
- groupId: pendingGroupIdRef.current,
- })
- toast.success(t('accountAddedToSpace'))
- }
- }
- finally {
- pendingGroupIdRef.current = null
- await getAccountList()
- }
- }}
- showSpaceSelector={true}
- />
-
- {/* 新建空间Modal */}
- <Modal
- open={openCreateGroup}
- title={t('createSpace.title')}
- onCancel={createGroupCancel}
- footer={(
- <>
- <Button onClick={createGroupCancel}>
- {t('createSpace.cancel')}
- </Button>
- <Button
- type="primary"
- onClick={async () => {
- if (!groupName.trim()) {
- toast.error(t('createSpace.nameRequired'))
- return
- }
- setCreateGroupLoading(true)
- try {
- await createAccountGroupApi({
- name: groupName.trim(),
- })
- await getAccountGroup()
- // toast.success(t("createSpace.success"));
- createGroupCancel()
- }
- catch (error) {
- toast.error(t('createSpace.failed'))
- }
- finally {
- setCreateGroupLoading(false)
- }
- }}
- loading={createGroupLoading}
- >
- {t('createSpace.save')}
- </Button>
- </>
- )}
- >
- <div className={styles.createGroup}>
- <label>{t('createSpace.name')}</label>
- <Input
- value={groupName}
- placeholder={t('createSpace.namePlaceholder')}
- onChange={e => setGroupName(e.target.value)}
- onPressEnter={async () => {
- if (!groupName.trim()) {
- toast.error(t('createSpace.nameRequired'))
-
- return
- }
- setCreateGroupLoading(true)
- try {
- await createAccountGroupApi({
- name: groupName.trim(),
- })
- await getAccountGroup()
- toast.success(t('createSpace.success'))
- createGroupCancel()
- }
- catch (error) {
- toast.error(t('createSpace.failed'))
- }
- finally {
- setCreateGroupLoading(false)
- }
- }}
- />
- </div>
- </Modal>
-
- <div className={styles.accountSidebar}>
- <div className="accountSidebar-top">
- <div className="accountSidebar-top-box">
- <Button
- onClick={() => {
- setUserManageModalOpen(true)
- }}
- >
- <UserOutlined />
- {t('accountManager')}
- </Button>
- </div>
- {/* mcp 按钮 */}
- <div className="accountSidebar-top-box">
- {/* 按钮蓝紫色渐变 */}
- <Button
- type="primary"
- style={{
- background:
- 'linear-gradient(90deg, #625BF2 0%, #925BF2 100%)',
- }}
- onClick={() => setMcpManagerModalOpen(true)}
- >
- {t('mcpManagerTit')}
- </Button>
- </div>
- </div>
-
- {accountLoading ? (
- <>
- <Skeleton avatar paragraph={{ rows: 1 }} active />
- <Skeleton avatar paragraph={{ rows: 1 }} active />
- <Skeleton avatar paragraph={{ rows: 1 }} active />
- </>
- ) : (
- <div className="accountSidebar-content">
- {sidebarTopExtra}
- <DragDropContext onDragEnd={handleAccountDragEnd}>
- <Collapse
- key={defaultActiveKey}
- defaultActiveKey={defaultActiveKey}
- items={accountGroupList
- .sort((a, b) => (a.rank || 0) - (b.rank || 0))
- .map((v) => {
- // 为默认分组添加IP和地址信息
- const isDefaultGroup = v.isDefault
- const showIpInfo = isDefaultGroup && ipLocationInfo
-
- // 计算过滤后的账户数量和在线数量
- const groupAccounts = isInteractivePage
- ? accountList.filter(account => account.groupId === v.id)
- : v.children || []
- const totalCount = groupAccounts.length
- const onlineCount = groupAccounts.filter(account => account.status === AccountStatus.USABLE).length
-
- return {
- key: v.id,
- label: (
- <>
- <div className="accountSidebar-groupLabel">
- <span className="accountSidebar-groupName">
- {v.name}
- </span>
- <span className="accountSidebar-userCount">
- {onlineCount}
- /
- {totalCount}
- </span>
- {/* 根据proxyIp判断显示IP信息 */}
- {!v.proxyIp || v.proxyIp === '' ? (
- // 本地IP显示
- <div className="accountSidebar-ipInfo">
- <span className="accountSidebar-ipType" data-type="direct">{t('ipType.direct')}</span>
- {ipLocationLoading
- ? (
- <span className="accountSidebar-ipLoading">
- {t('ipInfo.loading')}
- </span>
- )
- : ipLocationInfo
- ? (
- <Tooltip
- title={t('ipInfo.tooltip', {
- asn: ipLocationInfo.asn,
- org: ipLocationInfo.org,
- })}
- >
- <span className="accountSidebar-ipText">
- {formatLocationInfo(ipLocationInfo)}
- </span>
- </Tooltip>
- )
- : (
- <span className="accountSidebar-ipError">
- {t('ipInfo.error')}
- </span>
- )}
- </div>
- ) : (
- // 数据中的IP显示
- v.ip
- && v.location && (
- <div className="accountSidebar-ipInfo">
- <span className="accountSidebar-ipType" data-type="proxy">{t('ipType.proxy')}</span>
- <Tooltip
- title={t('sidebar.ipLocationTooltip', { ip: v.ip, location: v.location })}
- >
- <span className="accountSidebar-ipText">
- {extractCountry(v.location)}
- {' '}
- |
- {v.ip}
- </span>
- </Tooltip>
- </div>
- )
- )}
- {/* 分组排序按钮 */}
- <div className="accountSidebar-groupSort">
- <Tooltip title={t('sidebar.moveUp')}>
- <Button
- type="text"
- size="small"
- icon={<UpOutlined />}
- onClick={(e) => {
- e.stopPropagation()
- handleGroupSort(v.id, 'up')
- }}
- />
- </Tooltip>
- <Tooltip title={t('sidebar.moveDown')}>
- <Button
- type="text"
- size="small"
- icon={<DownOutlined />}
- onClick={(e) => {
- e.stopPropagation()
- handleGroupSort(v.id, 'down')
- }}
- />
- </Tooltip>
- </div>
- </div>
- </>
- ),
- children: (
- <Droppable droppableId={v.id}>
- {provided => (
- <ul
- key={v.id}
- className="accountList"
- {...provided.droppableProps}
- ref={provided.innerRef}
- >
- {(() => {
- // 获取该分组的账户列表
- const groupAccounts = isInteractivePage
- ? accountList.filter(account => account.groupId === v.id)
- : v.children || []
-
- // 获取本地排序,如果没有则使用原始排序
- const localSort = localAccountSort[v.id]
- let sortedAccounts = groupAccounts.sort((a, b) => (a.rank || 0) - (b.rank || 0))
-
- // 如果有本地排序,则按照本地排序重新排列
- if (localSort && localSort.length > 0) {
- const accountMap = new Map(sortedAccounts.map(account => [account.id, account]))
- sortedAccounts = localSort
- .map(id => accountMap.get(id))
- .filter(Boolean) as typeof sortedAccounts
- }
-
- return sortedAccounts.map((account, index) => {
- if (excludePlatforms.includes(account.type))
- return ''
- const platInfo = AccountPlatInfoMap.get(
- account.type,
- )!
-
- // 检查是否为需要蒙层的平台(仅在interactive页面)
- const isMobileOnlyPlatform = isInteractivePage && (account.type === PlatType.Douyin || account.type === PlatType.Xhs)
-
- return (
- <Draggable key={account.id} draggableId={account.id} index={index}>
- {(provided, snapshot) => (
- <li
- className={[
- 'accountList-item',
- `${activeAccountId === account.id ? 'accountList-item--active' : ''}`,
- // 失效状态
- account.status === AccountStatus.DISABLE
- && 'accountList-item--disable',
- // 移动端平台蒙层状态(仅在interactive页面)
- isMobileOnlyPlatform && 'accountList-item--mobile-only',
- // 拖拽状态
- snapshot.isDragging && 'accountList-item--dragging',
- ].join(' ')}
- ref={provided.innerRef}
- {...provided.draggableProps}
- >
- {/* 拖拽手柄 */}
- <div
- className="accountList-item-dragHandle"
- {...provided.dragHandleProps}
- onClick={e => e.stopPropagation()}
- >
- <SixDotsIcon />
- </div>
- <Avatar
- style={{ backgroundColor: 'aliceblue' }}
- src={getOssUrl(account.avatar)}
- size="large"
- >
- {account.nickname?.charAt(0)}
- </Avatar>
- <div
- className="accountList-item-right"
- onClick={async () => {
- // 如果是移动端平台,显示下载提示
- if (isMobileOnlyPlatform) {
- setMobileOnlyPlatform(account.type === PlatType.Douyin ? t('platformNames.douyin') : t('platformNames.xiaohongshu'))
- setShowAppDownloadModal(true)
- return
- }
-
- if (
- account.status === AccountStatus.DISABLE
- ) {
- // 小红书平台即使是掉线状态也显示下载App弹窗
- if (account.type === PlatType.Xhs) {
- setMobileOnlyPlatform(t('platformNames.xiaohongshu'))
- setShowAppDownloadModal(true)
- return
- }
- // 其他平台的掉线账户直接触发重新授权
- await handleOfflineAccountClick(account)
- return
- }
- onAccountChange(account)
- }}
- >
- <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">
- <Image src={platInfo?.icon} alt={platInfo?.name || ''} width={16} height={16} />
- <span>{platInfo?.name}</span>
- </p>
- <Popover
- content={(
- <AccountPopoverInfo
- accountInfo={account}
- onDeleteClick={(acc) => {
- setDeleteTarget(acc)
- setDeleteHitOpen(true)
- }}
- />
- )}
- placement="right"
- >
- ...
- </Popover>
- </div>
- </div>
-
- {/* 移动端平台蒙层(仅在interactive页面) */}
- {isMobileOnlyPlatform && (
- <div className="accountList-item-overlay">
- <div className="accountList-item-overlay-text">
- {t('mobileOnlySupport' as any)}
- </div>
- </div>
- )}
- </li>
- )}
- </Draggable>
- )
- })
- })()}
- {provided.placeholder}
- </ul>
- )}
- </Droppable>
- ),
- }
- })}
- />
- </DragDropContext>
- </div>
- )}
-
- <div className="accountSidebar-footer">
- <Button
- type="default"
- icon={<PlusOutlined />}
- onClick={openAddAccountFlow}
- style={{ width: '100%', marginBottom: '10px' }}
- data-driver-target="add-channel-btn"
- >
- {t('addAccount')}
- </Button>
-
- <Button
- type="primary"
- icon={<PlusOutlined />}
- onClick={() => {
- setOpenCreateGroup(true)
- }}
- style={{ width: '100%' }}
- >
- {t('createSpace.button')}
- </Button>
- </div>
- {/* 删除账户确认弹窗(复用组件) */}
- <DeleteUserConfirmModal
- open={deleteHitOpen}
- deleteUsers={deleteTarget ? [deleteTarget] : []}
- onClose={() => {
- setDeleteHitOpen(false)
- }}
- onDeleteSuccess={async () => {
- await getAccountList()
- setDeleteTarget(null)
- toast.success(t('messages.deleteSuccess' as any))
- }}
- />
-
- {/* Facebook页面选择弹窗 */}
- <FacebookPagesModal
- open={showFacebookPagesModal}
- onClose={() => setShowFacebookPagesModal(false)}
- onSuccess={handleFacebookPagesSuccess}
- />
-
- {/* App下载提示弹窗(仅在interactive页面显示) */}
- {isInteractivePage && (
- <DownloadAppModal
- visible={showAppDownloadModal}
- onClose={() => setShowAppDownloadModal(false)}
- platform={mobileOnlyPlatform}
- zIndex={1000}
- />
- )}
-
- {/* 掉线账号重新登录确认弹窗 */}
- <Modal
- open={showReauthConfirm}
- title={t('reauthConfirm.title' as any)}
- onCancel={() => {
- setShowReauthConfirm(false)
- setReauthAccount(null)
- }}
- footer={(
- <Button
- type="primary"
- onClick={handleConfirmReauth}
- >
- {t('reauthConfirm.loginAgain' as any)}
- </Button>
- )}
- >
- <div className={styles.reauthConfirm}>
- {reauthAccount && (
- <div>
- <p style={{ marginBottom: '16px' }}>
- {t('reauthConfirm.content' as any, {
- platformName: AccountPlatInfoMap.get(reauthAccount.type)?.name || reauthAccount.type,
- nickname: reauthAccount.nickname,
- spaceName: accountGroupList.find(group => group.id === reauthAccount.groupId)?.name || t('defaultSpace'),
- })}
- </p>
- </div>
- )}
- </div>
- </Modal>
- </div>
- </>
- )
- },
- ),
-)
-AccountSidebar.displayName = 'AccountSidebar'
-
-export default AccountSidebar
diff --git a/project/web/src/app/[lng]/accounts/components/AccountSidebar/DeleteUserConfirmModal.tsx b/project/web/src/app/[lng]/accounts/components/AccountSidebar/DeleteUserConfirmModal.tsx
deleted file mode 100644
index c922de1e..00000000
--- a/project/web/src/app/[lng]/accounts/components/AccountSidebar/DeleteUserConfirmModal.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * DeleteUserConfirmModal - 删除用户确认弹窗
- * 批量删除账号的二次确认弹窗
- */
-
-import type { ForwardedRef } from 'react'
-import type { SocialAccount } from '@/api/types/account.type'
-import { Button } from 'antd'
-import { forwardRef, memo, useState } from 'react'
-import { Modal } from '@/components/ui/modal'
-import { deleteAccountsApi } from '@/api/account'
-import styles from '@/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss'
-import { useTransClient } from '@/app/i18n/client'
-import AvatarPlat from '@/components/AvatarPlat'
-
-export interface IDeleteUserConfirmModalRef {}
-
-export interface IDeleteUserConfirmModalProps {
- open: boolean
- onClose: () => void
- onDeleteSuccess: () => void
- deleteUsers: SocialAccount[]
-}
-
-const DeleteUserConfirmModal = memo(
- forwardRef(
- (
- {
- open,
- onClose,
- deleteUsers,
- onDeleteSuccess,
- }: IDeleteUserConfirmModalProps,
- ref: ForwardedRef<IDeleteUserConfirmModalRef>,
- ) => {
- const [deleteLoading, setDeleteLoading] = useState(false)
- const { t } = useTransClient('account')
-
- return (
- <Modal
- open={open}
- title={t('deleteConfirm.title' as any)}
- width={500}
- zIndex={1002}
- onCancel={() => onClose()}
- className={styles.userManageDeleteHitModal}
- footer={(
- <>
- <Button onClick={() => onClose()}>{t('deleteConfirm.cancel' as any)}</Button>
- <Button
- type="primary"
- loading={deleteLoading}
- onClick={async () => {
- setDeleteLoading(true)
- const res = await deleteAccountsApi(
- deleteUsers.map(v => v.id),
- )
- setDeleteLoading(false)
- if (!res)
- return setDeleteLoading(false)
- onDeleteSuccess()
- onClose()
- }}
- >
- {t('deleteConfirm.confirm' as any)}
- </Button>
- </>
- )}
- >
- <p>
- {t('deleteConfirm.content' as any, { count: deleteUsers.length } as any)}
- </p>
- <div className={styles['userManageDeleteHitModal-users']}>
- {deleteUsers.map((v) => {
- return (
- <li key={v.id}>
- <AvatarPlat account={v} size="large" />
- <span>{v.nickname}</span>
- </li>
- )
- })}
- </div>
- </Modal>
- )
- },
- ),
-)
-
-export default DeleteUserConfirmModal
diff --git a/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPKeyDetailModal.module.scss b/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPKeyDetailModal.module.scss
deleted file mode 100644
index 930a5c49..00000000
--- a/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPKeyDetailModal.module.scss
+++ /dev/null
@@ -1,77 +0,0 @@
-.mcpKeyDetailModal {
- .keyInfo {
- margin-bottom: 24px;
- padding: 16px;
- background: #f8f9fa;
- border-radius: 8px;
-
- .keyHeader {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12px;
-
- .keyName {
- .label {
- font-weight: 500;
- color: #666;
- margin-right: 8px;
- }
-
- .value {
- font-weight: 600;
- color: #333;
- }
- }
- }
-
- .keyValue {
- margin-bottom: 12px;
-
- .label {
- font-weight: 500;
- color: #666;
- margin-right: 8px;
- }
-
- .value {
- font-family: 'Courier New', monospace;
- background: #fff;
- padding: 4px 8px;
- border-radius: 4px;
- border: 1px solid #d9d9d9;
- color: #333;
- }
- }
-
- .keyMeta {
- display: flex;
- gap: 24px;
-
- .metaItem {
- .label {
- font-weight: 500;
- color: #666;
- margin-right: 8px;
- }
- }
- }
- }
-
- .refList {
- .sectionTitle {
- display: flex;
- align-items: center;
- gap: 8px;
- font-weight: 600;
- font-size: 16px;
- margin-bottom: 16px;
- color: #333;
- }
-
- .emptyState {
- padding: 40px 0;
- text-align: center;
- }
- }
-}
diff --git a/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPKeyDetailModal.tsx b/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPKeyDetailModal.tsx
deleted file mode 100644
index 057ac0f4..00000000
--- a/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPKeyDetailModal.tsx
+++ /dev/null
@@ -1,279 +0,0 @@
-/**
- * MCPKeyDetailModal - MCP 密钥详情弹窗
- * 展示 MCP 密钥详情和关联账户列表
- */
-
-import type { PlatType } from '@/app/config/platConfig'
-import { CopyOutlined, DeleteOutlined, KeyOutlined, UserOutlined } from '@ant-design/icons'
-import { Avatar, Button, Empty, List, Pagination, Popconfirm, Space, Tag } from 'antd'
-import { toast } from '@/lib/toast'
-import { Modal } from '@/components/ui/modal'
-import React, { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react'
-import { apiDeleteMCPRef, apiGetMCPRefList } from '@/api/mcp'
-import { AccountPlatInfoMap } from '@/app/config/platConfig'
-import { useTransClient } from '@/app/i18n/client'
-import styles from './MCPKeyDetailModal.module.scss'
-
-export interface IMCPKeyDetailModalRef {
- open: (keyInfo: any) => void
- close: () => void
-}
-
-export interface IMCPKeyDetailModalProps {
- open: boolean
- onClose: (open: boolean) => void
- keyInfo?: any
-}
-
-const MCPKeyDetailModal = memo(
- forwardRef<IMCPKeyDetailModalRef, IMCPKeyDetailModalProps>(
- ({ open, onClose, keyInfo: propKeyInfo }, ref) => {
- const { t } = useTransClient('account')
- const [keyInfo, setKeyInfo] = useState<any>(null)
- const [refList, setRefList] = useState<any[]>([])
- const [loading, setLoading] = useState(false)
- const [currentPage, setCurrentPage] = useState(1)
- const [pageSize, setPageSize] = useState(10)
- const [total, setTotal] = useState(0)
-
- // Get platform information
- const getPlatformInfo = (platformType: string) => {
- const platInfo = AccountPlatInfoMap.get(platformType as PlatType)
- return {
- name: platInfo?.name || t('unknownPlatform'),
- icon: platInfo?.icon || '',
- themeColor: platInfo?.themeColor || '#999',
- }
- }
-
- // Fetch associated accounts list
- const fetchRefList = async () => {
- if (!keyInfo?.key)
- return
-
- try {
- setLoading(true)
- const res: any = await apiGetMCPRefList(currentPage, pageSize, keyInfo.key)
- if (res?.code === 0) {
- // API returns account data directly (no need to map)
- const refListData = res.data.list || []
- setRefList(refListData)
- setTotal(res.data.total || 0)
- }
- }
- catch (error) {
- toast.error(t('mcpManager.keyDetail.fetchAccountsFailed' as any))
- }
- finally {
- setLoading(false)
- }
- }
-
- useEffect(() => {
- if (open && keyInfo) {
- fetchRefList()
- }
- }, [open, keyInfo, currentPage, pageSize])
-
- const handleCopyKey = (key: string) => {
- navigator.clipboard.writeText(key)
- toast.success(t('mcpManager.keyCopied' as any))
- }
-
- const handleUnlinkAccount = async (accountId: string) => {
- try {
- const res = await apiDeleteMCPRef({
- key: keyInfo.key,
- accountId,
- })
- if (res?.code === 0) {
- toast.success(t('mcpManager.keyDetail.unlinkSuccess' as any))
- fetchRefList() // Refresh list
- }
- else {
- toast.error(t('mcpManager.keyDetail.unlinkFailed' as any))
- }
- }
- catch (error) {
- toast.error(t('mcpManager.keyDetail.unlinkFailed' as any))
- }
- }
-
- // 当props中的keyInfo变化时,更新内部状态
- useEffect(() => {
- if (propKeyInfo) {
- setKeyInfo(propKeyInfo)
- setCurrentPage(1)
- setRefList([])
- setTotal(0)
- }
- }, [propKeyInfo])
-
- useImperativeHandle(ref, () => ({
- open: (keyInfo: any) => {
- setKeyInfo(keyInfo)
- setCurrentPage(1)
- setRefList([])
- setTotal(0)
- },
- close: () => {
- setKeyInfo(null)
- setRefList([])
- setTotal(0)
- },
- }))
-
- return (
- <Modal
- title={(
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <KeyOutlined style={{ color: '#625BF2' }} />
- {t('mcpManager.keyDetail.title' as any)}
- </div>
- )}
- open={open}
- onCancel={() => onClose(false)}
- footer={null}
- width={800}
- className={styles.mcpKeyDetailModal}
- >
- {keyInfo && (
- <>
- {/* Key basic information */}
- <div className={styles.keyInfo}>
- <div className={styles.keyHeader}>
- <div className={styles.keyName}>
- <span className={styles.label}>{t('mcpManager.keyDetail.keyName' as any)}</span>
- <span className={styles.value}>{keyInfo.desc}</span>
- </div>
- <Space>
- <Tag color={keyInfo.status === 'ACTIVE' ? 'green' : 'red'}>
- {keyInfo.status}
- </Tag>
- <Button
- type="link"
- icon={<CopyOutlined />}
- onClick={() => handleCopyKey(keyInfo.key)}
- >
- {t('mcpManager.keyDetail.copyKey' as any)}
- </Button>
- </Space>
- </div>
-
- <div className={styles.keyValue}>
- <span className={styles.label}>{t('mcpManager.keyDetail.keyValue' as any)}</span>
- <span className={styles.value}>{keyInfo.key}</span>
- </div>
-
- <div className={styles.keyMeta}>
- <div className={styles.metaItem}>
- <span className={styles.label}>{t('mcpManager.keyDetail.createdTime' as any)}</span>
- <span>{keyInfo.createdAt}</span>
- </div>
- <div className={styles.metaItem}>
- <span className={styles.label}>{t('mcpManager.keyDetail.associatedAccounts' as any)}</span>
- <span>{t('mcpManager.keyDetail.accountsCount' as any, { count: total })}</span>
- </div>
- </div>
- </div>
-
- {/* Associated accounts list */}
- <div className={styles.refList}>
- <div className={styles.sectionTitle}>
- <UserOutlined />
- {t('mcpManager.keyDetail.associatedAccountsList' as any)}
- </div>
-
- {refList.length === 0 && !loading
- ? (
- <div className={styles.emptyState}>
- <Empty description={t('mcpManager.keyDetail.noAccounts' as any)} />
- </div>
- )
- : (
- <>
- <List
- className={styles.refList}
- dataSource={refList}
- loading={loading}
- renderItem={(item) => {
- const platformInfo = getPlatformInfo(item.accountType)
- return (
- <List.Item
- actions={[
- <Popconfirm
- title={t('mcpManager.keyDetail.unlinkConfirm' as any)}
- onConfirm={() => handleUnlinkAccount(item.accountId)}
- okText={t('mcpManager.keyDetail.ok' as any)}
- cancelText={t('mcpManager.keyDetail.cancel' as any)}
- >
- <Button
- key="unlink"
- type="link"
- danger
- icon={<DeleteOutlined />}
- >
- {t('mcpManager.keyDetail.unlinkButton' as any)}
- </Button>
- </Popconfirm>,
- ]}
- >
- <List.Item.Meta
- avatar={item.avatar ? <Avatar src={item.avatar} /> : <Avatar icon={<UserOutlined />} />}
- title={item.name || item.nickname || item.accountId}
- description={(
- <div>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- {platformInfo.icon && (
- <img
- src={platformInfo.icon}
- alt={platformInfo.name}
- style={{
- width: '16px',
- height: '16px',
- borderRadius: '2px',
- }}
- />
- )}
- <span style={{ color: platformInfo.themeColor }}>
- {platformInfo.name}
- </span>
- </div>
- </div>
- )}
- />
- </List.Item>
- )
- }}
- />
-
- {total > 0 && (
- <div style={{ marginTop: 16, textAlign: 'right' }}>
- <Pagination
- current={currentPage}
- pageSize={pageSize}
- total={total}
- showSizeChanger
- showQuickJumper
- showTotal={(total, range) => t('mcpManager.keyDetail.paginationText' as any, { start: range[0], end: range[1], total })}
- onChange={(page, size) => {
- setCurrentPage(page)
- setPageSize(size)
- }}
- />
- </div>
- )}
- </>
- )}
- </div>
- </>
- )}
- </Modal>
- )
- },
- ),
-)
-
-MCPKeyDetailModal.displayName = 'MCPKeyDetailModal'
-
-export default MCPKeyDetailModal
diff --git a/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPManagerModal.module.scss b/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPManagerModal.module.scss
deleted file mode 100644
index 21251e6b..00000000
--- a/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPManagerModal.module.scss
+++ /dev/null
@@ -1,114 +0,0 @@
-.mcpManagerModal {
- .mcpKeyList {
- .ant-list-item {
- border-radius: 8px;
- margin-bottom: 8px;
- border: 1px solid #f0f0f0;
- transition: all 0.3s ease;
-
- &:hover {
- border-color: #625bf2;
- box-shadow: 0 2px 8px rgba(98, 91, 242, 0.1);
- }
-
- .ant-list-item-meta {
- .ant-list-item-meta-avatar {
- .ant-avatar {
- background: linear-gradient(90deg, #625bf2 0%, #925bf2 100%);
- }
- }
-
- .ant-list-item-meta-content {
- .ant-list-item-meta-title {
- font-weight: 500;
- margin-bottom: 4px;
- }
-
- .ant-list-item-meta-description {
- .keyDisplay {
- font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
- background: #f5f5f5;
- padding: 4px 8px;
- border-radius: 4px;
- border: 1px solid #e8e8e8;
- font-size: 12px;
- color: #666;
- word-break: break-all;
- }
-
- .keyInfo {
- margin-top: 8px;
- font-size: 12px;
- color: #999;
-
- .infoItem {
- display: flex;
- align-items: center;
- margin-bottom: 2px;
-
- .label {
- margin-right: 8px;
- min-width: 60px;
- }
- }
- }
- }
- }
- }
-
- .ant-list-item-actions {
- .ant-btn-link {
- color: #625bf2;
-
- &:hover {
- color: #925bf2;
- }
-
- &.ant-btn-dangerous {
- color: #ff4d4f;
-
- &:hover {
- color: #ff7875;
- }
- }
- }
- }
- }
- }
-
- .createButton {
- background: linear-gradient(90deg, #625bf2 0%, #925bf2 100%);
- border: none;
- border-radius: 6px;
- height: 40px;
- font-weight: 500;
-
- &:hover {
- background: linear-gradient(90deg, #5a54e8 0%, #8a54e8 100%);
- transform: translateY(-1px);
- box-shadow: 0 4px 12px rgba(98, 91, 242, 0.3);
- }
- }
-
- .emptyState {
- text-align: center;
- padding: 40px 20px;
- color: #999;
-
- .emptyIcon {
- font-size: 48px;
- color: #d9d9d9;
- margin-bottom: 16px;
- }
-
- .emptyText {
- font-size: 14px;
- margin-bottom: 8px;
- }
-
- .emptyDesc {
- font-size: 12px;
- color: #ccc;
- }
- }
-}
diff --git a/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPManagerModal.tsx b/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPManagerModal.tsx
deleted file mode 100644
index fe687649..00000000
--- a/project/web/src/app/[lng]/accounts/components/AccountSidebar/MCPManagerModal.tsx
+++ /dev/null
@@ -1,412 +0,0 @@
-/**
- * MCPManagerModal - MCP 密钥管理弹窗
- * 管理 MCP (Multi-Channel Platform) 密钥
- */
-
-import type { SocialAccount } from '@/api/types/account.type'
-import { CopyOutlined, DeleteOutlined, EditOutlined, KeyOutlined, PlusOutlined } from '@ant-design/icons'
-import { Avatar, Button, Empty, Form, Input, List, Pagination, Space, Tag } from 'antd'
-import { toast } from '@/lib/toast'
-import { Modal } from '@/components/ui/modal'
-import dayjs from 'dayjs'
-import React, { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react'
-import {
- apiCreateMCPKey,
- apiCreateMCPRef,
- apiDeleteMCPKey,
- apiGetMCPKeyList,
-} from '@/api/mcp'
-import { useTransClient } from '@/app/i18n/client'
-import ChooseAccountModule from '@/components/ChooseAccountModule/ChooseAccountModule'
-import MCPKeyDetailModal from './MCPKeyDetailModal'
-import styles from './MCPManagerModal.module.scss'
-
-export interface IMCPManagerModalRef {
- open: () => void
- close: () => void
-}
-
-export interface IMCPManagerModalProps {
- open: boolean
- onClose: (open: boolean) => void
-}
-
-const MCPManagerModal = memo(
- forwardRef<IMCPManagerModalRef, IMCPManagerModalProps>(
- ({ open, onClose }, ref) => {
- const { t } = useTransClient('account')
- const [mcpKeys, setMcpKeys] = useState<any[]>([])
- const [isCreateModalOpen, setIsCreateModalOpen] = useState(false)
- const [selectedAccounts, setSelectedAccounts] = useState<SocialAccount[]>([])
- const [newKeyName, setNewKeyName] = useState('')
- const [loading, setLoading] = useState(false)
- const [currentPage, setCurrentPage] = useState(1)
- const [pageSize, setPageSize] = useState(10)
- const [total, setTotal] = useState(0)
- const [createForm] = Form.useForm()
- const [showAccountSelector, setShowAccountSelector] = useState(false)
- const [showDetailModal, setShowDetailModal] = useState(false)
- const [selectedKeyInfo, setSelectedKeyInfo] = useState<any>(null)
-
- // 获取MCP Key列表
- const fetchMCPKeys = async () => {
- try {
- setLoading(true)
- const res: any = await apiGetMCPKeyList(currentPage, pageSize)
- if (res?.code === 0) {
- setMcpKeys(res.data.list || [])
- setTotal(res.data.total || 0)
- }
- }
- catch (error) {
- toast.error(t('mcpManager.fetchKeysFailed'))
- }
- finally {
- setLoading(false)
- }
- }
-
- // 初始化数据
- useEffect(() => {
- if (open) {
- fetchMCPKeys()
- }
- }, [open, currentPage, pageSize])
-
- const handleCreateKey = () => {
- setIsCreateModalOpen(true)
- }
-
- const handleAccountConfirm = async (accounts: SocialAccount[]) => {
- try {
- setLoading(true)
-
- // 创建MCP Key
- const createParams: any = {
- desc: newKeyName,
- accounts: accounts.map(account => account.id),
- }
-
- const createRes = await apiCreateMCPKey(createParams)
- if (createRes?.code !== 0) {
- toast.error(t('mcpManager.createKeyFailed'))
- return
- }
-
- // 创建关联(如果选择了多个账户,需要多次请求)
- // const createdKey = (createRes.data as any)?.key
- // if (createdKey) {
- // for (const account of accounts) {
- // try {
- // await apiCreateMCPRef({
- // key: createdKey,
- // accountId: account.id,
- // })
- // }
- // catch (error) {
- // console.error(t('mcpManager.createAssociationFailed', { account: account.account }), error)
- // }
- // }
- // }
-
- setSelectedAccounts([])
- setIsCreateModalOpen(false)
- setNewKeyName('')
- toast.success(t('mcpManager.createSuccess'))
- fetchMCPKeys() // 刷新列表
- }
- catch (error) {
- toast.error(t('mcpManager.createKeyFailed'))
- }
- finally {
- setLoading(false)
- }
- }
-
- const handleCopyKey = (key: string) => {
- navigator.clipboard.writeText(key)
- toast.success(t('mcpManager.keyCopied'))
- }
-
- const handleDeleteKey = async (key: string) => {
- try {
- const res = await apiDeleteMCPKey(key)
- if (res?.code === 0) {
- toast.success(t('mcpManager.deleteSuccess'))
- fetchMCPKeys() // 刷新列表
- }
- else {
- toast.error(t('mcpManager.deleteFailed'))
- }
- }
- catch (error) {
- toast.error(t('mcpManager.deleteFailed'))
- }
- }
-
- useImperativeHandle(ref, () => ({
- open: () => onClose(true),
- close: () => onClose(false),
- }))
-
- return (
- <>
- <Modal
- title={(
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <KeyOutlined style={{ color: '#625BF2' }} />
- {t('mcpManager.title')}
- </div>
- )}
- open={open}
- onCancel={() => onClose(false)}
- footer={null}
- width={800}
- className={styles.mcpManagerModal}
- >
- <div style={{ marginBottom: 16 }}>
- <Button
- type="primary"
- icon={<PlusOutlined />}
- onClick={handleCreateKey}
- className={styles.createButton}
- loading={loading}
- >
- {t('mcpManager.createNewKey')}
- </Button>
- </div>
-
- {mcpKeys.length === 0 && !loading
- ? (
- <div className={styles.emptyState}>
- <div className="emptyIcon">
- <KeyOutlined />
- </div>
- <div className="emptyText">{t('mcpManager.noKeys')}</div>
- <div className="emptyDesc">{t('mcpManager.noKeysDesc')}</div>
- </div>
- )
- : (
- <>
- <List
- className={styles.mcpKeyList}
- dataSource={mcpKeys}
- loading={loading}
- renderItem={item => (
- <List.Item
- actions={[
- <Button
- key="copy"
- type="link"
- icon={<CopyOutlined />}
- onClick={() => handleCopyKey(item.key)}
- >
- {t('mcpManager.copy')}
- </Button>,
- <Button
- key="detail"
- type="link"
- icon={<KeyOutlined />}
- onClick={() => {
- setSelectedKeyInfo(item)
- setShowDetailModal(true)
- }}
- >
- {t('mcpManager.detail')}
- </Button>,
- <Button
- key="delete"
- type="link"
- danger
- icon={<DeleteOutlined />}
- onClick={() => handleDeleteKey(item.key)}
- loading={loading}
- >
- {t('mcpManager.delete')}
- </Button>,
- ]}
- >
- <List.Item.Meta
- avatar={<Avatar style={{ background: 'linear-gradient(90deg, #625BF2 0%, #925BF2 100%)' }}>MCP</Avatar>}
- title={(
- <Space>
- <span>{item.desc}</span>
- <Tag color={item.status === 'ACTIVE' ? 'green' : 'red'}>
- {item.status}
- </Tag>
- </Space>
- )}
- description={(
- <div>
- <div className="keyDisplay">
- {item.key}
- </div>
- <div className="keyInfo">
- <div className="infoItem">
- <span className="label">{t('mcpManager.createdAt')}</span>
- <span>
- {' '}
- {dayjs(item.createdAt).format('YYYY-MM-DD HH:mm:ss')}
- </span>
- </div>
- <div className="infoItem">
- <span className="label">{t('mcpManager.associatedAccounts')}</span>
- <span>
- {' '}
- {item.accountNum}
- {' '}
- {t('mcpManager.accountUnit')}
- </span>
- </div>
- </div>
- </div>
- )}
- />
- </List.Item>
- )}
- />
-
- {total > 0 && (
- <div style={{ marginTop: 16, textAlign: 'right' }}>
- <Pagination
- current={currentPage}
- pageSize={pageSize}
- total={total}
- showSizeChanger
- showQuickJumper
- showTotal={(total, range) => t('mcpManager.pagination', { start: range[0], end: range[1], total })}
- onChange={(page, size) => {
- setCurrentPage(page)
- setPageSize(size)
- }}
- />
- </div>
- )}
- </>
- )}
- </Modal>
-
- <Modal
- title={t('mcpManager.createModal.title')}
- open={isCreateModalOpen}
- onCancel={() => {
- setIsCreateModalOpen(false)
- setSelectedAccounts([])
- setNewKeyName('')
- createForm.resetFields()
- }}
- footer={null}
- width={600}
- >
- <Form
- form={createForm}
- layout="vertical"
- onFinish={(values) => {
- if (selectedAccounts.length === 0) {
- toast.warning(t('mcpManager.createModal.selectAccountsRequired'))
- return
- }
- handleAccountConfirm(selectedAccounts)
- }}
- >
- <Form.Item
- label={t('mcpManager.createModal.keyName')}
- name="name"
- rules={[{ required: true, message: t('mcpManager.createModal.keyNameRequired') }]}
- >
- <Input
- placeholder={t('mcpManager.createModal.keyNamePlaceholder')}
- value={newKeyName}
- onChange={e => setNewKeyName(e.target.value)}
- />
- </Form.Item>
-
- <Form.Item label={t('mcpManager.createModal.selectAccounts')}>
- <div style={{ minHeight: 100, border: '1px dashed #d9d9d9', padding: 16, borderRadius: 6 }}>
- {selectedAccounts.length === 0
- ? (
- <div style={{ textAlign: 'center', color: '#999' }}>
- {t('mcpManager.createModal.selectAccountsPlaceholder')}
- </div>
- )
- : (
- <div>
- <div style={{ marginBottom: 8, fontWeight: 500 }}>
- {t('mcpManager.createModal.selectedCount', { count: selectedAccounts.length })}
- </div>
- {selectedAccounts.map(account => (
- <Tag key={account.id} style={{ marginBottom: 4 }}>
- {account.nickname}
- </Tag>
- ))}
- </div>
- )}
- <Button
- type="dashed"
- onClick={() => {
- setShowAccountSelector(true)
- }}
- style={{ marginTop: 8 }}
- >
- {t('mcpManager.createModal.selectAccountsButton')}
- </Button>
- </div>
- </Form.Item>
-
- <Form.Item>
- <Space>
- <Button
- type="primary"
- htmlType="submit"
- loading={loading}
- >
- {t('mcpManager.createModal.create')}
- </Button>
- <Button
- onClick={() => {
- setIsCreateModalOpen(false)
- setSelectedAccounts([])
- setNewKeyName('')
- createForm.resetFields()
- }}
- >
- {t('mcpManager.createModal.cancel')}
- </Button>
- </Space>
- </Form.Item>
- </Form>
- </Modal>
-
- <ChooseAccountModule
- open={showAccountSelector}
- onClose={() => setShowAccountSelector(false)}
- onAccountConfirm={(accounts) => {
- setSelectedAccounts(accounts)
- setShowAccountSelector(false)
- }}
- simpleAccountChooseProps={{
- choosedAccounts: selectedAccounts,
- disableAllSelect: false,
- isCancelChooseAccount: true,
- }}
- />
-
- <MCPKeyDetailModal
- open={showDetailModal}
- onClose={(open) => {
- setShowDetailModal(open)
- if (!open) {
- setSelectedKeyInfo(null)
- }
- }}
- keyInfo={selectedKeyInfo}
- />
- </>
- )
- },
- ),
-)
-
-MCPManagerModal.displayName = 'MCPManagerModal'
-
-export default MCPManagerModal
diff --git a/project/web/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx b/project/web/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
deleted file mode 100644
index 94e25e21..00000000
--- a/project/web/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
+++ /dev/null
@@ -1,562 +0,0 @@
-import type {
- TableProps,
-} from 'antd'
-import type {
- ForwardedRef,
-} from 'react'
-import type { SocialAccount } from '@/api/types/account.type'
-import type { IpLocationInfo } from '@/utils/ipLocation'
-import {
- CheckCircleOutlined,
- DeleteOutlined,
- EnvironmentOutlined,
- GlobalOutlined,
- WarningOutlined,
-} from '@ant-design/icons'
-import {
- Button,
- Card,
- Drawer,
- Modal,
- Select,
- Space,
- Spin,
- Table,
- Tooltip,
-} from 'antd'
-import { toast } from 'sonner'
-import {
- forwardRef,
- memo,
- useEffect,
- useImperativeHandle,
- useMemo,
- useRef,
- useState,
-} from 'react'
-import { useShallow } from 'zustand/react/shallow'
-import { deleteAccountsApi, updateAccountApi } from '@/api/account'
-import DeleteUserConfirmModal from '@/app/[lng]/accounts/components/AccountSidebar/DeleteUserConfirmModal'
-import { AccountStatus } from '@/app/config/accountConfig'
-import { AccountPlatInfoMap } from '@/app/config/platConfig'
-import { useTransClient } from '@/app/i18n/client'
-import AvatarPlat from '@/components/AvatarPlat'
-import { useAccountStore } from '@/store/account'
-import { extractCountry, formatLocationInfo, getIpLocation } from '@/utils/ipLocation'
-import AddAccountModal from '../AddAccountModal'
-import styles from './AccountSidebar.module.scss'
-import UserManageSidebar from './UserManageSidebar'
-
-export interface IUserManageModalRef {
- setActiveGroup: (groupId: string) => void
-}
-
-export interface IUserManageModalProps {
- open: boolean
- onCancel: () => void
-}
-
-function UserGroupSelect({
- account,
- onChange,
-}: {
- account: SocialAccount
- onChange: (groupId: string) => void
-}) {
- const { accountGroupList } = useAccountStore(
- useShallow(state => ({
- accountGroupList: state.accountGroupList,
- })),
- )
-
- return (
- <Select
- // @ts-ignore
- value={account.groupId}
- style={{ width: '160px' }}
- fieldNames={{
- value: 'id',
- label: 'name',
- }}
- options={accountGroupList}
- onChange={onChange}
- />
- )
-}
-
-// 空间信息展示组件
-function SpaceInfoCard({
- activeGroup,
- accountGroupList,
- allUser,
-}: {
- activeGroup: string
- accountGroupList: any[]
- allUser: string
-}) {
- const { t } = useTransClient('account')
- const [ipLocationInfo, setIpLocationInfo] = useState<IpLocationInfo | null>(null)
- const [ipLocationLoading, setIpLocationLoading] = useState(false)
-
- // 获取IP地理位置信息
- useEffect(() => {
- const fetchIpLocation = async () => {
- try {
- setIpLocationLoading(true)
- const info = await getIpLocation()
- setIpLocationInfo(info)
- }
- catch (error) {
- console.error('获取IP地理位置信息失败:', error)
- }
- finally {
- setIpLocationLoading(false)
- }
- }
-
- // 只在组件挂载时获取一次IP信息
- fetchIpLocation()
- }, [])
-
- // 如果是全部账号,不显示信息卡片
- if (activeGroup === allUser) {
- return null
- }
-
- // 获取当前选中的空间信息
- const currentSpace = accountGroupList.find(group => group.id === activeGroup)
- if (!currentSpace)
- return null
-
- return (
- <Card
- size="small"
- style={{
- marginBottom: '16px',
- backgroundColor: 'var(--grayColor1)',
- border: '1px solid var(--grayColor3)',
- }}
- >
- <Space direction="vertical" size="small" style={{ width: '100%' }}>
- {/* <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
- <span style={{
- fontSize: 'var(--fs-xs)',
- color: 'var(--grayColor6)',
- backgroundColor: 'var(--grayColor2)',
- padding: '2px 8px',
- borderRadius: '12px'
- }}>
- {currentSpace.children?.length || 0} {t('userManage.accounts')}
- </span>
- </div> */}
-
- {/* 根据proxyIp判断显示IP和属地信息 */}
- {(!currentSpace.proxyIp || currentSpace.proxyIp === '') ? (
- // 本地IP显示
- <div style={{
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- padding: '8px',
- backgroundColor: 'var(--grayColor2)',
- borderRadius: '6px',
- }}
- >
- <GlobalOutlined style={{ color: 'var(--colorPrimary5)' }} />
- <span style={{ fontSize: 'var(--fs-xs)', color: 'var(--grayColor7)' }}>
- {t('ipInfo.loading')}
- </span>
- {ipLocationLoading
- ? (
- <span style={{ color: 'var(--colorPrimary5)', fontStyle: 'italic' }}>
- {t('ipInfo.loading')}
- </span>
- )
- : ipLocationInfo
- ? (
- <Tooltip title={t('ipInfo.tooltip', { asn: ipLocationInfo.asn, org: ipLocationInfo.org })}>
- <span style={{
- color: 'var(--grayColor7)',
- cursor: 'help',
- fontWeight: '500',
- }}
- >
- {formatLocationInfo(ipLocationInfo)}
- </span>
- </Tooltip>
- )
- : (
- <span style={{ color: 'var(--errorColor)', fontStyle: 'italic' }}>
- {t('ipInfo.error')}
- </span>
- )}
- </div>
- )
- : (
- currentSpace.ip && currentSpace.location && (
- <div style={{
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- padding: '8px',
- backgroundColor: 'var(--grayColor2)',
- borderRadius: '6px',
- }}
- >
- <GlobalOutlined style={{ color: 'var(--colorPrimary5)' }} />
- <Tooltip title={`IP: ${currentSpace.ip}\n位置: ${currentSpace.location}`}>
- <span style={{
- color: 'var(--grayColor7)',
- cursor: 'help',
- fontWeight: '500',
- }}
- >
- {extractCountry(currentSpace.location)}
- {' '}
- |
- {currentSpace.ip}
- </span>
- </Tooltip>
- </div>
- )
- )}
-
- {/* 空间创建时间等信息 */}
- <div style={{
- fontSize: 'var(--fs-xs)',
- color: 'var(--grayColor6)',
- display: 'flex',
- alignItems: 'center',
- gap: '4px',
- }}
- >
- <EnvironmentOutlined />
- <span>
- 空间ID:
- {currentSpace.id}
- </span>
- {currentSpace.isDefault && (
- <span style={{
- color: 'var(--colorPrimary5)',
- backgroundColor: 'var(--colorPrimary1)',
- padding: '1px 6px',
- borderRadius: '10px',
- fontSize: 'var(--fs-xs)',
- }}
- >
- defaultSpace
- </span>
- )}
- </div>
- </Space>
- </Card>
- )
-}
-
-const UserManageModal = memo(
- forwardRef(
- (
- { open, onCancel }: IUserManageModalProps,
- ref: ForwardedRef<IUserManageModalRef>,
- ) => {
- const { t } = useTransClient('account')
- const { accountList, getAccountList, accountGroupList, accountMap }
- = useAccountStore(
- useShallow(state => ({
- accountList: state.accountList,
- getAccountList: state.getAccountList,
- accountGroupList: state.accountGroupList,
- accountMap: state.accountMap,
- })),
- )
- const [deleteHitOpen, setDeleteHitOpen] = useState(false)
- const [selectedRows, setSelectedRows] = useState<SocialAccount[]>([])
- // 全部账号
- const allUser = useRef('-1')
- // -1=全部账号,不然为对应分组 ID
- const [activeGroup, setActiveGroup] = useState(allUser.current)
- // 是否改变了顺序
- const isUpdateRank = useRef(false)
- const [deleteLoading, setDeleteLoading] = useState(false)
- const [cutLoading, setCutLoading] = useState(false)
- const [isAddAccountOpen, setIsAddAccountOpen] = useState(false)
- const [targetGroupIdForModal, setTargetGroupIdForModal] = useState<string | undefined>(undefined)
-
- const columns = useMemo(() => {
- const columns: TableProps<SocialAccount>['columns'] = [
- {
- title: t('userManageModal.account'),
- render: (text, am) => {
- return (
- <div
- className={`userManage-content-user ${am.status === AccountStatus.DISABLE ? 'userManage-content-user--disable' : ''}`}
- >
- {/* <Avatar src={am.avatar} /> */}
- <AvatarPlat account={am} size="large" />
- <span
- className="userManage-content-user-name"
- title={am.nickname}
- >
- {am.nickname}
- </span>
- </div>
- )
- },
- width: 200,
- key: 'nickname',
- },
- {
- title: t('userManageModal.platform'),
- render: (text, am) => {
- const platInfo = AccountPlatInfoMap.get(am.type)!
- return (
- <div className="userManage-content-plat">
- <Tooltip title={platInfo?.name}>
- <img
- src={platInfo?.icon}
- style={{
- width: '20px',
- height: '20px',
- }}
- />
- </Tooltip>
- </div>
- )
- },
- width: 80,
- key: 'nickname',
- },
- {
- title: t('accountStatus'),
- render: (text, am) => {
- return (
- <>
- {am.status === AccountStatus.USABLE
- ? (
- <>
- <CheckCircleOutlined
- style={{
- color: 'var(--successColor)',
- marginRight: '3px',
- }}
- />
- {t('online')}
- </>
- )
- : (
- <>
- <WarningOutlined
- style={{
- color: 'var(--warningColor)',
- marginRight: '3px',
- }}
- />
- {t('offline')}
- </>
- )}
- </>
- )
- },
- width: 100,
- key: 'nickname',
- },
- {
- title: t('userManageModal.space'),
- render: (text, am) => {
- return (
- <UserGroupSelect
- account={am}
- onChange={async (groupId) => {
- setCutLoading(true)
- await updateAccountGroupRank()
- await updateAccountApi({
- id: am.id,
- groupId,
- })
- await getAccountList()
- setCutLoading(false)
- }}
- />
- )
- },
- width: 200,
- key: 'groupId',
- },
- ]
- return columns
- }, [])
-
- const rowSelection: TableProps<SocialAccount>['rowSelection'] = {
- onChange: (
- selectedRowKeys: React.Key[],
- selectedRows: SocialAccount[],
- ) => {
- setSelectedRows(selectedRows)
- },
- getCheckboxProps: (record: SocialAccount) => ({
- name: record.nickname,
- }),
- selectedRowKeys: selectedRows.map(v => v.id),
- }
-
- const close = () => {
- onCancel()
- setSelectedRows([])
- updateAccountGroupRank()
- }
-
- // 更新账户组顺序
- const updateAccountGroupRank = async () => {
- if (isUpdateRank.current) {
- const accountGroupList = useAccountStore.getState().accountGroupList
- for (let i = 0; i < accountGroupList.length; i++) {
- const v = accountGroupList[i]
- // 这里不需要更新数据,因为在排序完成后已经更新了全局的sotre,引用sotre的所有位置都会发生更改
- // TODO 排序更新
- // await icpEditDeleteAccountGroup({
- // id: v.id,
- // rank: i,
- // });
- }
- isUpdateRank.current = false
- }
- }
-
- const accountListLast = useMemo(() => {
- if (activeGroup === allUser.current) {
- return accountList
- }
- return accountGroupList.find(v => v.id === activeGroup)?.children
- }, [accountMap, activeGroup, accountGroupList])
-
- const imperativeHandle: IUserManageModalRef = {
- setActiveGroup,
- }
- useImperativeHandle(ref, () => imperativeHandle)
-
- const openAddAccountFlow = async () => {
- const currentGroupId = activeGroup
- close()
- if (currentGroupId === allUser.current) {
- // 如果选择的是"全部账号",需要用户选择空间
- setIsAddAccountOpen(true)
- }
- else {
- // 如果选择的是具体空间,直接使用该空间
- setTargetGroupIdForModal(currentGroupId)
- setIsAddAccountOpen(true)
- }
- }
-
- return (
- <>
- <DeleteUserConfirmModal
- deleteUsers={selectedRows}
- open={deleteHitOpen}
- onClose={() => setDeleteHitOpen(false)}
- onDeleteSuccess={async () => {
- await getAccountList()
- setSelectedRows([])
- toast.success('删除成功')
- }}
- />
-
- <Modal
- open={open}
- title={t('accountManager')}
- zIndex={1001}
- footer={null}
- width={1000}
- onCancel={close}
- rootClassName={styles.userManageModal}
- >
- <Spin spinning={cutLoading}>
- <div className={styles.userManage}>
- <UserManageSidebar
- allUser={allUser.current}
- activeGroup={activeGroup}
- onChange={setActiveGroup}
- onSortEnd={() => {
- isUpdateRank.current = true
- }}
- />
-
- <div className="userManage-content">
- {/* 空间信息卡片 - 显示在右侧上方 */}
- <SpaceInfoCard
- activeGroup={activeGroup}
- accountGroupList={accountGroupList}
- allUser={allUser.current}
- />
-
- <div className="userManage-content-head" style={{ marginBottom: '8px', display: 'flex', justifyContent: 'flex-end' }}>
- <Button type="primary" onClick={openAddAccountFlow}>{t('addAccount')}</Button>
- </div>
- <Table<SocialAccount>
- columns={columns}
- dataSource={accountListLast}
- rowKey="id"
- scroll={{ y: '100%' }}
- rowSelection={{ type: 'checkbox', ...rowSelection }}
- />
-
- <Drawer
- title={(
- <>
- {t('userManage.selected' as any)}
- <span style={{ color: 'var(--successColor)' }}>
- {selectedRows.length}
- </span>
- {t('userManage.accounts' as any)}
- </>
- )}
- placement="bottom"
- mask={false}
- height={150}
- closable={true}
- onClose={() => {
- setSelectedRows([])
- }}
- open={selectedRows.length !== 0}
- getContainer={false}
- >
- <div className="userManage-content-multiple">
- <div
- className="userManage-content-multiple-item"
- onClick={() => {
- setDeleteHitOpen(true)
- }}
- >
- <div className="userManage-content-multiple-item-icon">
- <DeleteOutlined />
- </div>
- <span>{t('userManage.deleteAccount' as any)}</span>
- </div>
- </div>
- </Drawer>
- </div>
- </div>
- </Spin>
- </Modal>
-
- <AddAccountModal
- open={isAddAccountOpen}
- onClose={async () => {
- setIsAddAccountOpen(false)
- setTargetGroupIdForModal(undefined)
- }}
- onAddSuccess={async (acc) => {
- // 账号已经在授权时直接添加到指定空间,无需额外移动
- await getAccountList()
- }}
- targetGroupId={targetGroupIdForModal}
- showSpaceSelector={activeGroup === allUser.current}
- />
- </>
- )
- },
- ),
-)
-UserManageModal.displayName = 'UserManageModal'
-
-export default UserManageModal
diff --git a/project/web/src/app/[lng]/accounts/components/AccountSidebar/UserManageSidebar.tsx b/project/web/src/app/[lng]/accounts/components/AccountSidebar/UserManageSidebar.tsx
deleted file mode 100644
index 6af8de67..00000000
--- a/project/web/src/app/[lng]/accounts/components/AccountSidebar/UserManageSidebar.tsx
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
- * UserManageSidebar - 用户管理侧边栏
- * 账号分组管理侧边栏
- */
-
-import type { ForwardedRef } from 'react'
-import type { AccountGroupItem } from '@/api/types/account.type'
-import {
- PlusOutlined,
- UnorderedListOutlined,
-} from '@ant-design/icons'
-import { ControlledMenu, MenuItem } from '@szhsin/react-menu'
-import { Button, Input } from 'antd'
-import { toast } from '@/lib/toast'
-import { confirm } from '@/lib/confirm'
-import { Modal } from '@/components/ui/modal'
-import { forwardRef, memo, useRef, useState } from 'react'
-import { ReactSortable } from 'react-sortablejs'
-import { useShallow } from 'zustand/react/shallow'
-import {
- createAccountGroupApi,
- deleteAccountGroupApi,
- updateAccountGroupApi,
-} from '@/api/account'
-import { useTransClient } from '@/app/i18n/client'
-import { useAccountStore } from '@/store/account'
-import styles from './AccountSidebar.module.scss'
-import '@szhsin/react-menu/dist/index.css'
-
-export interface IUserManageSidebarRef {}
-
-export interface IUserManageSidebarProps {
- activeGroup: string
- allUser: string
- onChange: (id: string) => void
- onSortEnd: () => void
-}
-
-const MENU_ID = 'userManageSidebar'
-
-const UserManageSidebar = memo(
- forwardRef(
- (
- { activeGroup, allUser, onChange, onSortEnd }: IUserManageSidebarProps,
- ref: ForwardedRef<IUserManageSidebarRef>,
- ) => {
- const { t } = useTransClient('account')
- const {
- accountGroupList,
- accountList,
- setAccountGroupList,
- getAccountGroup,
- getAccountList,
- } = useAccountStore(
- useShallow(state => ({
- accountGroupList: state.accountGroupList,
- accountList: state.accountList,
- getAccountGroup: state.getAccountGroup,
- getAccountList: state.getAccountList,
- setAccountGroupList: state.setAccountGroupList,
- })),
- )
- const [openCreateGroup, setOpenCreateGroup] = useState(false)
- const [groupName, setGroupName] = useState('')
- const [createGroupLoading, setCreateGroupLoading] = useState(false)
- // -1=新建 不然为重命名,值为要重命名的id
- const [createGroupId, setCreateGroupId] = useState('-1')
- const srcollEl = useRef<HTMLElement>(undefined)
- const [isOpen, setOpen] = useState(false)
- const [anchorPoint, setAnchorPoint] = useState({ x: 0, y: 0 })
- // 右键操作的数据
- const [rightClickOperateData, setRightClickOperateData]
- = useState<AccountGroupItem>()
-
- const createGroupCancel = () => {
- setOpenCreateGroup(false)
- setGroupName('')
- }
-
- return (
- <>
- <ControlledMenu
- anchorPoint={anchorPoint}
- state={isOpen ? 'open' : 'closed'}
- direction="right"
- onClose={() => setOpen(false)}
- >
- <MenuItem
- onClick={() => {
- setCreateGroupId(rightClickOperateData!.id)
- setOpenCreateGroup(true)
- setGroupName(rightClickOperateData!.name)
- }}
- >
- {t('userManageSidebar.rename')}
- </MenuItem>
- <MenuItem
- onClick={() => {
- confirm({
- title: t('userManageSidebar.confirmDelete'),
- content: (
- <>
- {t('userManageSidebar.confirmDeleteContent')}
- <span
- style={{
- color: 'var(--colorPrimary6)',
- }}
- >
- {rightClickOperateData?.name}
- </span>
- ?
- </>
- ),
- okType: 'destructive',
- onOk: async () => {
- await deleteAccountGroupApi([rightClickOperateData!.id])
- await getAccountGroup()
- toast.success(t('userManageSidebar.deleteSuccess'))
- },
- })
- }}
- >
- {t('userManageSidebar.delete')}
- </MenuItem>
- </ControlledMenu>
-
- <Modal
- open={openCreateGroup}
- title={createGroupId === '-1' ? t('userManageSidebar.createSpaceTitle') : t('userManageSidebar.renameSpaceTitle')}
- onCancel={createGroupCancel}
- footer={(
- <>
- <Button onClick={createGroupCancel}>{t('userManageSidebar.cancel')}</Button>
- <Button
- type="primary"
- onClick={async () => {
- setCreateGroupLoading(true)
- if (createGroupId === '-1') {
- await createAccountGroupApi({
- name: groupName,
- })
- }
- else {
- await updateAccountGroupApi({
- name: groupName,
- id: createGroupId,
- })
- }
-
- await getAccountGroup()
- setCreateGroupLoading(false)
- createGroupCancel()
- }}
- loading={createGroupLoading}
- >
- {t('userManageSidebar.save')}
- </Button>
- </>
- )}
- >
- <div className={styles.createGroup}>
- <label>{t('userManageSidebar.spaceName')}</label>
- <Input
- value={groupName}
- placeholder={t('userManageSidebar.spaceNamePlaceholder')}
- onChange={e => setGroupName(e.target.value)}
- />
- </div>
- </Modal>
-
- <div className="userManage-sidebar">
- <div className="userManage-sidebar-top">
- <div
- className={[
- 'userManage-sidebar-allUser',
- activeGroup === allUser && 'userManage-sidebar--active',
- ].join(' ')}
- onClick={() => {
- onChange(allUser)
- }}
- >
- <span className="userManage-sidebar-name">{t('userManageSidebar.allAccounts')}</span>
- <span className="userManage-sidebar-count">
- {accountList.length}
- </span>
- </div>
- <div className="userManage-sidebar-list">
- <p className="userManage-sidebar-list-title">{t('userManageSidebar.spaces')}</p>
-
- <ReactSortable
- className="userManage-sidebar-list-sortable"
- list={accountGroupList}
- animation={250}
- onEnd={async () => {
- onSortEnd()
- }}
- setList={setAccountGroupList}
- scrollSensitivity={100}
- scroll={srcollEl.current}
- scrollSpeed={15}
- handle=".userManage-sidebar-sortHandle"
- id="id"
- >
- {accountGroupList.map((v) => {
- return (
- <div
- className={[
- 'userManage-sidebar-list-item',
- activeGroup === v.id && 'userManage-sidebar--active',
- ].join(' ')}
- key={v.id}
- onClick={() => {
- onChange(v.id)
- }}
- onContextMenu={(e) => {
- e.preventDefault()
- if (v.isDefault) {
- return toast.error(t('userManageSidebar.cannotOperateDefault'))
- }
- setAnchorPoint({ x: e.clientX, y: e.clientY })
- setOpen(true)
- setRightClickOperateData(v)
- }}
- >
- <div className="userManage-sidebar-left">
- <div className="userManage-sidebar-sortHandle">
- <UnorderedListOutlined />
- </div>
- <span className="userManage-sidebar-name">
- {v.name}
- </span>
- </div>
- <span className="userManage-sidebar-count">
- {v.children.length}
- </span>
- </div>
- )
- })}
- </ReactSortable>
- </div>
- </div>
- <div className="userManage-sidebar-bottom">
- <Button
- type="primary"
- icon={<PlusOutlined />}
- onClick={() => {
- setCreateGroupId('-1')
- setOpenCreateGroup(true)
- }}
- >
- {t('userManageSidebar.createSpace')}
- </Button>
- </div>
- </div>
- </>
- )
- },
- ),
-)
-UserManageSidebar.displayName = 'UserManageSidebar'
-
-export default UserManageSidebar
diff --git a/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountItem.tsx b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountItem.tsx
new file mode 100644
index 00000000..4ea53474
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountItem.tsx
@@ -0,0 +1,114 @@
+import type { SocialAccount } from '@/api/types/account.type'
+import { DeleteOutlined, EllipsisOutlined, LoadingOutlined } from '@ant-design/icons'
+import Image from 'next/image'
+import { memo, useState } from 'react'
+import { AccountPlatInfoMap } from '@/app/config/platConfig'
+import { useTransClient } from '@/app/i18n/client'
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import { cn } from '@/lib/utils'
+import { getOssUrl } from '@/utils/oss'
+import AccountStatusView from './AccountStatusView'
+
+interface AccountItemProps {
+ account: SocialAccount
+ isActive: boolean
+ onSelect: (account: SocialAccount) => void
+ onDelete: (account: SocialAccount) => void
+ deleteLoading?: string | null
+ indent?: boolean
+}
+
+const AccountItem = memo(({ account, isActive, onSelect, onDelete, deleteLoading, indent = false }: AccountItemProps) => {
+ const { t } = useTransClient('account')
+ const platInfo = AccountPlatInfoMap.get(account.type)
+ const [operationMenuOpen, setOperationMenuOpen] = useState(false)
+ const isDeleting = deleteLoading === account.id
+
+ const handleDelete = (e: React.MouseEvent) => {
+ e.stopPropagation()
+ setOperationMenuOpen(false)
+ onDelete(account)
+ }
+
+ return (
+ <div
+ onClick={() => !isDeleting && onSelect(account)}
+ className={cn(
+ 'flex items-center gap-3 px-3 py-2 mx-2 rounded-sm transition-colors group relative',
+ indent && 'ml-8',
+ isActive && 'bg-accent text-accent-foreground',
+ isDeleting ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-muted/50',
+ )}
+ >
+ <Avatar className="h-8 w-8 shrink-0">
+ <AvatarImage src={getOssUrl(account.avatar)} alt={account.nickname} />
+ <AvatarFallback>
+ {account.nickname?.[0] || account.account?.[0]}
+ </AvatarFallback>
+ </Avatar>
+
+ <div className="flex-1 min-w-0">
+ <div className="text-sm font-medium truncate">
+ {account.nickname || account.account}
+ </div>
+ <div className="flex items-center gap-2 mt-1 flex-wrap">
+ {platInfo?.icon && (
+ <Image
+ src={platInfo.icon}
+ alt={platInfo.name}
+ width={16}
+ height={16}
+ className="rounded-sm shrink-0"
+ />
+ )}
+ <span className="text-xs text-muted-foreground shrink-0">
+ {platInfo?.name}
+ </span>
+ <AccountStatusView account={account} />
+ {account.fansCount !== undefined && account.fansCount !== null && (
+ <span className="text-xs text-muted-foreground shrink-0">
+ {t('fansCount')}: {account.fansCount ?? 0}
+ </span>
+ )}
+ </div>
+ </div>
+
+ {isDeleting ? (
+ <div className="p-1">
+ <LoadingOutlined className="h-4 w-4 text-muted-foreground animate-spin" />
+ </div>
+ ) : (
+ <DropdownMenu open={operationMenuOpen} onOpenChange={setOperationMenuOpen}>
+ <DropdownMenuTrigger asChild>
+ <button
+ onClick={(e) => {
+ e.stopPropagation()
+ setOperationMenuOpen(true)
+ }}
+ className="opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-muted rounded cursor-pointer"
+ >
+ <EllipsisOutlined className="h-4 w-4 text-muted-foreground" />
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={handleDelete} className="text-destructive">
+ <DeleteOutlined className="mr-2" />
+ {t('deleteAccount')}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ </div>
+ )
+})
+
+AccountItem.displayName = 'AccountItem'
+
+export default AccountItem
+
diff --git a/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountSearchBar.tsx b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountSearchBar.tsx
new file mode 100644
index 00000000..6896d989
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountSearchBar.tsx
@@ -0,0 +1,32 @@
+import { Search } from 'lucide-react'
+import { memo } from 'react'
+import { useTransClient } from '@/app/i18n/client'
+import { Input } from '@/components/ui/input'
+
+interface AccountSearchBarProps {
+ searchText: string
+ onSearchChange: (text: string) => void
+}
+
+const AccountSearchBar = memo(({ searchText, onSearchChange }: AccountSearchBarProps) => {
+ const { t } = useTransClient('account')
+
+ return (
+ <div className="p-2">
+ <div className="relative">
+ <Search className="absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
+ <Input
+ placeholder={t('listMode.searchChannels')}
+ value={searchText}
+ onChange={e => onSearchChange(e.target.value)}
+ className="pl-8"
+ />
+ </div>
+ </div>
+ )
+})
+
+AccountSearchBar.displayName = 'AccountSearchBar'
+
+export default AccountSearchBar
+
diff --git a/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountSelector.tsx b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountSelector.tsx
new file mode 100644
index 00000000..511f7882
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountSelector.tsx
@@ -0,0 +1,189 @@
+import type { SocialAccount } from '@/api/types/account.type'
+import type { AccountGroup } from '@/store/account'
+import { ChevronDown, Layers } from 'lucide-react'
+import { memo } from 'react'
+import { useTransClient } from '@/app/i18n/client'
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import { ScrollArea } from '@/components/ui/scroll-area'
+import { cn } from '@/lib/utils'
+import { getOssUrl } from '@/utils/oss'
+import AccountSearchBar from './AccountSearchBar'
+import AllChannelsItem from './AllChannelsItem'
+import AccountItem from './AccountItem'
+import SpaceGroupItem from './SpaceGroupItem'
+
+interface AccountSelectorProps {
+ accountActive?: SocialAccount
+ accountList: SocialAccount[]
+ accountGroupList: AccountGroup[]
+ filteredAccounts: SocialAccount[]
+ collapsedSpaces: Set<string>
+ showSpaceGroups: boolean
+ sortedGroups: AccountGroup[]
+ sortLoading?: string | null
+ deleteLoading?: string | null
+ onAccountSelect: (account: SocialAccount | undefined) => void
+ onAccountDelete: (account: SocialAccount) => void
+ onToggleSpaceCollapse: (spaceId: string) => void
+ onGroupSort: (groupId: string, direction: 'up' | 'down') => void
+ onGroupDelete: (group: AccountGroup) => void
+ searchText: string
+ onSearchChange: (text: string) => void
+}
+
+const AccountSelector = memo(({
+ accountActive,
+ accountList,
+ accountGroupList,
+ filteredAccounts,
+ collapsedSpaces,
+ showSpaceGroups,
+ sortedGroups,
+ sortLoading,
+ deleteLoading,
+ onAccountSelect,
+ onAccountDelete,
+ onToggleSpaceCollapse,
+ onGroupSort,
+ onGroupDelete,
+ searchText,
+ onSearchChange,
+}: AccountSelectorProps) => {
+ const { t } = useTransClient('account')
+
+ return (
+ <div className="flex items-center">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ className={cn(
+ 'flex items-center gap-2 px-3 py-2 rounded-md border border-border',
+ 'hover:bg-muted cursor-pointer transition-colors',
+ 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
+ 'min-w-[200px]',
+ )}
+ >
+ {accountActive
+ ? (
+ <>
+ <Avatar className="h-8 w-8 shrink-0">
+ <AvatarImage src={getOssUrl(accountActive.avatar)} alt={accountActive.nickname} />
+ <AvatarFallback>
+ {accountActive.nickname?.[0] || accountActive.account?.[0]}
+ </AvatarFallback>
+ </Avatar>
+ <span className="flex-1 truncate text-sm text-foreground text-left">
+ {accountActive.nickname || accountActive.account}
+ </span>
+ <ChevronDown className="h-4 w-4 text-muted-foreground shrink-0" />
+ </>
+ )
+ : (
+ <>
+ <Layers className="h-8 w-8 shrink-0 text-muted-foreground" />
+ <span className="flex-1 text-sm text-foreground text-left">
+ {t('allChannels')}
+ </span>
+ <ChevronDown className="h-4 w-4 text-muted-foreground shrink-0" />
+ </>
+ )}
+ </button>
+ </DropdownMenuTrigger>
+
+ <DropdownMenuContent align="end" className="w-[360px]">
+ <AccountSearchBar searchText={searchText} onSearchChange={onSearchChange} />
+
+ <AllChannelsItem
+ isActive={!accountActive}
+ onClick={() => onAccountSelect(undefined)}
+ />
+
+ <DropdownMenuSeparator />
+
+ {/* 账号列表 - 按空间分组显示 */}
+ <ScrollArea className="h-[420px]">
+ {showSpaceGroups
+ ? (
+ // 多空间: 按空间分组显示,支持折叠
+ sortedGroups.length > 0
+ ? sortedGroups.map((group) => {
+ const isCollapsed = collapsedSpaces.has(group.id)
+ const groupAccounts = filteredAccounts.filter(account =>
+ group.children.some(child => child.id === account.id)
+ )
+ const isDefaultGroup = group.isDefault
+ const currentIndex = sortedGroups.findIndex(g => g.id === group.id)
+ const canMoveUp = !isDefaultGroup && currentIndex > 0
+ const canMoveDown = !isDefaultGroup && currentIndex < sortedGroups.length - 1
+ const canDelete = !isDefaultGroup
+
+ return (
+ <SpaceGroupItem
+ key={group.id}
+ group={group}
+ accounts={groupAccounts}
+ isCollapsed={isCollapsed}
+ isDefaultGroup={isDefaultGroup}
+ canMoveUp={canMoveUp}
+ canMoveDown={canMoveDown}
+ canDelete={canDelete}
+ activeAccountId={accountActive?.id}
+ sortLoading={sortLoading}
+ deleteLoading={deleteLoading}
+ onToggleCollapse={onToggleSpaceCollapse}
+ onSelectAccount={onAccountSelect}
+ onDeleteAccount={onAccountDelete}
+ onGroupSort={onGroupSort}
+ onGroupDelete={onGroupDelete}
+ />
+ )
+ })
+ : (
+ <div className="text-center text-muted-foreground text-sm py-8">
+ {accountList.length === 0
+ ? t('sidebar.noAccounts')
+ : t('listMode.noChannelsFound')}
+ </div>
+ )
+ )
+ : (
+ // 单空间: 直接显示所有账号
+ filteredAccounts.length > 0
+ ? filteredAccounts.map((account) => {
+ const isActive = accountActive?.id === account.id
+ return (
+ <AccountItem
+ key={account.id}
+ account={account}
+ isActive={isActive}
+ onSelect={onAccountSelect}
+ onDelete={onAccountDelete}
+ deleteLoading={deleteLoading}
+ />
+ )
+ })
+ : (
+ <div className="text-center text-muted-foreground text-sm py-8">
+ {accountList.length === 0
+ ? t('sidebar.noAccounts')
+ : t('listMode.noChannelsFound')}
+ </div>
+ )
+ )}
+ </ScrollArea>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ )
+})
+
+AccountSelector.displayName = 'AccountSelector'
+
+export default AccountSelector
+
diff --git a/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountStatusView.tsx b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountStatusView.tsx
new file mode 100644
index 00000000..b0d109a3
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AccountStatusView.tsx
@@ -0,0 +1,26 @@
+import type { SocialAccount } from '@/api/types/account.type'
+import { CheckCircleOutlined, WarningOutlined } from '@ant-design/icons'
+import { AccountStatus } from '@/app/config/accountConfig'
+import { useTransClient } from '@/app/i18n/client'
+
+const AccountStatusView = ({ account }: { account: SocialAccount }) => {
+ const { t } = useTransClient('account')
+ if (account.status === AccountStatus.USABLE) {
+ return (
+ <span className="flex items-center gap-1 text-xs text-success">
+ <CheckCircleOutlined className="text-xs" />
+ {t('online')}
+ </span>
+ )
+ }
+
+ return (
+ <span className="flex items-center gap-1 text-xs text-warning">
+ <WarningOutlined className="text-xs" />
+ {t('offline')}
+ </span>
+ )
+}
+
+export default AccountStatusView
+
diff --git a/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AllChannelsItem.tsx b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AllChannelsItem.tsx
new file mode 100644
index 00000000..a8bb5cc1
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/AllChannelsItem.tsx
@@ -0,0 +1,39 @@
+import { Layers } from 'lucide-react'
+import { memo } from 'react'
+import { useTransClient } from '@/app/i18n/client'
+import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
+import { cn } from '@/lib/utils'
+
+interface AllChannelsItemProps {
+ isActive: boolean
+ onClick: () => void
+}
+
+const AllChannelsItem = memo(({ isActive, onClick }: AllChannelsItemProps) => {
+ const { t } = useTransClient('account')
+
+ return (
+ <DropdownMenuItem
+ onClick={onClick}
+ className={cn(
+ 'flex items-center gap-3 px-3 py-3 cursor-pointer mx-2',
+ isActive && 'bg-accent text-accent-foreground',
+ )}
+ >
+ <Layers className="h-8 w-8 shrink-0 text-muted-foreground" />
+ <div className="flex-1">
+ <div className="text-sm font-medium">
+ {t('allChannels')}
+ </div>
+ <div className="text-xs text-muted-foreground mt-0.5">
+ {t('viewAllChannels')}
+ </div>
+ </div>
+ </DropdownMenuItem>
+ )
+})
+
+AllChannelsItem.displayName = 'AllChannelsItem'
+
+export default AllChannelsItem
+
diff --git a/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/ContextMenu.tsx b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/ContextMenu.tsx
new file mode 100644
index 00000000..ec355630
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/ContextMenu.tsx
@@ -0,0 +1,124 @@
+import type { AccountGroupItem } from '@/api/types/account.type'
+import type { SocialAccount } from '@/api/types/account.type'
+import { DeleteOutlined, DownOutlined, UpOutlined } from '@ant-design/icons'
+import { memo, useEffect } from 'react'
+import { useTransClient } from '@/app/i18n/client'
+
+interface ContextMenuProps {
+ open: boolean
+ x: number
+ y: number
+ target: 'account' | 'group'
+ data: SocialAccount | AccountGroupItem | null
+ sortedGroups: AccountGroupItem[]
+ onClose: () => void
+ onAccountDelete: (account: SocialAccount) => void
+ onGroupSort: (groupId: string, direction: 'up' | 'down') => void
+ onGroupDelete: (group: AccountGroupItem) => void
+}
+
+const ContextMenu = memo(({
+ open,
+ x,
+ y,
+ target,
+ data,
+ sortedGroups,
+ onClose,
+ onAccountDelete,
+ onGroupSort,
+ onGroupDelete,
+}: ContextMenuProps) => {
+ const { t } = useTransClient('account')
+
+ useEffect(() => {
+ if (!open) return
+
+ const handleClickOutside = () => {
+ onClose()
+ }
+
+ document.addEventListener('click', handleClickOutside)
+ return () => {
+ document.removeEventListener('click', handleClickOutside)
+ }
+ }, [open, onClose])
+
+ if (!open || !data) return null
+
+ return (
+ <div
+ className="fixed z-[9999] min-w-[160px] rounded-md border bg-popover p-1 shadow-md"
+ style={{
+ left: x,
+ top: y,
+ }}
+ onClick={(e) => e.stopPropagation()}
+ >
+ {target === 'account' && (
+ <button
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-sm hover:bg-muted rounded-sm text-destructive cursor-pointer"
+ onClick={() => {
+ onAccountDelete(data as SocialAccount)
+ onClose()
+ }}
+ >
+ <DeleteOutlined />
+ {t('deleteAccount')}
+ </button>
+ )}
+ {target === 'group' && (() => {
+ const group = data as AccountGroupItem
+ const isDefaultGroup = group.isDefault
+ const currentIndex = sortedGroups.findIndex(g => g.id === group.id)
+ const canMoveUp = !isDefaultGroup && currentIndex > 0
+ const canMoveDown = !isDefaultGroup && currentIndex < sortedGroups.length - 1
+ const canDelete = !isDefaultGroup
+
+ return (
+ <>
+ <button
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-sm hover:bg-muted rounded-sm disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"
+ onClick={() => {
+ onGroupSort(group.id, 'up')
+ onClose()
+ }}
+ disabled={!canMoveUp}
+ >
+ <UpOutlined />
+ {t('sidebar.moveUp')}
+ </button>
+ <button
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-sm hover:bg-muted rounded-sm disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"
+ onClick={() => {
+ onGroupSort(group.id, 'down')
+ onClose()
+ }}
+ disabled={!canMoveDown}
+ >
+ <DownOutlined />
+ {t('sidebar.moveDown')}
+ </button>
+ <div className="h-px bg-border my-1" />
+ <button
+ className="w-full flex items-center gap-2 px-2 py-1.5 text-sm hover:bg-muted rounded-sm text-destructive disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"
+ onClick={() => {
+ onGroupDelete(group)
+ onClose()
+ }}
+ disabled={!canDelete}
+ >
+ <DeleteOutlined />
+ {t('userManageSidebar.delete')}
+ </button>
+ </>
+ )
+ })()}
+ </div>
+ )
+})
+
+ContextMenu.displayName = 'ContextMenu'
+
+export default ContextMenu
+
diff --git a/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/SpaceGroupItem.tsx b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/SpaceGroupItem.tsx
new file mode 100644
index 00000000..db8bb8b9
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/components/SpaceGroupItem.tsx
@@ -0,0 +1,151 @@
+import type { SocialAccount } from '@/api/types/account.type'
+import type { AccountGroup } from '@/store/account'
+import { DeleteOutlined, DownOutlined, EllipsisOutlined, LoadingOutlined, RightOutlined, UpOutlined } from '@ant-design/icons'
+import { memo } from 'react'
+import { useTransClient } from '@/app/i18n/client'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import { cn } from '@/lib/utils'
+import AccountItem from './AccountItem'
+
+interface SpaceGroupItemProps {
+ group: AccountGroup
+ accounts: SocialAccount[]
+ isCollapsed: boolean
+ isDefaultGroup: boolean
+ canMoveUp: boolean
+ canMoveDown: boolean
+ canDelete: boolean
+ activeAccountId?: string
+ sortLoading?: string | null
+ deleteLoading?: string | null
+ onToggleCollapse: (groupId: string) => void
+ onSelectAccount: (account: SocialAccount) => void
+ onDeleteAccount: (account: SocialAccount) => void
+ onGroupSort: (groupId: string, direction: 'up' | 'down') => void
+ onGroupDelete: (group: AccountGroup) => void
+}
+
+const SpaceGroupItem = memo(({
+ group,
+ accounts,
+ isCollapsed,
+ isDefaultGroup,
+ canMoveUp,
+ canMoveDown,
+ canDelete,
+ activeAccountId,
+ sortLoading,
+ deleteLoading,
+ onToggleCollapse,
+ onSelectAccount,
+ onDeleteAccount,
+ onGroupSort,
+ onGroupDelete,
+}: SpaceGroupItemProps) => {
+ const { t } = useTransClient('account')
+ const isSorting = sortLoading === group.id
+ const isDeletingGroup = deleteLoading === group.id
+
+ return (
+ <div className="mb-1">
+ {/* 空间标题 - 可点击折叠 */}
+ <DropdownMenu>
+ <div
+ className={cn(
+ 'flex items-center gap-2 px-3 py-2 transition-colors group relative',
+ isDeletingGroup ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-muted/50',
+ )}
+ onClick={() => !isDeletingGroup && onToggleCollapse(group.id)}
+ >
+ {isCollapsed
+ ? <RightOutlined className="text-xs text-muted-foreground" />
+ : <DownOutlined className="text-xs text-muted-foreground" />}
+ <span className="text-xs font-semibold text-muted-foreground flex-1">
+ {group.name || t('defaultSpace')}
+ </span>
+ <span className="text-xs text-muted-foreground">
+ {accounts.length}
+ </span>
+ {!isDefaultGroup && (
+ isDeletingGroup ? (
+ <div className="p-1">
+ <LoadingOutlined className="h-4 w-4 text-muted-foreground animate-spin" />
+ </div>
+ ) : (
+ <DropdownMenuTrigger asChild>
+ <button
+ onClick={(e) => {
+ e.stopPropagation()
+ }}
+ className="opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-muted rounded cursor-pointer"
+ >
+ <EllipsisOutlined className="h-4 w-4 text-muted-foreground" />
+ </button>
+ </DropdownMenuTrigger>
+ )
+ )}
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem
+ onClick={() => onGroupSort(group.id, 'up')}
+ disabled={!canMoveUp || isSorting}
+ >
+ {isSorting ? (
+ <LoadingOutlined className="mr-2 animate-spin" />
+ ) : (
+ <UpOutlined className="mr-2" />
+ )}
+ {t('sidebar.moveUp')}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => onGroupSort(group.id, 'down')}
+ disabled={!canMoveDown || isSorting}
+ >
+ {isSorting ? (
+ <LoadingOutlined className="mr-2 animate-spin" />
+ ) : (
+ <DownOutlined className="mr-2" />
+ )}
+ {t('sidebar.moveDown')}
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ onClick={() => onGroupDelete(group)}
+ disabled={!canDelete}
+ className="text-destructive"
+ >
+ <DeleteOutlined className="mr-2" />
+ {t('userManageSidebar.delete')}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </div>
+ </DropdownMenu>
+
+ {/* 频道列表 */}
+ {!isCollapsed && accounts.map((account) => {
+ const isActive = activeAccountId === account.id
+ return (
+ <AccountItem
+ key={account.id}
+ account={account}
+ isActive={isActive}
+ onSelect={onSelectAccount}
+ onDelete={onDeleteAccount}
+ deleteLoading={deleteLoading}
+ indent
+ />
+ )
+ })}
+ </div>
+ )
+})
+
+SpaceGroupItem.displayName = 'SpaceGroupItem'
+
+export default SpaceGroupItem
+
diff --git a/project/web/src/app/[lng]/accounts/components/AccountsTopNav/index.tsx b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/index.tsx
new file mode 100644
index 00000000..bfc9e30d
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/AccountsTopNav/index.tsx
@@ -0,0 +1,221 @@
+/**
+ * AccountsTopNav 组件
+ *
+ * 功能描述: 账号模块顶部导航栏
+ * - 左侧: "新建作品"按钮 + 添加账号
+ * - 右侧: 空间+频道融合选择器(支持按空间分组显示频道,可折叠)
+ */
+
+'use client'
+
+import type { SocialAccount } from '@/api/types/account.type'
+import type { AccountGroup } from '@/store/account'
+import { PlusOutlined } from '@ant-design/icons'
+import { Modal } from 'antd'
+import { memo, useCallback, useMemo, useState } from 'react'
+import { useShallow } from 'zustand/react/shallow'
+import { deleteAccountsApi } from '@/api/account'
+import { deleteAccountGroupApi } from '@/api/account'
+import { apiUpdateAccountGroupSortRank } from '@/api/accountSort'
+import { useTransClient } from '@/app/i18n/client'
+import { Button } from '@/components/ui/button'
+import { toast } from '@/lib/toast'
+import { useAccountStore } from '@/store/account'
+import AccountSelector from './components/AccountSelector'
+
+export interface IAccountsTopNavProps {
+ onNewWork?: () => void
+ onAddAccount?: () => void
+}
+
+const AccountsTopNav = memo<IAccountsTopNavProps>(
+ ({ onNewWork, onAddAccount }) => {
+ const { t } = useTransClient('account')
+ const [accountSearchText, setAccountSearchText] = useState('')
+ const [collapsedSpaces, setCollapsedSpaces] = useState<Set<string>>(new Set())
+ const [sortLoading, setSortLoading] = useState<string | null>(null)
+ const [deleteLoading, setDeleteLoading] = useState<string | null>(null)
+
+ const {
+ accountList,
+ accountActive,
+ setAccountActive,
+ accountGroupList,
+ getAccountList,
+ getAccountGroup,
+ } = useAccountStore(
+ useShallow(state => ({
+ accountList: state.accountList,
+ accountActive: state.accountActive,
+ setAccountActive: state.setAccountActive,
+ accountGroupList: state.accountGroupList,
+ getAccountList: state.getAccountList,
+ getAccountGroup: state.getAccountGroup,
+ })),
+ )
+
+ // 根据搜索文本筛选账户(不过滤离线账号)
+ const filteredAccounts = useMemo(
+ () =>
+ accountList.filter(
+ account =>
+ account.nickname?.toLowerCase().includes(accountSearchText.toLowerCase())
+ || account.account?.toLowerCase().includes(accountSearchText.toLowerCase()),
+ ),
+ [accountList, accountSearchText],
+ )
+
+ // 处理账户选择
+ const handleAccountSelect = useCallback(
+ (account: SocialAccount | undefined) => {
+ setAccountActive(account)
+ setAccountSearchText('') // 清空搜索
+ },
+ [setAccountActive],
+ )
+
+ // 处理账户删除
+ const handleAccountDelete = useCallback(async (account: SocialAccount) => {
+ setDeleteLoading(account.id)
+ try {
+ await deleteAccountsApi([account.id])
+ await getAccountList()
+ toast.success(t('messages.deleteSuccess' as any))
+ // 如果删除的是当前选中的账号,清空选中状态
+ if (accountActive?.id === account.id) {
+ setAccountActive(undefined)
+ }
+ } catch (error) {
+ toast.error(t('messages.sortFailed' as any))
+ } finally {
+ setDeleteLoading(null)
+ }
+ }, [accountActive, getAccountList, setAccountActive, t])
+
+ // 处理空间删除
+ const handleGroupDelete = useCallback(async (group: AccountGroup) => {
+ setDeleteLoading(group.id)
+ try {
+ await deleteAccountGroupApi([group.id])
+ await getAccountGroup()
+ toast.success(t('messages.deleteSuccess' as any))
+ } catch (error) {
+ toast.error(t('messages.sortFailed' as any))
+ } finally {
+ setDeleteLoading(null)
+ }
+ }, [getAccountGroup, t])
+
+ // 处理空间排序
+ const handleGroupSort = useCallback(async (groupId: string, direction: 'up' | 'down') => {
+ setSortLoading(groupId)
+ try {
+ const sortedGroups = [...accountGroupList].sort((a, b) => (a.rank || 0) - (b.rank || 0))
+ const currentIndex = sortedGroups.findIndex(g => g.id === groupId)
+
+ if (currentIndex === -1) {
+ setSortLoading(null)
+ return
+ }
+
+ const newIndex = direction === 'up' ? currentIndex - 1 : currentIndex + 1
+ if (newIndex < 0 || newIndex >= sortedGroups.length) {
+ setSortLoading(null)
+ return
+ }
+
+ // 交换位置
+ ;[sortedGroups[currentIndex], sortedGroups[newIndex]] = [sortedGroups[newIndex], sortedGroups[currentIndex]]
+
+ // 更新rank
+ const updateList = sortedGroups.map((group, index) => ({
+ id: group.id,
+ rank: index,
+ }))
+
+ await apiUpdateAccountGroupSortRank({ list: updateList })
+ await getAccountGroup()
+ toast.success(t('messages.sortSuccess' as any))
+ } catch (error) {
+ toast.error(t('messages.sortFailed' as any))
+ } finally {
+ setSortLoading(null)
+ }
+ }, [accountGroupList, getAccountGroup, t])
+
+ // 切换空间折叠状态
+ const toggleSpaceCollapse = useCallback((spaceId: string) => {
+ setCollapsedSpaces(prev => {
+ const newSet = new Set(prev)
+ if (newSet.has(spaceId)) {
+ newSet.delete(spaceId)
+ } else {
+ newSet.add(spaceId)
+ }
+ return newSet
+ })
+ }, [])
+
+ // 显示空间分组的条件
+ const showSpaceGroups = accountGroupList.length > 1
+
+ // 获取排序后的空间列表
+ const sortedGroups = useMemo(() => {
+ return [...accountGroupList].sort((a, b) => (a.rank || 0) - (b.rank || 0))
+ }, [accountGroupList])
+
+ return (
+ <>
+ <div className="h-16 flex items-center justify-between px-6 border-b bg-background shrink-0">
+ {/* 左侧: 操作按钮区域 */}
+ <div className="flex items-center gap-2">
+ {/* 新建作品按钮 */}
+ <Button
+ onClick={onNewWork}
+ className="h-9 gap-2"
+ >
+ <PlusOutlined />
+ {t('newWork')}
+ </Button>
+
+ <div className="border-l border-border h-6 mx-2" />
+
+ {/* 添加账号按钮 */}
+ <Button
+ variant="outline"
+ onClick={onAddAccount}
+ className="h-9 gap-2"
+ >
+ <PlusOutlined />
+ {t('addAccount')}
+ </Button>
+ </div>
+
+ {/* 右侧: 频道选择器(按空间分组) */}
+ <AccountSelector
+ accountActive={accountActive}
+ accountList={accountList}
+ accountGroupList={accountGroupList}
+ filteredAccounts={filteredAccounts}
+ collapsedSpaces={collapsedSpaces}
+ showSpaceGroups={showSpaceGroups}
+ sortedGroups={sortedGroups}
+ sortLoading={sortLoading}
+ deleteLoading={deleteLoading}
+ onAccountSelect={handleAccountSelect}
+ onAccountDelete={handleAccountDelete}
+ onToggleSpaceCollapse={toggleSpaceCollapse}
+ onGroupSort={handleGroupSort}
+ onGroupDelete={handleGroupDelete}
+ searchText={accountSearchText}
+ onSearchChange={setAccountSearchText}
+ />
+ </div>
+ </>
+ )
+ },
+)
+
+AccountsTopNav.displayName = 'AccountsTopNav'
+
+export default AccountsTopNav
diff --git a/project/web/src/app/[lng]/accounts/components/AddAccountModal/AddAccountModal.module.scss b/project/web/src/app/[lng]/accounts/components/AddAccountModal/AddAccountModal.module.scss
deleted file mode 100644
index 05f3abe8..00000000
--- a/project/web/src/app/[lng]/accounts/components/AddAccountModal/AddAccountModal.module.scss
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 添加账号弹窗样式
- * 平台按钮区域:当空间不足时自动换行,禁止出现横向滚动条
- */
-.addAccountModal {
- :global {
- h1 {
- font-size: var(--fs-sm);
- margin-bottom: 15px;
- }
- .addAccountModal_plats {
- display: grid;
- /* 自适应列数:根据可用宽度自动换行 */
- grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
- gap: 12px;
- overflow-y: auto;
- overflow-x: hidden;
- margin-bottom: 20px;
- &-item {
- padding: 8px;
- border-radius: 8px;
- height: 90px;
- /* 允许内容换行,避免撑出横向滚动条 */
- white-space: normal;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- &-con {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 8px;
- width: 100%;
- img {
- width: 40px;
- height: 40px;
- }
- }
- span {
- font-size: 12px;
- text-align: center;
- }
- }
- }
- }
-}
diff --git a/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx b/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
index fca80dc3..bde6b041 100644
--- a/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
+++ b/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx
@@ -6,10 +6,23 @@
import type { ForwardedRef } from 'react'
import type { SocialAccount } from '@/api/types/account.type'
import type { IpLocationInfo } from '@/utils/ipLocation'
-import { Button, Select, Space, Tooltip, Typography } from 'antd'
import { toast } from '@/lib/toast'
import { confirm } from '@/lib/confirm'
import { Modal } from '@/components/ui/modal'
+import { Button } from '@/components/ui/button'
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from '@/components/ui/select'
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from '@/components/ui/tooltip'
import { forwardRef, memo, useEffect, useMemo, useState } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { kwaiSkip } from '@/app/[lng]/accounts/plat/kwaiLogin'
@@ -30,9 +43,6 @@ import { tiktokSkip } from '../../plat/TiktokLogin'
import { twitterSkip } from '../../plat/TwtterLogin'
import { wxGzhSkip } from '../../plat/WxGzh'
import { youtubeSkip } from '../../plat/YoutubeLogin'
-import styles from './AddAccountModal.module.scss'
-
-const { Text } = Typography
export interface IAddAccountModalRef {}
@@ -375,90 +385,79 @@ const AddAccountModal = memo(
footer={null}
width={650}
>
- <div className={styles.addAccountModal}>
- <h1>{t('addAccountModal.subtitle')}</h1>
+ <div>
+ <h1 className="text-sm mb-[15px]">{t('addAccountModal.subtitle')}</h1>
{/* 空间选择器 */}
{spaceSelectionRequired && (
- <div style={{
- marginBottom: '20px',
- paddingBottom: '16px',
- borderBottom: '1px solid var(--grayColor3)',
- }}
- >
- <Space align="center" style={{ width: '100%' }}>
- <Text strong style={{ fontSize: '14px', minWidth: '80px' }}>{t('addAccountModal.addTo')}</Text>
- <Select
- style={{ width: '200px' }}
- placeholder={t('pleaseChooseSpace')}
- value={selectedSpaceId}
- onChange={setSelectedSpaceId}
- options={accountGroupList.map(g => ({ value: g.id, label: g.name }))}
- />
- </Space>
+ <div className="mb-5 pb-4 border-b border-border">
+ <div className="flex items-center gap-3">
+ <span className="text-sm font-semibold min-w-[80px]">{t('addAccountModal.addTo')}</span>
+ <Select value={selectedSpaceId} onValueChange={setSelectedSpaceId}>
+ <SelectTrigger className="w-[200px]">
+ <SelectValue placeholder={t('pleaseChooseSpace')} />
+ </SelectTrigger>
+ <SelectContent>
+ {accountGroupList.map(g => (
+ <SelectItem key={g.id} value={g.id}>
+ {g.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
</div>
)}
{/* 当前选择的空间信息 */}
{selectedSpaceId && !spaceSelectionRequired && (
- <div style={{
- marginBottom: '20px',
- padding: '12px',
- backgroundColor: 'var(--grayColor1)',
- borderRadius: '6px',
- border: '1px solid var(--grayColor3)',
- fontSize: 'var(--fs-xs)',
- color: 'var(--grayColor6)',
- }}
- >
- <Text>
+ <div className="mb-5 p-3 bg-muted rounded-md border border-border text-xs text-muted-foreground">
+ <span>
{t('addAccountModal.currentSpace')}
:
{' '}
{accountGroupList.find(g => g.id === selectedSpaceId)?.name}
- </Text>
+ </span>
</div>
)}
- <div className="addAccountModal_plats">
- {AccountPlatInfoArr.map(([key, value]) => {
- const isAvailable = isPlatformAvailable(key as PlatType)
- const isLoading = syncLoadingPlatform === key
- return (
- <Tooltip title={value.tips?.account} key={key}>
- <Button
- type="text"
- style={{ width: '84px' }}
- className={`addAccountModal_plats-item ${!isAvailable ? 'disabled' : ''}`}
- disabled={!isAvailable || (spaceSelectionRequired && !selectedSpaceId)}
- loading={isLoading}
- onClick={() => handlePlatformClick(key as PlatType, value)}
- >
- <div className="addAccountModal_plats-item-con">
- <img
- src={value.icon}
- style={{ opacity: isAvailable ? 1 : 0.5 }}
- />
- <span style={{ opacity: isAvailable ? 1 : 0.5 }}>{value.name}</span>
- </div>
- </Button>
- </Tooltip>
- )
- })}
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(84px,1fr))] gap-3 overflow-y-auto overflow-x-hidden mb-5">
+ <TooltipProvider>
+ {AccountPlatInfoArr.map(([key, value]) => {
+ const isAvailable = isPlatformAvailable(key as PlatType)
+ const isLoading = syncLoadingPlatform === key
+ return (
+ <Tooltip key={key}>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ className="p-2 rounded-lg h-[90px] whitespace-normal flex flex-col items-center justify-center hover:bg-accent disabled:opacity-50"
+ disabled={!isAvailable || (spaceSelectionRequired && !selectedSpaceId) || isLoading}
+ onClick={() => handlePlatformClick(key as PlatType, value)}
+ >
+ <div className="flex flex-col items-center gap-2 w-full">
+ <img
+ src={value.icon}
+ className="w-10 h-10"
+ style={{ opacity: isAvailable ? 1 : 0.5 }}
+ alt={value.name}
+ />
+ <span className="text-xs text-center" style={{ opacity: isAvailable ? 1 : 0.5 }}>{value.name}</span>
+ </div>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{value.tips?.account}</p>
+ </TooltipContent>
+ </Tooltip>
+ )
+ })}
+ </TooltipProvider>
</div>
{/* 属地限制提示 */}
{isCnSpace !== null && (
- <div style={{
- marginTop: '16px',
- padding: '12px',
- backgroundColor: 'var(--grayColor1)',
- borderRadius: '6px',
- fontSize: 'var(--fs-xs)',
- color: 'var(--grayColor6)',
- textAlign: 'center',
- }}
- >
+ <div className="mt-4 p-3 bg-muted rounded-md text-xs text-muted-foreground text-center">
{isCnSpace
? t('locationRestriction.cnSpace')
: t('locationRestriction.nonCnSpace')}
@@ -467,16 +466,7 @@ const AddAccountModal = memo(
{/* 空间选择提示 */}
{spaceSelectionRequired && !selectedSpaceId && (
- <div style={{
- marginTop: '16px',
- padding: '12px',
- backgroundColor: 'var(--warningColor1)',
- borderRadius: '6px',
- fontSize: 'var(--fs-xs)',
- color: 'var(--warningColor)',
- textAlign: 'center',
- }}
- >
+ <div className="mt-4 p-3 bg-warning/10 rounded-md text-xs text-warning text-center">
{t('addAccountModal.pleaseChooseSpaceFirst')}
</div>
)}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon.tsx
index 141bfe36..3760663f 100644
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon.tsx
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon.tsx
@@ -1,6 +1,5 @@
import type { ForwardedRef } from 'react'
import { forwardRef, memo, useMemo } from 'react'
-import styles from './calendarTiming.module.scss'
export interface IAllPlatIconRef {}
@@ -28,16 +27,16 @@ const AllPlatIcon = memo(
return (
<div
- className={styles.allPlatIcon}
+ className="flex flex-wrap gap-1"
style={{ width: `${size}px`, height: `${size}px`, ...style }}
>
- <ul>
- <li style={childStyle}></li>
- <li style={childStyle}></li>
+ <ul className="flex gap-1 list-none p-0 m-0">
+ <li className="bg-muted rounded" style={childStyle}></li>
+ <li className="bg-muted rounded" style={childStyle}></li>
</ul>
- <ul>
- <li style={childStyle}></li>
- <li style={childStyle}></li>
+ <ul className="flex gap-1 list-none p-0 m-0">
+ <li className="bg-muted rounded" style={childStyle}></li>
+ <li className="bg-muted rounded" style={childStyle}></li>
</ul>
</div>
)
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/BoxDragPreview.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/BoxDragPreview.tsx
deleted file mode 100644
index 388381d6..00000000
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/BoxDragPreview.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import type { CSSProperties, FC } from 'react'
-import type { PublishRecordItem } from '@/api/plat/types/publish.types'
-import { memo, useEffect, useState } from 'react'
-import RecordCore from '@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/RecordCore'
-
-const styles: CSSProperties = {
- display: 'inline-block',
- transform: 'rotate(-7deg)',
- WebkitTransform: 'rotate(-7deg)',
- transition: '0.3s',
-}
-
-export interface BoxDragPreviewProps {
- publishRecord: PublishRecordItem
-}
-
-export const BoxDragPreview: FC<BoxDragPreviewProps> = memo(
- ({ publishRecord }) => {
- const [tickTock, setTickTock] = useState(false)
-
- useEffect(
- () => {
- const interval = setInterval(() => setTickTock(!tickTock), 500)
- return () => clearInterval(interval)
- },
- [tickTock],
- )
-
- return (
- <div style={styles}>
- <RecordCore publishRecord={publishRecord} />
- </div>
- )
- },
-)
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/CustomDragLayer.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/CustomDragLayer.tsx
deleted file mode 100644
index 79300fd4..00000000
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/CustomDragLayer.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-import type { CSSProperties, FC } from 'react'
-import type { XYCoord } from 'react-dnd'
-import type { PublishRecordItem } from '@/api/plat/types/publish.types'
-import { useDragLayer } from 'react-dnd'
-import { BoxDragPreview } from '@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/BoxDragPreview'
-
-function snapToGrid(x: number, y: number): [number, number] {
- const snappedX = Math.round(x / 32) * 32
- const snappedY = Math.round(y / 32) * 32
- return [snappedX, snappedY]
-}
-
-const layerStyles: CSSProperties = {
- position: 'fixed',
- pointerEvents: 'none',
- zIndex: 1000,
- left: 0,
- top: 0,
- width: '100%',
- height: '100%',
-}
-
-function getItemStyles(
- initialOffset: XYCoord | null,
- currentOffset: XYCoord | null,
- isSnapToGrid: boolean,
-) {
- if (!initialOffset || !currentOffset) {
- return {
- display: 'none',
- }
- }
-
- let { x, y } = currentOffset
-
- if (isSnapToGrid) {
- x -= initialOffset.x
- y -= initialOffset.y;
- [x, y] = snapToGrid(x, y)
- x += initialOffset.x
- y += initialOffset.y
- }
-
- const transform = `translate(${x}px, ${y}px)`
- return {
- transform,
- WebkitTransform: transform,
- }
-}
-
-export interface CustomDragLayerProps {
- snapToGrid: boolean
- publishRecord: PublishRecordItem
-}
-
-export const CustomDragLayer: FC<CustomDragLayerProps> = (props) => {
- const { itemType, isDragging, item, initialOffset, currentOffset }
- = useDragLayer(monitor => ({
- item: monitor.getItem(),
- itemType: monitor.getItemType(),
- initialOffset: monitor.getInitialSourceClientOffset(),
- currentOffset: monitor.getSourceClientOffset(),
- isDragging: monitor.isDragging(),
- }))
-
- return (
- <div style={layerStyles}>
- <div
- style={{
- ...getItemStyles(initialOffset, currentOffset, props.snapToGrid),
- position: 'relative',
- zIndex: 10001111,
- }}
- >
- <BoxDragPreview publishRecord={props.publishRecord} />
- </div>
- </div>
- )
-}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/RecordCore.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/RecordCore.tsx
deleted file mode 100644
index 916a85f4..00000000
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/RecordCore.tsx
+++ /dev/null
@@ -1,426 +0,0 @@
-import type { MenuProps } from 'antd'
-import type { TooltipRef } from 'antd/lib/tooltip'
-import type {
- ForwardedRef,
-} from 'react'
-import type {
- PublishRecordItem,
-} from '@/api/plat/types/publish.types'
-import {
- CheckCircleOutlined,
- ClockCircleOutlined,
- CloseCircleOutlined,
- ExportOutlined,
- EyeOutlined,
- FieldTimeOutlined,
- FullscreenOutlined,
- LikeOutlined,
- LoadingOutlined,
- MessageOutlined,
- MoreOutlined,
- SendOutlined,
- ShareAltOutlined,
-} from '@ant-design/icons'
-import { Button, Dropdown, Image, Popover, Tag } from 'antd'
-import {
- forwardRef,
- memo,
- useMemo,
- useRef,
- useState,
-} from 'react'
-import { useShallow } from 'zustand/react/shallow'
-import { deletePlatWorkApi, deletePublishRecordApi, nowPubTaskApi } from '@/api/plat/publish'
-import {
- PublishStatus,
-} from '@/api/plat/types/publish.types'
-import { ClientType } from '@/app/[lng]/accounts/accounts.enums'
-import { getDays } from '@/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils'
-import { useCalendarTiming } from '@/app/[lng]/accounts/components/CalendarTiming/useCalendarTiming'
-import { AccountPlatInfoMap, PlatType } from '@/app/config/platConfig'
-import { useTransClient } from '@/app/i18n/client'
-import AvatarPlat from '@/components/AvatarPlat'
-import ScrollButtonContainer from '@/components/ScrollButtonContainer'
-import { useAccountStore } from '@/store/account'
-import { getOssUrl } from '@/utils/oss'
-import styles from './recordCore.module.scss'
-
-export interface IRecordCoreRef {}
-
-export interface IRecordCoreProps {
- publishRecord: PublishRecordItem
-}
-
-function 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>
- )
- : (
- <></>
- )}
- </div>
- )
-}
-
-const RecordCore = memo(
- forwardRef(
- (
- { publishRecord }: IRecordCoreProps,
- ref: ForwardedRef<IRecordCoreRef>,
- ) => {
- const { calendarCallWidth, setListLoading, getPubRecord }
- = useCalendarTiming(
- useShallow(state => ({
- calendarCallWidth: state.calendarCallWidth,
- setListLoading: state.setListLoading,
- getPubRecord: state.getPubRecord,
- })),
- )
- const { accountMap } = useAccountStore(
- useShallow(state => ({
- accountMap: state.accountMap,
- })),
- )
- const [popoverOpen, setPopoverOpen] = useState(false)
- const popoverRef = useRef<TooltipRef>(null)
- const { t } = useTransClient('publish')
- const [nowPubLoading, setNowPubLoading] = useState(false)
-
- const dropdownItems: MenuProps['items'] = useMemo(() => {
- const dropdownItemsArr: MenuProps['items'] = []
-
- if (publishRecord.workLink) {
- dropdownItemsArr.push({
- key: '2',
- label: t('buttons.copyLink'),
- onClick: async () => {
- await navigator.clipboard.writeText(
- publishRecord?.workLink ?? '',
- )
- },
- })
- }
-
- /**
- * 删除按钮显示逻辑:
- * 1. 未发布的、发布失败的,直接显示删除按钮。
- * 2. 已发布的,除了小红书、抖音、视频号、ins、tiktok之外,其他平台均显示删除按钮。
- * 注意:Facebook 只有post类型显示删除按钮。
- */
- const shouldShowDelete = (() => {
- // 规则1:未发布或发布失败的,显示删除按钮
- if (
- publishRecord.status === PublishStatus.UNPUBLISH
- || publishRecord.status === PublishStatus.FAIL
- ) {
- return true
- }
-
- // 规则2:已发布的,根据平台判断
- if (publishRecord.status === PublishStatus.RELEASED) {
- // 不允许删除的平台列表
- const noDeletablePlats = [
- PlatType.Xhs, // 小红书
- PlatType.Douyin, // 抖音
- PlatType.WxSph, // 视频号
- PlatType.Instagram, // ins
- PlatType.Tiktok, // tiktok
- ]
-
- // 如果是不允许删除的平台,不显示删除按钮
- if (noDeletablePlats.includes(publishRecord.accountType)) {
- return false
- }
-
- // Facebook特殊处理:post类型不显示删除按钮
- if (publishRecord.accountType === PlatType.Facebook) {
- // 如果是post类型,不显示删除按钮
- return publishRecord.option?.facebook?.content_category === 'post'
- }
-
- // 其他已发布的平台,显示删除按钮
- return true
- }
-
- // 发布中的状态,不显示删除按钮
- return false
- })()
-
- if (shouldShowDelete) {
- dropdownItemsArr.push({
- key: '3',
- danger: true,
- label: t('buttons.delete'),
- onClick: async () => {
- setPopoverOpen(false)
- setListLoading(true)
- if (publishRecord.status === PublishStatus.RELEASED) {
- const res = await deletePlatWorkApi(publishRecord.accountId!, publishRecord.dataId)
- if (!res) {
- setListLoading(false)
- return
- }
- }
- await deletePublishRecordApi(publishRecord.id)
- getPubRecord()
- },
- })
- }
-
- return dropdownItemsArr
- }, [publishRecord, t, setListLoading, getPubRecord])
-
- const days = useMemo(() => {
- return getDays(publishRecord.publishTime)
- }, [publishRecord])
-
- const account = useMemo(() => {
- return accountMap.get(publishRecord?.accountId ?? '')
- }, [accountMap, publishRecord.accountId])
-
- const platIcon = useMemo(() => {
- return AccountPlatInfoMap.get(
- publishRecord?.accountType ?? PlatType.Xhs,
- )?.icon
- }, [publishRecord])
-
- /**
- * 根据 clientType 获取显示的标签文本
- * @param clientType 客户端类型(web/app)
- * @returns 标签显示文本
- */
- const getClientTypeLabel = (clientType?: ClientType) => {
- if (!clientType) return null
- if (clientType === ClientType.WEB) {
- return t('clientType.web' as any)
- }
- if (clientType === ClientType.APP) {
- return t('clientType.app' as any)
- }
- return null
- }
-
- const recordInfo = useMemo(() => {
- return [
- {
- label: t('record.metrics.views'),
- icon: <EyeOutlined />,
- key: 'viewCount',
- },
- {
- label: t('record.metrics.comments'),
- icon: <MessageOutlined />,
- key: 'commentCount',
- },
- {
- label: t('record.metrics.likes'),
- icon: <LikeOutlined />,
- key: 'likeCount',
- },
- {
- label: t('record.metrics.shares'),
- icon: <ShareAltOutlined />,
- key: 'shareCount',
- },
- ]
- }, [t])
-
- return (
- <Popover
- ref={popoverRef}
- placement="right"
- rootClassName={styles.recordPopover}
- open={popoverOpen}
- onOpenChange={e => setPopoverOpen(e)}
- content={() => {
- const desc = `${publishRecord.desc} ${publishRecord.topics ? publishRecord.topics?.map(v => `#${v}`).join(' ') : ''}`
- return (
- <div className={styles.recordDetails}>
- <div className="recordDetails-top">
- <div className="recordDetails-top-left">
- {days.format('YYYY-MM-DD HH:mm')}
- <FieldTimeOutlined />
- </div>
- <Button icon={<FullscreenOutlined />} size="small" />
- </div>
- <div className="recordDetails-center">
- <div className="recordDetails-center-left">
- <div className="recordDetails-center-left-user">
- <AvatarPlat account={account} size="large" />
- <span className="recordDetails-center-title">
- {account?.nickname}
- </span>
- {/* 客户端来源标签(web/flutter app),为空不显示 */}
- {account?.clientType && (
- <span
- className="recordDetails-center-clientType"
- data-type={account.clientType}
- >
- {getClientTypeLabel(account.clientType)}
- </span>
- )}
- </div>
- <div
- title={desc}
- className="recordDetails-center-left-desc"
- >
- {desc}
- </div>
- <div className="recordDetails-center-left-status">
- {publishRecord && (
- <PubStatus status={publishRecord.status} />
- )}
- </div>
- <div
- title={publishRecord.errorMsg}
- className="recordDetails-center-left-failMsg"
- >
- {publishRecord.errorMsg}
- </div>
- </div>
- {
- (publishRecord.videoUrl && publishRecord.imgUrlList.length !== 0)
- && (
- <div className="recordDetails-center-right">
- {publishRecord.videoUrl
- ? (
- <>
- <Image
- src={getOssUrl(publishRecord.coverUrl || '')}
- preview={{
- destroyOnHidden: true,
- imageRender: () => (
- <video
- muted
- width="80%"
- height={500}
- controls
- src={publishRecord.videoUrl}
- />
- ),
- toolbarRender: () => null,
- }}
- />
- </>
- )
- : (
- <Image.PreviewGroup items={publishRecord.imgUrlList}>
- <Image src={getOssUrl(publishRecord.coverUrl || '')} />
- </Image.PreviewGroup>
- )}
- </div>
- )
- }
- </div>
- <ScrollButtonContainer>
- <div className="recordDetails-info">
- {recordInfo.map(v => (
- <div key={v.label} className="recordDetails-info-item">
- <div className="recordDetails-info-item-top">
- {v.icon}
- <span>{v.label}</span>
- </div>
- {publishRecord.engagement && (
- <div className="recordDetails-info-item-num">
- {publishRecord.engagement[v.key as 'viewCount'] ?? 0}
- </div>
- )}
- </div>
- ))}
- </div>
- </ScrollButtonContainer>
- <div className="recordDetails-bottom">
- {publishRecord.workLink && (
- <Button
- icon={<ExportOutlined />}
- onClick={() => {
- window.open(publishRecord.workLink, '_blank')
- }}
- >
- {t('record.viewWork')}
- </Button>
- )}
-
- {publishRecord.status !== PublishStatus.RELEASED
- && publishRecord.status !== PublishStatus.PUB_LOADING
- ? (
- <Button
- loading={nowPubLoading}
- icon={<SendOutlined />}
- onClick={async () => {
- setNowPubLoading(true)
- await nowPubTaskApi(publishRecord.id)
- getPubRecord()
- setNowPubLoading(false)
- }}
- >
- {t('buttons.publishNow')}
- </Button>
- )
- : (
- <></>
- )}
- {dropdownItems && dropdownItems.length > 0 && (
- <Dropdown menu={{ items: dropdownItems }} placement="top">
- <Button icon={<MoreOutlined />} />
- </Dropdown>
- )}
- </div>
- </div>
- )
- }}
- trigger="click"
- >
- <Button
- className={styles.recordCore}
- style={{ width: `${calendarCallWidth}px` }}
- >
- <div className="recordCore-left">
- <img src={platIcon} style={{ width: '25px', height: '25px' }} />
- <div className="recordCore-left-date">{days.format('HH:mm')}</div>
- </div>
- {
- publishRecord.coverUrl
- && (
- <div className="recordCore-right">
- <img src={getOssUrl(publishRecord.coverUrl || '')} />
- </div>
- )
- }
- </Button>
- </Popover>
- )
- },
- ),
-)
-
-export default RecordCore
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/calendarRecord.module.scss b/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/calendarRecord.module.scss
deleted file mode 100644
index 9e6dd73c..00000000
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/calendarRecord.module.scss
+++ /dev/null
@@ -1,2 +0,0 @@
-.calendarRecord {
-}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/calendarTimingItem.module.scss b/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/calendarTimingItem.module.scss
deleted file mode 100644
index b16ac99f..00000000
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/calendarTimingItem.module.scss
+++ /dev/null
@@ -1,66 +0,0 @@
-.calendarTimingItem {
- box-sizing: border-box;
- padding: 10px;
- display: flex;
- flex-direction: column;
- font-weight: 600;
- min-height: 200px;
- height: 100%;
- :global {
- .calendarTimingItem-top {
- display: flex;
- justify-content: space-between;
- margin-bottom: 5px;
- .calendarTimingItem-top-day {
- width: 24px;
- height: 24px;
- line-height: 24px;
- text-align: center;
- border-radius: 50%;
- margin-bottom: 3px;
- }
- button {
- font-size: var(--fs-xs);
- display: none;
- }
- }
- .calendarTimingItem-con {
- .calendarTimingItem-con-btn2 {
- display: none;
- }
- button {
- width: 100%;
- margin-bottom: 8px;
- font-size: var(--fs-xs);
- padding: 0;
- height: 34px;
- &:hover {
- .calendarTimingItem-con-btn2 {
- display: block;
- }
- .calendarTimingItem-con-btn1 {
- display: none;
- }
- }
- }
- }
- }
-
- &:hover {
- :global {
- .calendarTimingItem-top {
- button {
- display: block !important;
- }
- }
- }
- }
-}
-
-.calendarTimingItemPast {
- background: var(--grayColor1);
-}
-
-.calendarTimingItem_over {
- background: var(--colorPrimary3);
-}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/recordCore.module.scss b/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/recordCore.module.scss
deleted file mode 100644
index 8c478ca2..00000000
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/recordCore.module.scss
+++ /dev/null
@@ -1,170 +0,0 @@
-.recordCore {
- display: flex !important;
- justify-content: space-between !important;
- box-sizing: border-box;
- //background: transparent !important;
- position: fixed;
- padding: 0 5px !important;
-
- :global {
- .recordCore-left {
- display: flex;
- align-items: center;
- &-date {
- font-weight: 600;
- }
- img {
- height: 100%;
- margin-right: 6px;
- }
- }
- .recordCore-right {
- display: flex;
- align-items: center;
- img {
- width: 24px;
- height: 24px;
- border-radius: 4px;
- object-fit: cover;
- }
- }
- }
-
- &:hover {
- :global {
- background: #fff !important;
- }
- }
-}
-
-.recordDetails {
- width: 450px;
- box-sizing: border-box;
- :global {
- .recordDetails-top {
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1px solid var(--grayColor2);
- padding: 12px;
- &-left {
- font-weight: 600;
- .anticon {
- margin-left: 8px;
- }
- }
- }
-
- .recordDetails-info {
- display: flex;
- gap: 15px;
- padding: 10px;
- border-bottom: 1px solid var(--grayColor2);
- &-item {
- flex: 1;
- &-top {
- display: flex;
- gap: 5px;
- }
- &-num {
- font-size: var(--fs-md);
- font-weight: 600;
- }
- }
- }
-
- .recordDetails-center {
- padding: 12px;
- display: flex;
- justify-content: space-between;
- border-bottom: 1px solid var(--grayColor2);
- &-left {
- width: 100%;
- min-height: 150px;
- &-status {
- margin-top: 15px;
- }
- &-failMsg {
- margin-top: 5px;
- font-size: var(--fs-xs);
- color: var(--error-color);
- }
- &-desc {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- text-overflow: ellipsis;
- margin-top: 10px;
- padding-right: 10px;
- }
- }
-
- &-right {
- img {
- width: 145px;
- height: 145px;
- object-fit: contain;
- }
- }
- &-title {
- margin-left: 10px;
- display: inline-block;
- font-weight: 700;
- }
-
- // 客户端来源标签样式
- &-clientType {
- display: inline-block;
- padding: 2px 6px;
- border-radius: 4px;
- font-size: 11px;
- font-weight: 500;
- margin-left: 8px;
-
- // Web 来源标签 - 蓝色调
- &[data-type='web'] {
- background-color: #e6f7ff;
- color: #1890ff;
- border: 1px solid #91d5ff;
- }
-
- // App/Flutter 来源标签 - 绿色调
- &[data-type='app'] {
- background-color: #f6ffed;
- color: #52c41a;
- border: 1px solid #b7eb8f;
- }
- }
- }
-
- .recordDetails-bottom {
- padding: 12px;
- display: flex;
- justify-content: right;
- gap: 10px;
- :global {
- .anticon {
- font-size: 18px !important;
- font-weight: 900 !important;
- }
- }
- }
- }
-}
-
-.recordPopover {
- :global {
- .ant-popover-inner {
- padding: 0 !important;
- }
- }
-}
-
-.pubStatus {
- :global {
- .anticon {
- margin-left: 5px;
- }
- }
-}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarToolbar.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarToolbar.tsx
new file mode 100644
index 00000000..17539c09
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarToolbar.tsx
@@ -0,0 +1,104 @@
+/**
+ * CalendarToolbar 组件
+ *
+ * 功能描述: 日历工具栏 (Row 2 - Calendar Controls Bar)
+ * - 左侧: 上月/下月按钮 + 当前月份显示 + 今天按钮 (仅日历模式显示)
+ * - 右侧: 日历/列表模式切换标签
+ */
+
+'use client'
+
+import {
+ CalendarOutlined,
+ UnorderedListOutlined,
+} from '@ant-design/icons'
+import dayjs from 'dayjs'
+import 'dayjs/locale/zh-cn'
+import 'dayjs/locale/en'
+import { ChevronLeft, ChevronRight } from 'lucide-react'
+import { memo, useMemo } from 'react'
+import { useTransClient } from '@/app/i18n/client'
+import { useGetClientLng } from '@/hooks/useSystem'
+import { Button } from '@/components/ui/button'
+import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
+
+export interface ICalendarToolbarProps {
+ activeMode: 'calendar' | 'list'
+ onModeChange: (mode: 'calendar' | 'list') => void
+ currentDate: Date
+ onPrev: () => void
+ onNext: () => void
+ onToday: () => void
+}
+
+const CalendarToolbar = memo<ICalendarToolbarProps>(
+ ({ activeMode, onModeChange, currentDate, onPrev, onNext, onToday }) => {
+ const { t } = useTransClient('account')
+ const lng = useGetClientLng()
+
+ // 根据语言设置 dayjs locale 并格式化日期
+ const formattedDate = useMemo(() => {
+ const locale = lng === 'zh-CN' ? 'zh-cn' : 'en'
+ dayjs.locale(locale)
+ return dayjs(currentDate).format('MMMM YYYY')
+ }, [currentDate, lng])
+
+ return (
+ <div className="h-14 flex items-center justify-between px-6 py-3 border-b bg-background shrink-0">
+ {/* 左侧: 日历导航控制 (仅在日历模式显示) */}
+ <div className="flex items-center gap-3">
+ {activeMode === 'calendar' && (
+ <>
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={onPrev}
+ className="h-8 w-8"
+ >
+ <ChevronLeft className="h-4 w-4" />
+ </Button>
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={onNext}
+ className="h-8 w-8"
+ >
+ <ChevronRight className="h-4 w-4" />
+ </Button>
+ <div className="text-base font-semibold text-foreground min-w-[120px] text-center">
+ {formattedDate}
+ </div>
+ <Button
+ variant="outline"
+ onClick={onToday}
+ className="h-8"
+ >
+ {t('today')}
+ </Button>
+ </>
+ )}
+ </div>
+
+ {/* 右侧: 模式切换标签 */}
+ <div className="flex items-center gap-3">
+ <Tabs value={activeMode} onValueChange={value => onModeChange(value as 'calendar' | 'list')}>
+ <TabsList>
+ <TabsTrigger value="calendar" className="gap-1.5">
+ <CalendarOutlined />
+ {t('calendarModeTab')}
+ </TabsTrigger>
+ <TabsTrigger value="list" className="gap-1.5">
+ <UnorderedListOutlined />
+ {t('listModeTab')}
+ </TabsTrigger>
+ </TabsList>
+ </Tabs>
+ </div>
+ </div>
+ )
+ },
+)
+
+CalendarToolbar.displayName = 'CalendarToolbar'
+
+export default CalendarToolbar
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/QueueItem.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/QueueItem.tsx
index b1b70efc..0c49005f 100644
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/QueueItem.tsx
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/QueueItem.tsx
@@ -1,23 +1,25 @@
+/**
+ * QueueItem 组件
+ * 功能:显示发布队列中的单个记录项
+ */
import type { PublishRecordItem } from '@/api/plat/types/publish.types'
import {
CheckCircleOutlined,
ClockCircleOutlined,
CloseCircleOutlined,
LoadingOutlined,
- MessageOutlined,
SendOutlined,
- UserOutlined,
} from '@ant-design/icons'
-import { Avatar, Button, Tag } from 'antd'
import { memo } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { PublishStatus } from '@/api/plat/types/publish.types'
import { getDays } from '@/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils'
import { AccountPlatInfoMap } from '@/app/config/platConfig'
import { useTransClient } from '@/app/i18n/client'
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
+import { Button } from '@/components/ui/button'
import { useAccountStore } from '@/store/account'
import { getOssUrl } from '@/utils/oss'
-import styles from './queueItem.module.scss'
interface QueueItemProps {
record: PublishRecordItem
@@ -77,141 +79,124 @@ const QueueItem = memo(({ record, onRetry, onEdit, onMore }: QueueItemProps) =>
const statusInfo = getStatusInfo()
return (
- <div className={styles.queueItem}>
+ <div className="bg-background rounded-xl border border-border shadow-sm overflow-hidden transition-all duration-300 ease-in-out mb-4 last:mb-0 hover:shadow-md hover:-translate-y-0.5">
{/* 状态头部 */}
- <div className={styles.statusHeader}>
- <div className={styles.statusInfo}>
-
- <div className={styles.dateTime}>
- <span className={styles.date}>{days.format('MMM DD')}</span>
- <span className={styles.time}>{days.format('h:mm A')}</span>
+ <div className="flex justify-between items-start p-4 pb-3 border-b border-border">
+ <div className="flex flex-col gap-1">
+ <div className="flex items-center gap-2">
+ <span className="text-sm text-muted-foreground font-medium">{days.format('MMM DD')}</span>
+ <span className="text-sm text-muted-foreground font-medium">{days.format('h:mm A')}</span>
</div>
- <span className={styles.statusText}>{statusInfo.text}</span>
+ <span className="text-base font-semibold text-foreground">{statusInfo.text}</span>
</div>
- {/* <div className={styles.statusBadge}>
- <Tag color={statusInfo.color} icon={statusInfo.icon}>
- {statusInfo.text}
- </Tag>
- </div> */}
- <div className={styles.commentIcon}>
- {/* <MessageOutlined /> */}
+ <div className="flex-shrink-0">
+ {/* 可以在这里添加状态徽章 */}
</div>
</div>
{/* 错误信息横幅 */}
{record.status === PublishStatus.FAIL && record.errorMsg && (
- <div className={styles.errorBanner}>
- <div className={styles.errorIcon}>
+ <div className="flex items-center gap-3 p-3 px-5 bg-destructive/10 border-b border-destructive/30">
+ <div className="text-destructive text-base flex-shrink-0">
<CloseCircleOutlined />
</div>
- <div className={styles.errorMessage}>
+ <div className="text-destructive text-sm leading-tight flex-1">
{record.errorMsg}
</div>
</div>
)}
{/* 主要内容区域 */}
- <div className={styles.contentArea}>
-
- <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', gap: '12px' }}>
-
- {/* 账户信息 */}
-
- <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
-
- <div className={styles.accountInfo}>
- <div className={styles.avatarContainer}>
-
- <Avatar
- size={40}
- src={getOssUrl(accountActive?.avatar || '')}
- className={styles.avatar}
- >
- {accountActive?.nickname?.charAt(0) || accountActive?.account?.charAt(0)}
+ <div className="p-5">
+ <div className="flex flex-row justify-between gap-3">
+ {/* 左侧:账户信息和文本内容 */}
+ <div className="flex flex-col gap-3">
+ {/* 账户信息 */}
+ <div className="flex items-start gap-3 mb-4">
+ <div className="relative flex-shrink-0">
+ <Avatar className="h-10 w-10">
+ <AvatarImage src={getOssUrl(accountActive?.avatar || '')} alt={accountActive?.nickname || accountActive?.account} />
+ <AvatarFallback>
+ {accountActive?.nickname?.charAt(0) || accountActive?.account?.charAt(0)}
+ </AvatarFallback>
</Avatar>
-
- {/* <Avatar
- src={getOssUrl(account?.avatar || "")}
- icon={!account?.avatar ? <UserOutlined /> : undefined}
- className={styles.avatar}
- /> */}
- <div className={styles.platformIcon}>
+ <div className="absolute -bottom-0.5 -right-0.5 w-5 h-5 bg-background rounded-full flex items-center justify-center border-2 border-background shadow-sm">
<img
src={platInfo?.icon}
alt="platform"
- className={styles.platIcon}
+ className="w-3 h-3 object-contain"
/>
</div>
</div>
- <div className={styles.accountDetails}>
- <div className={styles.accountName}>{account?.nickname}</div>
- <div className={styles.accountHandle}>
+ <div className="flex-1 min-w-0">
+ <div className="text-base font-semibold text-foreground mb-1 leading-tight">
+ {account?.nickname}
+ </div>
+ <div className="text-sm text-muted-foreground leading-tight">
@
{account?.account}
</div>
</div>
-
</div>
- <div className={styles.postText}>{record.desc}</div>
+ {/* 发布内容文本 */}
+ <div className="text-base text-foreground leading-relaxed mb-4 break-words">
+ {record.desc}
+ </div>
</div>
- {/* 发布内容 */}
- <div className={styles.postContent}>
-
- {/* 媒体内容 */}
+ {/* 右侧:媒体内容 */}
+ <div className="relative">
{(record.coverUrl || record.imgUrlList?.length > 0) && (
- <div className={styles.mediaContainer}>
+ <div className="mb-4">
{record.videoUrl
? (
- <div className={styles.videoThumbnail}>
+ <div className="relative rounded-lg overflow-hidden bg-muted max-w-[300px]">
<img
src={getOssUrl(record.coverUrl || '')}
alt="video thumbnail"
- className={styles.mediaImage}
+ className="w-full h-auto block rounded-lg"
/>
- <div className={styles.playButton}>
- <div className={styles.playIcon}>▶</div>
+ <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-12 h-12 bg-black/70 rounded-full flex items-center justify-center cursor-pointer transition-all hover:bg-black/80 hover:scale-110">
+ <div className="text-white text-base ml-0.5">▶</div>
</div>
</div>
)
: (
- <div className={styles.imageContainer}>
+ <div className="rounded-lg overflow-hidden bg-muted max-w-[300px]">
<img
src={getOssUrl(record.coverUrl || record.imgUrlList?.[0] || '')}
alt="post image"
- className={styles.mediaImage}
+ className="w-full h-auto block rounded-lg"
/>
</div>
)}
</div>
)}
-
</div>
-
</div>
-
</div>
{/* 底部信息 */}
- <div className={styles.footer}>
- <div className={styles.creationInfo}>
+ <div className="flex justify-between items-center p-4 px-5 border-t border-border bg-muted/30">
+ <div className="text-sm text-muted-foreground">
{t('creationInfo', { date: days.format('YYYY-MM-DD') })}
</div>
- <div className={styles.actionButtons}>
+ <div className="flex items-center gap-2">
{record.status === PublishStatus.UNPUBLISH && (
<Button
- type="primary"
- icon={<SendOutlined />}
onClick={() => onRetry?.(record)}
- className={styles.retryButton}
+ size="sm"
+ className="h-8 rounded-md font-medium"
>
+ <SendOutlined />
{t('buttons.publishNow')}
</Button>
)}
{record.workLink && (
<Button
- icon={<SendOutlined />}
+ variant="outline"
+ size="sm"
onClick={async () => {
try {
await navigator.clipboard.writeText(record.workLink)
@@ -221,8 +206,9 @@ const QueueItem = memo(({ record, onRetry, onEdit, onMore }: QueueItemProps) =>
console.error('复制链接失败:', err)
}
}}
- className={styles.copyButton}
+ className="h-8 rounded-md font-medium border border-border bg-background transition-all hover:border-primary hover:bg-accent"
>
+ <SendOutlined />
{t('buttons.copyLink')}
</Button>
)}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/SentList.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/SentList.tsx
index f69bb736..cd4cbbef 100644
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/SentList.tsx
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/SentList.tsx
@@ -1,17 +1,20 @@
+/**
+ * SentList 组件
+ * 功能:显示已发送的帖子列表
+ */
import type { SentPost } from '@/api/types/sent.types'
import { AimOutlined, BarChartOutlined, EyeInvisibleOutlined, EyeOutlined, HeartOutlined, LikeOutlined, MessageOutlined, ShareAltOutlined } from '@ant-design/icons'
-import { Avatar, Button, Card, Empty, List, Skeleton, Space, Tag, Typography } from 'antd'
import dayjs from 'dayjs'
import React, { useEffect, useMemo, useState } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { getSentPosts } from '@/api/sent'
import { AccountPlatInfoMap } from '@/app/config/platConfig'
import { useTransClient } from '@/app/i18n/client'
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
+import { Button } from '@/components/ui/button'
+import { Skeleton } from '@/components/ui/skeleton'
import { useAccountStore } from '@/store/account'
import { getOssUrl } from '@/utils/oss'
-import styles from './listMode.module.scss'
-
-const { Text, Title } = Typography
interface SentListProps {
platform: string
@@ -119,15 +122,6 @@ const SentList: React.FC<SentListProps> = ({ platform, uid, onDataChange, accoun
}
}
- const getMediaTypeTag = (mediaType: string) => {
- const typeMap = {
- video: { color: 'red', text: t('mediaTypes.video') },
- image: { color: 'blue', text: t('mediaTypes.image') },
- article: { color: 'green', text: t('mediaTypes.article') },
- }
- return typeMap[mediaType as keyof typeof typeMap] || { color: 'default', text: mediaType }
- }
-
const renderPostItem = (post: SentPost) => {
// Get account information based on accountId
const account = accountMap.get(post.accountId)
@@ -138,34 +132,33 @@ const SentList: React.FC<SentListProps> = ({ platform, uid, onDataChange, accoun
const daysAgo = Math.floor((Date.now() - postTime) / (1000 * 60 * 60 * 24))
return (
- <div key={post.id} className={styles.sentPostItem}>
- <div className={styles.postCard}>
+ <div key={post.id} className="mb-6 last:mb-0">
+ <div className="bg-background rounded-xl shadow-sm border border-border overflow-hidden transition-all duration-300 ease-in-out hover:shadow-md hover:-translate-y-0.5">
{/* Date time header */}
- <div className={styles.postDateHeader}>
- <div className={styles.dateTime}>
- <span className={styles.dateText}>{timeInfo.date}</span>
- <span className={styles.timeText}>{timeInfo.time}</span>
+ <div className="px-5 pt-4 pb-3 border-b border-border/50">
+ <div className="flex items-center gap-2">
+ <span className="text-sm text-muted-foreground font-medium">{timeInfo.date}</span>
+ <span className="text-sm text-muted-foreground font-medium">{timeInfo.time}</span>
</div>
</div>
{/* Post content */}
- <div className={styles.postContent}>
+ <div className="p-5">
{/* User information */}
- <div className={styles.userInfo}>
- <Avatar
- size={40}
- src={getOssUrl(account?.avatar || '')}
- className={styles.userAvatar}
- >
- {account?.nickname?.charAt(0) || account?.account?.charAt(0) || post.title?.charAt(0) || '?'}
+ <div className="flex items-start gap-3 mb-4">
+ <Avatar className="h-10 w-10">
+ <AvatarImage src={getOssUrl(account?.avatar || '')} alt={account?.nickname || account?.account} />
+ <AvatarFallback>
+ {account?.nickname?.charAt(0) || account?.account?.charAt(0) || post.title?.charAt(0) || '?'}
+ </AvatarFallback>
</Avatar>
- <div className={styles.userDetails}>
- <div className={styles.username}>
+ <div className="flex-1 min-w-0">
+ <div className="text-base font-semibold text-foreground mb-1 leading-tight">
{account?.nickname || account?.account || post.title || t('unknownAccount')}
</div>
- <div className={styles.userSubtitle} style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
+ <div className="flex items-center gap-1.5 text-sm text-muted-foreground leading-tight">
{platInfo && (
- <img src={platInfo.icon} alt={platInfo.name} style={{ width: '16px', height: '16px', borderRadius: '2px' }} />
+ <img src={platInfo.icon} alt={platInfo.name} className="w-4 h-4 rounded-sm" />
)}
<span>{platInfo?.name || post.accountType}</span>
</div>
@@ -173,22 +166,22 @@ const SentList: React.FC<SentListProps> = ({ platform, uid, onDataChange, accoun
</div>
{/* Post text */}
- <div className={styles.postText}>
+ <div className="text-base text-foreground leading-relaxed mb-4 break-words">
{post.desc}
</div>
{/* Media content */}
{post.coverUrl && (
- <div className={styles.mediaContainer}>
- <div className={styles.mediaWrapper}>
+ <div className="mb-5">
+ <div className="relative max-w-[300px]">
<img
src={post.coverUrl}
alt={post.title || post.desc}
- className={styles.mediaImage}
+ className="w-full h-auto block rounded-lg"
/>
{(post.type === 'video' || post.type?.includes('video')) && (
- <div className={styles.playButton}>
- <div className={styles.playIcon}>▶</div>
+ <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-12 h-12 bg-black/70 rounded-full flex items-center justify-center">
+ <div className="text-white text-base ml-0.5">▶</div>
</div>
)}
</div>
@@ -196,57 +189,59 @@ const SentList: React.FC<SentListProps> = ({ platform, uid, onDataChange, accoun
)}
{/* Interactive data */}
- <div className={styles.engagementMetrics}>
- <div className={styles.metricsRow}>
- <div className={styles.metricItem}>
- <div className={styles.metricIcon}><LikeOutlined /></div>
- <div className={styles.metricLabel}>Likes</div>
- <div className={styles.metricValue}>{post.engagement?.likeCount || 0}</div>
+ <div className="mb-5 p-4 bg-muted/50 rounded-lg">
+ <div className="flex items-center gap-6 flex-wrap">
+ <div className="flex flex-col items-center gap-1 min-w-[60px]">
+ <div className="text-base text-muted-foreground"><LikeOutlined /></div>
+ <div className="text-xs text-muted-foreground font-medium text-center">Likes</div>
+ <div className="text-sm text-foreground font-semibold">{post.engagement?.likeCount || 0}</div>
</div>
- <div className={styles.metricItem}>
- <div className={styles.metricIcon}><ShareAltOutlined /></div>
- <div className={styles.metricLabel}>Shares</div>
- <div className={styles.metricValue}>{post.engagement?.shareCount || 0}</div>
+ <div className="flex flex-col items-center gap-1 min-w-[60px]">
+ <div className="text-base text-muted-foreground"><ShareAltOutlined /></div>
+ <div className="text-xs text-muted-foreground font-medium text-center">Shares</div>
+ <div className="text-sm text-foreground font-semibold">{post.engagement?.shareCount || 0}</div>
</div>
- <div className={styles.metricItem}>
- <div className={styles.metricIcon}><EyeOutlined /></div>
- <div className={styles.metricLabel}>Views</div>
- <div className={styles.metricValue}>{post.engagement?.viewCount || 0}</div>
+ <div className="flex flex-col items-center gap-1 min-w-[60px]">
+ <div className="text-base text-muted-foreground"><EyeOutlined /></div>
+ <div className="text-xs text-muted-foreground font-medium text-center">Views</div>
+ <div className="text-sm text-foreground font-semibold">{post.engagement?.viewCount || 0}</div>
</div>
- <div className={styles.metricItem}>
- <div className={styles.metricIcon}><MessageOutlined /></div>
- <div className={styles.metricLabel}>Comments</div>
- <div className={styles.metricValue}>{post.engagement?.commentCount || 0}</div>
+ <div className="flex flex-col items-center gap-1 min-w-[60px]">
+ <div className="text-base text-muted-foreground"><MessageOutlined /></div>
+ <div className="text-xs text-muted-foreground font-medium text-center">Comments</div>
+ <div className="text-sm text-foreground font-semibold">{post.engagement?.commentCount || 0}</div>
</div>
- <div className={styles.metricItem}>
- <div className={styles.metricIcon}><HeartOutlined /></div>
- <div className={styles.metricLabel}>Favorites</div>
- <div className={styles.metricValue}>{post.engagement?.favoriteCount || 0}</div>
+ <div className="flex flex-col items-center gap-1 min-w-[60px]">
+ <div className="text-base text-muted-foreground"><HeartOutlined /></div>
+ <div className="text-xs text-muted-foreground font-medium text-center">Favorites</div>
+ <div className="text-sm text-foreground font-semibold">{post.engagement?.favoriteCount || 0}</div>
</div>
- <div className={styles.metricItem}>
- <div className={styles.metricIcon}><AimOutlined /></div>
- <div className={styles.metricLabel}>Click</div>
- <div className={styles.metricValue}>{post.engagement?.clickCount || 0}</div>
+ <div className="flex flex-col items-center gap-1 min-w-[60px]">
+ <div className="text-base text-muted-foreground"><AimOutlined /></div>
+ <div className="text-xs text-muted-foreground font-medium text-center">Click</div>
+ <div className="text-sm text-foreground font-semibold">{post.engagement?.clickCount || 0}</div>
</div>
- <div className={styles.metricItem}>
- <div className={styles.metricIcon}><EyeInvisibleOutlined /></div>
- <div className={styles.metricLabel}>Impression</div>
- <div className={styles.metricValue}>{post.engagement?.impressionCount || 0}</div>
+ <div className="flex flex-col items-center gap-1 min-w-[60px]">
+ <div className="text-base text-muted-foreground"><EyeInvisibleOutlined /></div>
+ <div className="text-xs text-muted-foreground font-medium text-center">Impression</div>
+ <div className="text-sm text-foreground font-semibold">{post.engagement?.impressionCount || 0}</div>
+ </div>
+ <div className="ml-auto text-base text-muted-foreground cursor-pointer p-1 rounded transition-all hover:bg-muted hover:text-foreground">
+ <BarChartOutlined />
</div>
- <div className={styles.chartIcon}><BarChartOutlined /></div>
</div>
</div>
{/* Bottom information */}
- <div className={styles.postFooter}>
- <div className={styles.creationInfo}>
+ <div className="flex justify-between items-center pt-4 border-t border-border/50">
+ <div className="text-sm text-muted-foreground">
{t('listMode.createdDaysAgo' as any, { days: daysAgo })}
</div>
- <div className={styles.actionButtons}>
+ <div className="flex items-center gap-2">
<Button
- type="link"
- size="small"
- className={styles.viewPostBtn}
+ variant="link"
+ size="sm"
+ className="text-sm text-primary px-2 h-auto border border-border/50 rounded bg-background transition-all hover:border-primary hover:bg-accent"
onClick={() => window.open(post.workLink, '_blank')}
>
{t('listMode.viewPost' as any)}
@@ -254,9 +249,9 @@ const SentList: React.FC<SentListProps> = ({ platform, uid, onDataChange, accoun
↗️
</Button>
<Button
- type="text"
- size="small"
- className={styles.moreBtn}
+ variant="ghost"
+ size="sm"
+ className="text-base text-muted-foreground px-2 h-auto rounded transition-all hover:bg-muted hover:text-foreground"
>
⋮
</Button>
@@ -275,30 +270,42 @@ const SentList: React.FC<SentListProps> = ({ platform, uid, onDataChange, accoun
if (loading && posts.length === 0) {
return (
- <div className={styles.sentList}>
- <div className={styles.loadingContainer}>
- <Skeleton active paragraph={{ rows: 3 }} />
- <Skeleton active paragraph={{ rows: 3 }} />
- <Skeleton active paragraph={{ rows: 3 }} />
+ <div className="w-full h-full flex flex-col p-0">
+ <div className="py-5">
+ <div className="space-y-3 p-4">
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-3/4" />
+ <Skeleton className="h-20 w-full" />
+ </div>
+ <div className="space-y-3 p-4">
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-3/4" />
+ <Skeleton className="h-20 w-full" />
+ </div>
+ <div className="space-y-3 p-4">
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-3/4" />
+ <Skeleton className="h-20 w-full" />
+ </div>
</div>
</div>
)
}
return (
- <div className={styles.sentList}>
+ <div className="w-full h-full flex flex-col p-0">
{validPosts.length > 0
? (
<>
- <div className={styles.postsContainer}>
+ <div className="flex-1 overflow-y-auto overflow-x-hidden p-0">
{validPosts.map(renderPostItem)}
</div>
{hasMore && (
- <div className={styles.loadMoreContainer}>
+ <div className="flex justify-center py-6 shrink-0">
<Button
- loading={loading}
+ disabled={loading}
onClick={loadMore}
- className={styles.loadMoreButton}
+ className="rounded-[20px] px-8 h-auto py-2.5 text-sm font-medium"
>
Load more...
</Button>
@@ -307,10 +314,9 @@ const SentList: React.FC<SentListProps> = ({ platform, uid, onDataChange, accoun
</>
)
: (
- <div className={styles.emptyState}>
- <Empty
- description={t('listMode.noSentPosts' as any)}
- />
+ <div className="flex flex-col items-center justify-center py-16 text-center text-muted-foreground h-full min-h-[300px]">
+ <div className="text-4xl mb-4">📮</div>
+ <p className="text-sm">{t('listMode.noSentPosts' as any)}</p>
</div>
)}
</div>
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/index.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/index.tsx
index 7d1f2033..3a894378 100644
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/index.tsx
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/index.tsx
@@ -1,6 +1,5 @@
import type { ForwardedRef } from 'react'
import type { PublishRecordItem } from '@/api/plat/types/publish.types'
-import { Empty, Skeleton, Tabs } from 'antd'
import { forwardRef, memo, useState } from 'react'
import { DndProvider } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'
@@ -8,7 +7,9 @@ import { useShallow } from 'zustand/react/shallow'
import { useCalendarTiming } from '@/app/[lng]/accounts/components/CalendarTiming/useCalendarTiming'
import { useTransClient } from '@/app/i18n/client'
import { useAccountStore } from '@/store/account'
-import styles from './listMode.module.scss'
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
+import { Skeleton } from '@/components/ui/skeleton'
+import { Badge } from '@/components/ui/badge'
import QueueItem from './QueueItem'
import SentList from './SentList'
@@ -62,16 +63,22 @@ const ListMode = memo(
if (listLoading) {
return (
- <div className={styles.listMode}>
- <div className={styles.listHeader}>
- <div className={styles.listHeaderLeft}>
- <h3>{t('listMode.title' as any)}</h3>
+ <div className="w-full h-full flex flex-col p-2.5 px-[15px] box-border">
+ <div className="flex justify-between items-center mb-[15px] pb-2.5 border-b border-border">
+ <div className="flex flex-col gap-1">
+ <h3 className="m-0 text-lg font-semibold text-foreground">
+ {t('listMode.title' as any)}
+ </h3>
</div>
</div>
- <div className={styles.listContent}>
+ <div className="h-full p-0 pr-1.5">
{[1, 2, 3, 4, 5].map(i => (
- <div key={i} className={styles.skeletonItem}>
- <Skeleton active />
+ <div key={i} className="py-3 px-0.5 border-b border-border last:border-b-0">
+ <div className="space-y-3">
+ <Skeleton className="h-4 w-full" />
+ <Skeleton className="h-4 w-3/4" />
+ <Skeleton className="h-20 w-full" />
+ </div>
</div>
))}
</div>
@@ -80,19 +87,19 @@ const ListMode = memo(
}
const queueTabContent = (
- <div className={styles.tabContent}>
+ <div className="h-full p-0 pr-1.5">
<DndProvider backend={HTML5Backend}>
{queueRecords.length > 0
? (
- <div className={styles.queueList}>
+ <div className="h-full overflow-y-auto overflow-x-hidden p-0">
{queueRecords.map(renderRecordItem)}
</div>
)
: (
- <Empty
- description={t('listMode.noRecords' as any)}
- className={styles.emptyState}
- />
+ <div className="flex flex-col items-center justify-center py-16 text-center text-muted-foreground">
+ <div className="text-4xl mb-4">📋</div>
+ <p className="text-sm">{t('listMode.noRecords' as any)}</p>
+ </div>
)}
</DndProvider>
</div>
@@ -113,45 +120,34 @@ const ListMode = memo(
/>
)
- const tabItems = [
- {
- key: 'queue',
- label: (
- <div className={styles.tabLabel}>
- <span>{t('listMode.queue' as any)}</span>
- {queueRecords.length > 0
- ? (
- <span className={styles.tabBadge}>
- {queueRecords.length}
- </span>
- )
- : (
- <span className={styles.tabBadgeNone}>
- </span>
- )}
- </div>
- ),
- children: queueTabContent,
- },
- {
- key: 'sent',
- label: (
- <div className={styles.tabLabel}>
- <span>{t('listMode.sent' as any)}</span>
- {sentCount > 0 ? <span className={styles.tabBadge}>{sentCount}</span> : ''}
- </div>
- ),
- children: sentTabContent,
- },
- ]
-
return (
- <div className={styles.listMode}>
- <Tabs
- items={tabItems}
- className={styles.listTabs}
- size="small"
- />
+ <div className="w-full h-full flex flex-col p-2.5 px-[15px] box-border">
+ <Tabs defaultValue="queue" className="flex-1 flex flex-col min-h-0">
+ <TabsList className="grid w-full grid-cols-2">
+ <TabsTrigger value="queue" className="gap-2">
+ <span>{t('listMode.queue' as any)}</span>
+ {queueRecords.length > 0 && (
+ <Badge variant="secondary" className="h-5 min-w-5 px-1.5 text-xs">
+ {queueRecords.length}
+ </Badge>
+ )}
+ </TabsTrigger>
+ <TabsTrigger value="sent" className="gap-2">
+ <span>{t('listMode.sent' as any)}</span>
+ {sentCount > 0 && (
+ <Badge variant="secondary" className="h-5 min-w-5 px-1.5 text-xs">
+ {sentCount}
+ </Badge>
+ )}
+ </TabsTrigger>
+ </TabsList>
+ <TabsContent value="queue" className="flex-1 min-h-0 mt-4">
+ {queueTabContent}
+ </TabsContent>
+ <TabsContent value="sent" className="flex-1 min-h-0 mt-4">
+ {sentTabContent}
+ </TabsContent>
+ </Tabs>
</div>
)
},
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/listMode.module.scss b/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/listMode.module.scss
deleted file mode 100644
index acb6ebff..00000000
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/listMode.module.scss
+++ /dev/null
@@ -1,729 +0,0 @@
-.listMode {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- padding: 10px 15px 15px 15px;
- box-sizing: border-box;
-
- .listHeader {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15px;
- padding-bottom: 10px;
- border-bottom: 1px solid var(--grayColor8);
-
- .listHeaderLeft {
- display: flex;
- flex-direction: column;
- gap: 4px;
-
- h3 {
- margin: 0;
- font-size: var(--fs-lg);
- font-weight: 600;
- color: var(--textColor);
- }
-
- .recordCount {
- font-size: var(--fs-sm);
- color: var(--grayColor6);
- }
- }
-
- .listHeaderRight {
- display: flex;
- align-items: center;
- }
- }
-
- .listTabs {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
-
- :global {
- .ant-tabs {
- height: 100%;
- display: flex;
- flex-direction: column;
- }
-
- .ant-tabs-content-holder {
- flex: 1;
- min-height: 0;
- padding: 16px 0 0 0;
- }
-
- .ant-tabs-tabpane {
- height: 100%;
- overflow-y: auto;
- overflow-x: hidden;
- }
-
- .ant-tabs-nav {
- margin-bottom: 0;
- flex-shrink: 0;
- background: transparent;
- border-bottom: 1px solid #e8e8e8;
- padding: 0;
- }
-
- .ant-tabs-tab {
- font-weight: 500;
- padding: 12px 16px;
- border-radius: 0;
- transition: all 0.2s ease;
- margin: 0;
- border: none;
- background: transparent;
- position: relative;
- color: #666;
- }
-
- .ant-tabs-tab-active {
- font-weight: 600;
- color: #1890ff;
- background: transparent;
- }
-
- .ant-tabs-tab-active::after {
- content: '';
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- height: 2px;
- background: #1890ff;
- border-radius: 1px;
- }
-
- .ant-tabs-tab:hover:not(.ant-tabs-tab-active) {
- background: rgba(0, 0, 0, 0.04);
- color: #333;
- }
-
- .ant-tabs-ink-bar {
- display: none;
- }
- }
- }
-
- .tabLabel {
- display: flex;
- align-items: center;
- gap: 8px;
- font-size: 14px;
- }
-
- .tabBadge {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- min-width: 20px;
- height: 20px;
- padding: 0 6px;
- background: #f0f0f0;
- color: #666;
- border-radius: 10px;
- font-size: 12px;
- font-weight: 500;
- line-height: 1;
- }
-
- .tabBadgeNone {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- min-width: 20px;
- height: 20px;
- padding: 0 6px;
- background: transparent;
- color: transparent;
- border-radius: 10px;
- font-size: 12px;
- font-weight: 500;
- line-height: 1;
- }
-
- .tabContent {
- height: 100%;
- padding: 0 5px 0 0;
- }
-
- // Channel 筛选器按钮样式
- .channelFilterButton {
- display: flex;
- align-items: center;
- }
-
- .filterButton {
- height: 32px;
- padding: 0 12px;
- border-radius: 6px;
- border: 1px solid #d9d9d9;
- background: white;
- transition: all 0.2s ease;
-
- &:hover {
- border-color: #40a9ff;
- background: #f6ffed;
- }
-
- &:focus {
- border-color: #1890ff;
- box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
- }
- }
-
- .filterButtonContent {
- display: flex;
- align-items: center;
- gap: 8px;
- }
-
- .filterButtonAvatar {
- flex-shrink: 0;
- }
-
- .filterButtonText {
- font-size: 14px;
- color: #333;
- max-width: 120px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .filterButtonIcon {
- font-size: 12px;
- color: #666;
- flex-shrink: 0;
- }
-
- // 下拉菜单样式
- .channelDropdownOverlay {
- :global {
- .ant-dropdown {
- padding: 0;
- }
- }
- }
-
- .channelDropdown {
- width: 280px;
- background: white;
- border-radius: 8px;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
- overflow: hidden;
- }
-
- .searchContainer {
- padding: 16px 16px 0 16px;
- }
-
- .searchInput {
- width: 100%;
-
- :global {
- .ant-input {
- border-radius: 6px;
- border: 1px solid #d9d9d9;
- transition: all 0.2s ease;
-
- &:hover {
- border-color: #40a9ff;
- }
-
- &:focus {
- border-color: #1890ff;
- box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
- }
- }
-
- .ant-input-prefix {
- color: #999;
- }
- }
- }
-
- .channelList {
- max-height: 300px;
- overflow-y: auto;
- padding: 8px 0;
- }
-
- .channelItem {
- padding: 8px 16px;
- cursor: pointer;
- transition: all 0.2s ease;
- border-bottom: 1px solid #f5f5f5;
-
- &:last-child {
- border-bottom: none;
- }
-
- &:hover {
- background: #f5f5f5;
- }
-
- &.channelItemActive {
- background: #e6f7ff;
- border-color: #91d5ff;
- }
- }
-
- .channelInfo {
- display: flex;
- align-items: center;
- gap: 12px;
- }
-
- .channelAvatar {
- flex-shrink: 0;
- border: 1px solid #f0f0f0;
- }
-
- .channelDetails {
- flex: 1;
- min-width: 0;
- }
-
- .channelName {
- font-size: 14px;
- color: #333;
- font-weight: 500;
- display: block;
- margin-bottom: 4px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .channelPlatform {
- display: flex;
- align-items: center;
- gap: 6px;
- font-size: 12px;
- color: #666;
-
- img {
- width: 16px;
- height: 16px;
- border-radius: 2px;
- }
- }
-
- .noChannels {
- text-align: center;
- color: #999;
- font-size: 14px;
- padding: 40px 16px;
- }
-
- .queueList {
- height: 100%;
- overflow-y: auto;
- overflow-x: hidden;
- padding: 0;
- }
-
- .listContent {
- height: 100%;
- padding: 0 5px 0 0;
-
- .recordList {
- background: transparent;
- flex: 1;
- overflow-y: auto;
- overflow-x: hidden;
-
- :global {
- .ant-list-item {
- padding: 12px 8px;
- border-bottom: 1px solid var(--grayColor8);
- transition: all 0.2s ease;
- max-width: 100%;
- box-sizing: border-box;
-
- &:hover {
- background: rgba(0, 0, 0, 0.02);
- border-radius: 8px;
- padding: 12px 4px;
- margin: 0 -4px;
- box-sizing: border-box;
- }
-
- &:last-child {
- border-bottom: none;
- }
- }
-
- .ant-list-item-actions {
- margin-left: 12px;
- flex-shrink: 0;
- }
- }
- }
-
- .emptyState {
- margin-top: 60px;
- }
- }
-
- .listItem {
- .timeInfo {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- min-width: 60px;
-
- .date {
- font-size: var(--fs-sm);
- color: var(--grayColor6);
- font-weight: 500;
- }
-
- .time {
- font-size: var(--fs-lg);
- color: var(--textColor);
- font-weight: 600;
- margin-top: 2px;
- }
- }
-
- .recordWrapper {
- flex: 1;
- min-width: 0;
- overflow: hidden;
- }
- }
-
- .skeletonItem {
- padding: 12px 2px;
- border-bottom: 1px solid var(--grayColor8);
-
- &:last-child {
- border-bottom: none;
- }
- }
-
- // Sent列表相关样式 - 全新设计
- .sentList {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- padding: 0;
-
- .postsContainer {
- flex: 1;
- overflow-y: auto;
- overflow-x: hidden;
- padding: 0;
- }
-
- .sentPostItem {
- margin-bottom: 24px;
-
- &:last-child {
- margin-bottom: 0;
- }
- }
-
- .postCard {
- background: white;
- border-radius: 12px;
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
- border: 1px solid #f0f0f0;
- overflow: hidden;
- transition: all 0.3s ease;
-
- &:hover {
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
- transform: translateY(-2px);
- }
- }
-
- .postDateHeader {
- padding: 16px 20px 12px 20px;
- border-bottom: 1px solid #f5f5f5;
-
- .dateTime {
- display: flex;
- align-items: center;
- gap: 8px;
-
- .dateText {
- font-size: 14px;
- color: #666;
- font-weight: 500;
- }
-
- .timeText {
- font-size: 14px;
- color: #666;
- font-weight: 500;
- }
- }
- }
-
- .postContent {
- padding: 20px;
-
- .userInfo {
- display: flex;
- align-items: flex-start;
- gap: 12px;
- margin-bottom: 16px;
-
- .userAvatar {
- flex-shrink: 0;
- border: 2px solid #f0f0f0;
- }
-
- .userDetails {
- flex: 1;
- min-width: 0;
-
- .username {
- font-size: 16px;
- font-weight: 600;
- color: #333;
- margin-bottom: 4px;
- line-height: 1.3;
- }
-
- .userSubtitle {
- font-size: 14px;
- color: #666;
- line-height: 1.4;
- }
- }
-
- .chatIcon {
- font-size: 16px;
- color: #999;
- cursor: pointer;
- padding: 4px;
- border-radius: 4px;
- transition: all 0.2s ease;
-
- &:hover {
- background: #f5f5f5;
- color: #666;
- }
- }
- }
-
- .postText {
- font-size: 16px;
- color: #333;
- line-height: 1.5;
- margin-bottom: 16px;
- word-wrap: break-word;
- }
-
- .shareIcon {
- font-size: 16px;
- color: #999;
- margin-bottom: 16px;
- cursor: pointer;
- display: inline-block;
- padding: 4px;
- border-radius: 4px;
- transition: all 0.2s ease;
-
- &:hover {
- background: #f5f5f5;
- color: #666;
- }
- }
-
- .mediaContainer {
- margin-bottom: 20px;
-
- .mediaWrapper {
- position: relative;
- border-radius: 8px;
- overflow: hidden;
- background: #f5f5f5;
- max-width: 300px;
-
- .mediaImage {
- width: 100%;
- height: auto;
- display: block;
- border-radius: 8px;
- }
-
- .playButton {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 48px;
- height: 48px;
- background: rgba(0, 0, 0, 0.7);
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- transition: all 0.2s ease;
-
- &:hover {
- background: rgba(0, 0, 0, 0.8);
- transform: translate(-50%, -50%) scale(1.1);
- }
-
- .playIcon {
- color: white;
- font-size: 16px;
- margin-left: 2px;
- }
- }
- }
- }
-
- .engagementMetrics {
- margin-bottom: 20px;
- padding: 16px;
- background: #fafafa;
- border-radius: 8px;
-
- .metricsRow {
- display: flex;
- align-items: center;
- gap: 24px;
- flex-wrap: wrap;
-
- .metricItem {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 4px;
- min-width: 60px;
-
- .metricIcon {
- font-size: 16px;
- color: #666;
- }
-
- .metricLabel {
- font-size: 12px;
- color: #999;
- font-weight: 500;
- text-align: center;
- }
-
- .metricValue {
- font-size: 14px;
- color: #666;
- font-weight: 600;
- }
- }
-
- .chartIcon {
- margin-left: auto;
- font-size: 16px;
- color: #999;
- cursor: pointer;
- padding: 4px;
- border-radius: 4px;
- transition: all 0.2s ease;
-
- &:hover {
- background: #f0f0f0;
- color: #666;
- }
- }
- }
- }
-
- .postFooter {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding-top: 16px;
- border-top: 1px solid #f0f0f0;
-
- .creationInfo {
- font-size: 14px;
- color: #999;
- }
-
- .actionButtons {
- display: flex;
- align-items: center;
- gap: 8px;
-
- .viewPostBtn {
- font-size: 14px;
- color: #1890ff;
- padding: 4px 8px;
- height: auto;
- border-radius: 4px;
- border: 1px solid #d9d9d9;
- background: white;
- transition: all 0.2s ease;
-
- &:hover {
- border-color: #1890ff;
- background: #f6ffed;
- }
- }
-
- .moreBtn {
- font-size: 16px;
- color: #999;
- padding: 4px 8px;
- height: auto;
- border-radius: 4px;
- transition: all 0.2s ease;
-
- &:hover {
- background: #f5f5f5;
- color: #666;
- }
- }
- }
- }
- }
-
- .loadMoreContainer {
- display: flex;
- justify-content: center;
- padding: 24px 0;
- flex-shrink: 0;
-
- .loadMoreButton {
- border-radius: 20px;
- padding: 10px 32px;
- height: auto;
- font-size: 14px;
- font-weight: 500;
- }
- }
-
- .emptyState {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 100%;
- min-height: 300px;
- }
-
- .loadingContainer {
- padding: 20px 0;
-
- :global {
- .ant-skeleton {
- margin-bottom: 20px;
- }
- }
- }
- }
-}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/queueItem.module.scss b/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/queueItem.module.scss
deleted file mode 100644
index a0eebac1..00000000
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/ListMode/queueItem.module.scss
+++ /dev/null
@@ -1,370 +0,0 @@
-.queueItem {
- background: white;
- border-radius: 12px;
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
- border: 1px solid #f0f0f0;
- overflow: hidden;
- transition: all 0.3s ease;
- margin-bottom: 16px;
-
- &:hover {
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
- transform: translateY(-2px);
- }
-
- &:last-child {
- margin-bottom: 0;
- }
-}
-
-.statusHeader {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- padding: 16px 20px 12px 20px;
- border-bottom: 1px solid #f5f5f5;
-
- .statusInfo {
- display: flex;
- flex-direction: column;
- gap: 4px;
-
- .statusText {
- font-size: 16px;
- font-weight: 600;
- color: #333;
- }
-
- .dateTime {
- display: flex;
- align-items: center;
- gap: 8px;
-
- .date {
- font-size: 14px;
- color: #666;
- font-weight: 500;
- }
-
- .time {
- font-size: 14px;
- color: #666;
- font-weight: 500;
- }
- }
- }
-
- .statusBadge {
- flex-shrink: 0;
- }
-
- .commentIcon {
- font-size: 16px;
- color: #999;
- cursor: pointer;
- padding: 4px;
- border-radius: 4px;
- transition: all 0.2s ease;
-
- &:hover {
- background: #f5f5f5;
- color: #666;
- }
- }
-}
-
-.errorBanner {
- display: flex;
- align-items: center;
- gap: 12px;
- padding: 12px 20px;
- background: #fff2f0;
- border-bottom: 1px solid #ffccc7;
-
- .errorIcon {
- color: #ff4d4f;
- font-size: 16px;
- flex-shrink: 0;
- }
-
- .errorMessage {
- color: #ff4d4f;
- font-size: 14px;
- line-height: 1.4;
- flex: 1;
- }
-}
-
-.contentArea {
- padding: 20px;
-
- .accountInfo {
- display: flex;
- align-items: flex-start;
- gap: 12px;
- margin-bottom: 16px;
-
- .avatarContainer {
- position: relative;
- flex-shrink: 0;
-
- .avatar {
- width: 48px;
- height: 48px;
- border-radius: 50%;
- object-fit: cover;
- border: 2px solid #f0f0f0;
- }
-
- .platformIcon {
- position: absolute;
- bottom: -2px;
- right: -2px;
- width: 20px;
- height: 20px;
- background: white;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- border: 2px solid white;
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
-
- .platIcon {
- width: 12px;
- height: 12px;
- object-fit: contain;
- }
- }
- }
-
- .accountDetails {
- flex: 1;
- min-width: 0;
-
- .accountName {
- font-size: 16px;
- font-weight: 600;
- color: #333;
- margin-bottom: 4px;
- line-height: 1.3;
- }
-
- .accountHandle {
- font-size: 14px;
- color: #666;
- line-height: 1.4;
- }
- }
- }
-
- .postContent {
- position: relative;
-
- .postText {
- font-size: 16px;
- color: #333;
- line-height: 1.5;
- margin-bottom: 16px;
- word-wrap: break-word;
- }
-
- .mediaContainer {
- margin-bottom: 16px;
-
- .videoThumbnail {
- position: relative;
- border-radius: 8px;
- overflow: hidden;
- background: #f5f5f5;
- max-width: 300px;
-
- .mediaImage {
- width: 100%;
- height: auto;
- display: block;
- border-radius: 8px;
- }
-
- .playButton {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 48px;
- height: 48px;
- background: rgba(0, 0, 0, 0.7);
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- transition: all 0.2s ease;
-
- &:hover {
- background: rgba(0, 0, 0, 0.8);
- transform: translate(-50%, -50%) scale(1.1);
- }
-
- .playIcon {
- color: white;
- font-size: 16px;
- margin-left: 2px;
- }
- }
- }
-
- .imageContainer {
- border-radius: 8px;
- overflow: hidden;
- background: #f5f5f5;
- max-width: 300px;
-
- .mediaImage {
- width: 100%;
- height: auto;
- display: block;
- border-radius: 8px;
- }
- }
- }
-
- .shareIcon {
- position: absolute;
- top: 0;
- right: 0;
- font-size: 16px;
- color: #999;
- cursor: pointer;
- padding: 4px;
- border-radius: 4px;
- transition: all 0.2s ease;
-
- &:hover {
- background: #f5f5f5;
- color: #666;
- }
-
- .shareSymbol {
- font-size: 14px;
- font-weight: bold;
- }
- }
- }
-}
-
-.footer {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 16px 20px;
- border-top: 1px solid #f0f0f0;
- background: #fafafa;
-
- .creationInfo {
- font-size: 14px;
- color: #999;
- }
-
- .actionButtons {
- display: flex;
- align-items: center;
- gap: 8px;
-
- .retryButton {
- font-size: 14px;
- height: 32px;
- border-radius: 6px;
- font-weight: 500;
- }
-
- .copyButton {
- font-size: 14px;
- height: 32px;
- border-radius: 6px;
- font-weight: 500;
- border: 1px solid #d9d9d9;
- background: white;
- transition: all 0.2s ease;
-
- &:hover {
- border-color: #1890ff;
- background: #f6ffed;
- }
- }
- }
-}
-
-// 响应式设计
-@media (max-width: 768px) {
- .queueItem {
- margin-bottom: 12px;
- }
-
- .statusHeader {
- padding: 12px 16px 8px 16px;
- }
-
- .contentArea {
- padding: 16px;
-
- .accountInfo {
- margin-bottom: 12px;
-
- .avatarContainer {
- .avatar {
- width: 40px;
- height: 40px;
- }
-
- .platformIcon {
- width: 18px;
- height: 18px;
-
- .platIcon {
- width: 10px;
- height: 10px;
- }
- }
- }
-
- .accountDetails {
- .accountName {
- font-size: 15px;
- }
-
- .accountHandle {
- font-size: 13px;
- }
- }
- }
-
- .postContent {
- .postText {
- font-size: 15px;
- margin-bottom: 12px;
- }
-
- .mediaContainer {
- margin-bottom: 12px;
- max-width: 250px;
- }
- }
- }
-
- .footer {
- padding: 12px 16px;
- flex-direction: column;
- gap: 12px;
- align-items: flex-start;
-
- .creationInfo {
- font-size: 13px;
- }
-
- .actionButtons {
- width: 100%;
- justify-content: flex-end;
- }
- }
-}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss b/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss
deleted file mode 100644
index 390c09a6..00000000
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss
+++ /dev/null
@@ -1,365 +0,0 @@
-.calendarTiming {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- overflow: auto;
- padding: 10px 15px 15px 15px;
- box-sizing: border-box;
-
- :global {
- .calendarTiming-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15px;
- &-user {
- display: flex;
- align-items: center;
- &-details {
- margin-left: 15px;
- &-name {
- font-size: var(--fs-xl);
- font-weight: 700;
- }
- }
- }
- &-options {
- }
- }
-
- .calendarTiming-toolbar {
- display: flex;
- justify-content: space-between;
- h1 {
- margin: 0 15px 0 10px;
- font-size: 18px;
- }
- &-left,
- &-right {
- display: flex;
- align-items: center;
- margin-bottom: 10px;
- }
- &-right {
- gap: 12px;
- }
- }
-
- .modeTabs {
- :global {
- .ant-tabs-tab {
- padding: 4px 12px;
- font-size: var(--fs-sm);
-
- .anticon {
- margin-right: 4px;
- }
- }
-
- .ant-tabs-tab-active {
- background: var(--colorPrimary1);
- border-radius: 6px;
- }
- }
- }
- .fc-daygrid-day.fc-day-today {
- background: transparent;
- .calendarTimingItem-top-day {
- background: var(--colorPrimary5);
- color: #fff;
- }
- }
- .fc-daygrid-day-frame {
- display: flex;
- .fc-daygrid-day-top {
- display: flex;
- flex: 1;
- .fc-daygrid-day-number {
- z-index: auto;
- padding: 0;
- flex: 1;
- }
- }
- .fc-daygrid-day-events {
- display: none;
- }
- }
- .fc-media-screen {
- display: flex;
- flex-direction: column;
- min-height: 0;
- }
- .calendarTiming-calendar {
- position: relative;
- display: flex;
- flex-direction: column;
- min-height: 0;
- height: 100%;
- .fc-scrollgrid {
- border-top: none !important;
- }
- thead {
- 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;
-}
-
-.allPlatIcon {
- flex-shrink: 0;
- width: 50px;
- height: 50px;
- border: 1px solid var(--grayColor8);
- border-radius: 50%;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- ul {
- display: flex;
- li {
- border: 2px solid #333;
- border-radius: 50%;
- flex-shrink: 0;
- margin: 0.5px;
- }
- }
-
- // Channel 筛选器按钮样式
- .channelFilterButton {
- display: flex;
- align-items: center;
- }
-
- .filterButton {
- height: 32px;
- padding: 0 12px;
- border-radius: 6px;
- border: 1px solid #d9d9d9;
- background: white;
- transition: all 0.2s ease;
-
- &:hover {
- border-color: #40a9ff;
- background: #f6ffed;
- }
-
- &:focus {
- border-color: #1890ff;
- box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
- }
- }
-
- .filterButtonContent {
- display: flex;
- align-items: center;
- gap: 8px;
- }
-
- .filterButtonAvatar {
- flex-shrink: 0;
- }
-
- .filterButtonText {
- font-size: 14px;
- color: #333;
- max-width: 120px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .filterButtonIcon {
- font-size: 12px;
- color: #666;
- flex-shrink: 0;
- }
-
- // 下拉菜单样式
- .channelDropdownOverlay {
- :global {
- .ant-dropdown {
- padding: 0;
- }
- }
- }
-
- .channelDropdown {
- width: 280px;
- background: white;
- border-radius: 8px;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
- overflow: hidden;
- }
-
- .searchContainer {
- padding: 16px 16px 0 16px;
- }
-
- .searchInput {
- width: 100%;
-
- :global {
- .ant-input {
- border-radius: 6px;
- border: 1px solid #d9d9d9;
- transition: all 0.2s ease;
-
- &:hover {
- border-color: #40a9ff;
- }
-
- &:focus {
- border-color: #1890ff;
- box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
- }
- }
-
- .ant-input-prefix {
- color: #999;
- }
- }
- }
-
- .channelList {
- max-height: 300px;
- overflow-y: auto;
- padding: 8px 0;
- }
-
- .channelItem {
- padding: 8px 16px;
- cursor: pointer;
- transition: all 0.2s ease;
- border-bottom: 1px solid #f5f5f5;
-
- &:last-child {
- border-bottom: none;
- }
-
- &:hover {
- background: #f5f5f5;
- }
-
- &.channelItemActive {
- background: #e6f7ff;
- border-color: #91d5ff;
- }
- }
-
- .channelInfo {
- display: flex;
- align-items: center;
- gap: 12px;
- }
-
- .channelAvatar {
- flex-shrink: 0;
- border: 1px solid #f0f0f0;
- }
-
- .channelDetails {
- flex: 1;
- min-width: 0;
- }
-
- .channelName {
- font-size: 14px;
- color: #333;
- font-weight: 500;
- display: block;
- margin-bottom: 4px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .channelPlatform {
- display: flex;
- align-items: center;
- gap: 6px;
- font-size: 12px;
- color: #666;
-
- img {
- width: 16px;
- height: 16px;
- border-radius: 2px;
- }
- }
-
- .noChannels {
- text-align: center;
- color: #999;
- font-size: 14px;
- padding: 40px 16px;
- }
-}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.scss b/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.scss
new file mode 100644
index 00000000..0f038db3
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.scss
@@ -0,0 +1,137 @@
+/* CalendarTiming FullCalendar 全局样式覆盖 */
+.fc-daygrid-day.fc-day-today {
+ background: transparent;
+}
+
+/* 今天的日期样式已经在组件内通过 Tailwind CSS 处理,这里不再需要 */
+
+.fc-daygrid-day-frame {
+ display: flex;
+}
+
+.fc-daygrid-day-frame .fc-daygrid-day-top {
+ display: flex;
+ flex: 1;
+}
+
+.fc-daygrid-day-frame .fc-daygrid-day-top .fc-daygrid-day-number {
+ z-index: auto;
+ padding: 0;
+ flex: 1;
+}
+
+.fc-daygrid-day-frame .fc-daygrid-day-events {
+ display: none;
+}
+
+.fc-media-screen {
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
+}
+
+.calendarTiming-calendar {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
+ height: 100%;
+ padding: 1rem;
+ will-change: transform, opacity;
+}
+
+.calendarTiming-calendar .fc-scrollgrid {
+ border-top: none !important;
+}
+
+.calendarTiming-calendar thead {
+ background-color: var(--background);
+ z-index: 5;
+}
+
+.calendarTiming-calendar thead .fc-scroller-harness {
+ border-top: 1px solid var(--border);
+}
+
+.calendarTiming-calendar thead .fc-scrollgrid-sync-inner {
+ padding: 5px 0;
+}
+
+.calendarTiming-calendar .fc-theme-standard td,
+.calendarTiming-calendar .fc-theme-standard th {
+ border-color: var(--border);
+}
+
+/* CSSTransition 日历切换动画 */
+/* 向左滑动(下月):从右侧滑入,向左滑出 */
+.slideLeftEnter {
+ opacity: 0;
+ transform: translateX(50px);
+}
+
+.slideLeftEnterActive {
+ opacity: 1;
+ transform: translateX(0);
+ transition:
+ opacity 300ms ease-out,
+ transform 300ms ease-out;
+}
+
+.slideLeftExit {
+ opacity: 1;
+ transform: translateX(0);
+}
+
+.slideLeftExitActive {
+ opacity: 0;
+ transform: translateX(-50px);
+ transition:
+ opacity 300ms ease-out,
+ transform 300ms ease-out;
+}
+
+/* 向右滑动(上月):从左侧滑入,向右滑出 */
+.slideRightEnter {
+ opacity: 0;
+ transform: translateX(-50px);
+}
+
+.slideRightEnterActive {
+ opacity: 1;
+ transform: translateX(0);
+ transition:
+ opacity 300ms ease-out,
+ transform 300ms ease-out;
+}
+
+.slideRightExit {
+ opacity: 1;
+ transform: translateX(0);
+}
+
+.slideRightExitActive {
+ opacity: 0;
+ transform: translateX(50px);
+ transition:
+ opacity 300ms ease-out,
+ transform 300ms ease-out;
+}
+
+/* 淡入淡出(今天) */
+.fadeEnter {
+ opacity: 0;
+}
+
+.fadeEnterActive {
+ opacity: 1;
+ transition: opacity 300ms ease-out;
+}
+
+.fadeExit {
+ opacity: 1;
+}
+
+.fadeExitActive {
+ opacity: 0;
+ transition: opacity 300ms ease-out;
+}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils.ts b/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils.ts
index 7e3ea9d2..b10d9f85 100644
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils.ts
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils.ts
@@ -1,7 +1,6 @@
import dayjs from 'dayjs'
import timezone from 'dayjs/plugin/timezone'
import utc from 'dayjs/plugin/utc'
-import styles from './calendarTiming.module.scss'
dayjs.extend(utc)
dayjs.extend(timezone)
@@ -21,27 +20,27 @@ export function getFullCalendarLang(lang: string) {
export function getTransitionClassNames(direction: 'left' | 'right' | 'fade') {
if (direction === 'left') {
return {
- enter: styles.slideLeftEnter,
- enterActive: styles.slideLeftEnterActive,
- exit: styles.slideLeftExit,
- exitActive: styles.slideLeftExitActive,
+ enter: 'slideLeftEnter',
+ enterActive: 'slideLeftEnterActive',
+ exit: 'slideLeftExit',
+ exitActive: 'slideLeftExitActive',
}
}
else if (direction === 'right') {
return {
- enter: styles.slideRightEnter,
- enterActive: styles.slideRightEnterActive,
- exit: styles.slideRightExit,
- exitActive: styles.slideRightExitActive,
+ enter: 'slideRightEnter',
+ enterActive: 'slideRightEnterActive',
+ exit: 'slideRightExit',
+ exitActive: 'slideRightExitActive',
}
}
else {
// fade 动画
return {
- enter: styles.fadeEnter,
- enterActive: styles.fadeEnterActive,
- exit: styles.fadeExit,
- exitActive: styles.fadeExitActive,
+ enter: 'fadeEnter',
+ enterActive: 'fadeEnterActive',
+ exit: 'fadeExit',
+ exitActive: 'fadeExitActive',
}
}
}
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/index.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
index 6e77d695..adee9f9e 100644
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTiming/index.tsx
@@ -1,22 +1,17 @@
+/**
+ * CalendarTiming 组件
+ *
+ * 功能描述: 日历定时发布组件 - 显示日历视图或列表视图,管理发布任务
+ * 重构说明: 已移除顶部header和toolbar,使用新的CalendarToolbar组件
+ */
+
import type { DatesSetArg } from '@fullcalendar/core'
import type {
ForwardedRef,
} from 'react'
import type { IPublishDialogRef } from '@/components/PublishDialog'
-import {
- CalendarOutlined,
- DownOutlined,
- LeftOutlined,
- PlusOutlined,
- RightOutlined,
- SearchOutlined,
- UnorderedListOutlined,
-} from '@ant-design/icons'
import dayGridPlugin from '@fullcalendar/daygrid'
import FullCalendar from '@fullcalendar/react'
-import { Avatar, Button, Dropdown, Input, Tabs } from 'antd'
-import { confirm } from '@/lib/confirm'
-import dayjs from 'dayjs'
import { useSearchParams } from 'next/navigation'
import {
forwardRef,
@@ -29,27 +24,21 @@ import { DndProvider } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'
import { CSSTransition } from 'react-transition-group'
import { useShallow } from 'zustand/react/shallow'
-import AllPlatIcon from '@/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon'
import {
getDays,
getFullCalendarLang,
getTransitionClassNames,
} from '@/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils'
-import CalendarTimingItem from '@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem'
+import CalendarToolbar from '@/app/[lng]/accounts/components/CalendarTiming/CalendarToolbar'
import ListMode from '@/app/[lng]/accounts/components/CalendarTiming/ListMode'
import { useCalendarTiming } from '@/app/[lng]/accounts/components/CalendarTiming/useCalendarTiming'
-import { AccountStatus } from '@/app/config/accountConfig'
-import { AccountPlatInfoMap } from '@/app/config/platConfig'
-import { useTransClient } from '@/app/i18n/client'
-import AvatarPlat from '@/components/AvatarPlat'
import PublishDialog from '@/components/PublishDialog'
import { PublishDatePickerType } from '@/components/PublishDialog/compoents/PublishDatePicker/publishDatePicker.enums'
-import { usePublishDialog } from '@/components/PublishDialog/usePublishDialog'
import { useGetClientLng } from '@/hooks/useSystem'
import { useAccountStore } from '@/store/account'
import { useUserStore } from '@/store/user'
-import { getOssUrl } from '@/utils/oss'
-import styles from './calendarTiming.module.scss'
+import CalendarTimingItem from '../CalendarTimingItem'
+import './calendarTiming.scss'
export interface ICalendarTimingRef {}
export interface ICalendarTimingProps {}
@@ -65,7 +54,6 @@ const CalendarTiming = memo(
const [direction, setDirection] = useState<'left' | 'right' | 'fade'>(
'left',
)
- const { t } = useTransClient('account')
const [currentDate, setCurrentDate] = useState<Date>(new Date())
const [activeMode, setActiveMode] = useState<'calendar' | 'list'>(
'calendar',
@@ -78,239 +66,13 @@ const CalendarTiming = memo(
}
const calendarTimingCalendarRef = useRef<HTMLDivElement>(null)
const [publishDialogOpen, setPublishDialogOpen] = useState(false)
- const { accountList, accountActive, setAccountActive } = useAccountStore(
+ const { accountList, accountActive } = useAccountStore(
useShallow(state => ({
accountList: state.accountList,
accountActive: state.accountActive,
- setAccountActive: state.setAccountActive,
})),
)
- // 频道筛选相关状态
- const [channelSearchText, setChannelSearchText] = useState('')
-
- // 筛选后的账户列表 - 只显示在线账户
- const filteredAccounts = accountList.filter(
- account =>
- account.status === AccountStatus.USABLE
- && (account.nickname
- .toLowerCase()
- .includes(channelSearchText.toLowerCase())
- || account.account
- .toLowerCase()
- .includes(channelSearchText.toLowerCase())),
- )
-
- // 处理账户选择 - 与 AccountSidebar 同步
- const handleChannelSelect = (account: any) => {
- setAccountActive(account)
- }
-
- // Channel 筛选器下拉菜单内容
- const channelDropdownContent = (
- <div
- style={{
- width: '280px',
- background: 'white',
- borderRadius: '8px',
- boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
- overflow: 'hidden',
- }}
- >
- <div style={{ padding: '16px 16px 0 16px' }}>
- <Input
- placeholder={t('listMode.searchChannels' as any)}
- prefix={<SearchOutlined />}
- value={channelSearchText}
- onChange={e => setChannelSearchText(e.target.value)}
- style={{ width: '100%' }}
- />
- </div>
- <div
- style={{ maxHeight: '300px', overflowY: 'auto', padding: '8px 0' }}
- >
- {filteredAccounts.length > 0
- ? (
- filteredAccounts.map((account) => {
- const platInfo = AccountPlatInfoMap.get(account.type)
- return (
- <div
- key={account.id}
- style={{
- padding: '8px 16px',
- cursor: 'pointer',
- transition: 'all 0.2s ease',
- borderBottom: '1px solid #f5f5f5',
- backgroundColor:
- accountActive?.id === account.id
- ? '#e6f7ff'
- : 'transparent',
- }}
- onClick={() => handleChannelSelect(account)}
- onMouseEnter={(e) => {
- if (accountActive?.id !== account.id) {
- e.currentTarget.style.backgroundColor = '#f5f5f5'
- }
- }}
- onMouseLeave={(e) => {
- if (accountActive?.id !== account.id) {
- e.currentTarget.style.backgroundColor = 'transparent'
- }
- }}
- >
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: '12px',
- }}
- >
- <Avatar
- src={getOssUrl(account.avatar)}
- size={32}
- style={{ flexShrink: 0, border: '1px solid #f0f0f0' }}
- >
- {account.nickname?.[0] || account.account?.[0]}
- </Avatar>
- <div style={{ flex: 1, minWidth: 0 }}>
- <div
- style={{
- fontSize: '14px',
- color: '#333',
- fontWeight: 500,
- marginBottom: '4px',
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap',
- }}
- >
- {account.nickname || account.account}
- </div>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- fontSize: '12px',
- color: '#666',
- }}
- >
- <img
- src={platInfo?.icon}
- alt={platInfo?.name}
- style={{
- width: '16px',
- height: '16px',
- borderRadius: '2px',
- }}
- />
- <span>{platInfo?.name}</span>
- </div>
- </div>
- </div>
- </div>
- )
- })
- )
- : (
- <div
- style={{
- textAlign: 'center',
- color: '#999',
- fontSize: '14px',
- padding: '40px 16px',
- }}
- >
- {accountList.length === 0
- ? t('sidebar.noAccounts')
- : accountList.filter(
- account => account.status === AccountStatus.USABLE,
- ).length === 0
- ? t('sidebar.noOnlineAccounts')
- : t('listMode.noChannelsFound' as any)}
- </div>
- )}
- </div>
- </div>
- )
-
- // Channel 筛选器按钮
- const channelFilter = (
- <div
- style={{ display: 'flex', alignItems: 'center', marginTop: '-15px' }}
- >
- <Dropdown
- menu={{
- items: [{ key: 'channelFilter', label: channelDropdownContent }],
- }}
- trigger={['click']}
- placement="bottomRight"
- >
- <Button
- style={{
- height: '32px',
- padding: '0 12px',
- borderRadius: '6px',
- border: 'none',
- background: 'white',
- transition: 'all 0.2s ease',
- }}
- >
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- paddingBottom: '2px',
- }}
- >
- {accountActive
- ? (
- <>
- <Avatar
- src={getOssUrl(accountActive.avatar)}
- size={20}
- style={{ flexShrink: 0 }}
- >
- {accountActive.nickname?.[0]
- || accountActive.account?.[0]}
- </Avatar>
- <span
- style={{
- fontSize: '14px',
- color: '#333',
- width: '52px',
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap',
- }}
- >
- {accountActive.nickname || accountActive.account}
- </span>
- </>
- )
- : (
- <span
- style={{
- fontSize: '14px',
- color: '#333',
- width: '80px',
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap',
- }}
- >
- {t('listMode.selectChannel' as any)}
- </span>
- )}
- <DownOutlined
- style={{ fontSize: '12px', color: '#666', flexShrink: 0 }}
- />
- </div>
- </Button>
- </Dropdown>
- </div>
- )
const {
setCalendarCallWidth,
listLoading,
@@ -440,7 +202,7 @@ const CalendarTiming = memo(
}
return (
- <div className={styles.calendarTiming}>
+ <div className="flex flex-col flex-1 overflow-hidden">
<PublishDialog
defaultAccountId={accountActive?.id}
ref={publishDialogRef}
@@ -452,191 +214,71 @@ const CalendarTiming = memo(
accounts={accountList}
/>
- <div className="calendarTiming-header">
- <div className="calendarTiming-header-user">
- {!accountActive
- ? (
- <>
- <AllPlatIcon />
- <div className="calendarTiming-header-user-details">
- <div className="calendarTiming-header-user-details-name">
- {t('allPlatforms')}
- </div>
- </div>
- </>
- )
- : (
- <>
- <AvatarPlat
- account={accountActive!}
- avatarWidth={50}
- width={18}
- />
- <div className="calendarTiming-header-user-details">
- <div className="calendarTiming-header-user-details-name">
- {accountActive.nickname}
- </div>
- </div>
- </>
- )}
- </div>
- <div className="calendarTiming-header-options">
- <Button
- size="large"
- icon={<PlusOutlined />}
- onClick={() => {
- // 检查是否有可用账户
- const hasAccounts = accountList.some(
- account => account.status === AccountStatus.USABLE
- )
-
- if (!hasAccounts) {
- // 显示提示对话框
- confirm({
- title: t('noAccountWarning.title' as any),
- content: t('noAccountWarning.content' as any),
- okText: t('noAccountWarning.addAccount' as any),
- cancelText: t('noAccountWarning.continuePublish' as any),
- onOk: () => {
- // 触发自定义事件,调用 AccountSidebar 的添加账户流程
- window.dispatchEvent(new CustomEvent('openAddAccountFlow'))
- },
- onCancel: () => {
- // 继续发布
- setPublishDialogOpen(true)
- usePublishDialog
- .getState()
- .setPubTime(
- dayjs(Date.now()).format('YYYY-MM-DD HH:mm:ss'),
- )
- useUserStore.getState().setCurrentDatePickerType()
- },
- })
- } else {
- // 有账户,直接打开发布对话框
- setPublishDialogOpen(true)
- usePublishDialog
- .getState()
- .setPubTime(
- dayjs(Date.now()).format('YYYY-MM-DD HH:mm:ss'),
- )
- useUserStore.getState().setCurrentDatePickerType()
- }
- }}
- >
- {t('newWork')}
- </Button>
- </div>
- </div>
- <div className="calendarTiming-toolbar">
- <div className="calendarTiming-toolbar-left">
- {activeMode === 'calendar' && (
- <>
- <Button
- type="text"
- icon={<LeftOutlined />}
- onClick={handlePrev}
- />
- <Button
- type="text"
- icon={<RightOutlined />}
- onClick={handleNext}
+ {/* 日历工具栏 (Row 2) */}
+ <CalendarToolbar
+ activeMode={activeMode}
+ onModeChange={setActiveMode}
+ currentDate={currentDate}
+ onPrev={handlePrev}
+ onNext={handleNext}
+ onToday={handleToday}
+ />
+
+ {/* 主内容区域 - 日历或列表视图 */}
+ <div className="flex-1 overflow-hidden relative">
+ {activeMode === 'calendar'
+ ? (
+ <CSSTransition
+ in={!animating}
+ timeout={300}
+ classNames={getTransitionClassNames(direction)}
+ unmountOnExit
+ >
+ <div
+ className="calendarTiming-calendar overflow-hidden"
+ id='calendarTiming-calendar'
+ ref={calendarTimingCalendarRef}
+ >
+ <DndProvider backend={HTML5Backend}>
+ <FullCalendar
+ ref={calendarRef}
+ locale={getFullCalendarLang(lng)}
+ plugins={[dayGridPlugin]}
+ initialView="dayGridMonth"
+ initialDate={currentDate}
+ headerToolbar={false}
+ stickyFooterScrollbar={true}
+ dayCellContent={(arg) => {
+ const dateStr = getDays(arg.date).format('YYYY-MM-DD')
+ return (
+ <CalendarTimingItem
+ key={dateStr}
+ records={recordMap.get(dateStr)}
+ loading={listLoading}
+ arg={arg}
+ onClickPub={(date) => {
+ useUserStore.getState().setCurrentDatePickerType(PublishDatePickerType.DATE)
+ publishDialogRef.current!.setPubTime(date)
+ setPublishDialogOpen(true)
+ }}
+ />
+ )
+ }}
+ datesSet={handleDatesSet}
+ />
+ </DndProvider>
+ </div>
+ </CSSTransition>
+ )
+ : (
+ <ListMode
+ onClickPub={(date) => {
+ publishDialogRef.current!.setPubTime(date)
+ setPublishDialogOpen(true)
+ }}
/>
- <h1>
- {currentDate.getFullYear()}
- -
- {currentDate.getMonth() + 1}
- </h1>
- <Button onClick={handleToday}>{t('today')}</Button>
- </>
- )}
- </div>
- <div className="calendarTiming-toolbar-right">
- <Tabs
- activeKey={activeMode}
- onChange={(key) => {
- const mode = key as 'calendar' | 'list'
- if (mode !== activeMode) {
- setActiveMode(mode)
- }
- }}
- items={[
- {
- key: 'calendar',
- label: (
- <span>
- <CalendarOutlined />
- {t('calendarMode')}
- </span>
- ),
- },
- {
- key: 'list',
- label: (
- <span>
- <UnorderedListOutlined />
- {t('listModeTab')}
- </span>
- ),
- },
- ]}
- size="small"
- className={styles.modeTabs}
- />
- {channelFilter}
- </div>
+ )}
</div>
- {activeMode === 'calendar'
- ? (
- <CSSTransition
- in={!animating}
- timeout={300}
- classNames={getTransitionClassNames(direction)}
- unmountOnExit
- >
- <div
- className="calendarTiming-calendar"
- ref={calendarTimingCalendarRef}
- >
- <DndProvider backend={HTML5Backend}>
- <FullCalendar
- ref={calendarRef}
- locale={getFullCalendarLang(lng)}
- plugins={[dayGridPlugin]}
- initialView="dayGridMonth"
- initialDate={currentDate}
- headerToolbar={false}
- stickyFooterScrollbar={true}
- dayCellContent={(arg) => {
- const dateStr = getDays(arg.date).format('YYYY-MM-DD')
- return (
- <CalendarTimingItem
- key={dateStr}
- records={recordMap.get(dateStr)}
- loading={listLoading}
- arg={arg}
- onClickPub={(date) => {
- useUserStore.getState().setCurrentDatePickerType(PublishDatePickerType.DATE)
- publishDialogRef.current!.setPubTime(date)
- setPublishDialogOpen(true)
- }}
- />
- )
- }}
- datesSet={handleDatesSet}
- />
- </DndProvider>
- </div>
- </CSSTransition>
- )
- : (
- <ListMode
- onClickPub={(date) => {
- publishDialogRef.current!.setPubTime(date)
- setPublishDialogOpen(true)
- }}
- />
- )}
</div>
)
},
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/BoxDragPreview.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/BoxDragPreview.tsx
new file mode 100644
index 00000000..2c621882
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/BoxDragPreview.tsx
@@ -0,0 +1,18 @@
+import type { FC } from 'react'
+import type { PublishRecordItem } from '@/api/plat/types/publish.types'
+import { memo } from 'react'
+import RecordCore from './RecordCore'
+
+export interface BoxDragPreviewProps {
+ publishRecord: PublishRecordItem
+}
+
+export const BoxDragPreview: FC<BoxDragPreviewProps> = memo(
+ ({ publishRecord }) => {
+ return (
+ <div className="inline-block -rotate-[7deg] transition-transform duration-300">
+ <RecordCore publishRecord={publishRecord} />
+ </div>
+ )
+ },
+)
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/CalendarRecord.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/CalendarRecord.tsx
similarity index 94%
rename from project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/CalendarRecord.tsx
rename to project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/CalendarRecord.tsx
index 2f2e23da..c21c0909 100644
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/CalendarRecord.tsx
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/CalendarRecord.tsx
@@ -16,9 +16,8 @@ import {
getDays,
getUtcDays,
} from '@/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils'
-import RecordCore from '@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/RecordCore'
import { useCalendarTiming } from '@/app/[lng]/accounts/components/CalendarTiming/useCalendarTiming'
-import styles from './calendarRecord.module.scss'
+import RecordCore from './RecordCore'
export interface ICalendarRecordRef {}
@@ -117,7 +116,6 @@ const CalendarRecord = memo(
drag(node)
}
}}
- className={styles.calendarRecord}
role="DraggableBox"
>
<RecordCore publishRecord={publishRecord} />
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/CustomDragLayer.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/CustomDragLayer.tsx
new file mode 100644
index 00000000..3180eea2
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/CustomDragLayer.tsx
@@ -0,0 +1,94 @@
+import type { CSSProperties, FC } from "react";
+import type { XYCoord } from "react-dnd";
+import type { PublishRecordItem } from "@/api/plat/types/publish.types";
+import { useEffect, useMemo, useState } from "react";
+import { createPortal } from "react-dom";
+import { useDragLayer } from "react-dnd";
+import { BoxDragPreview } from "./BoxDragPreview";
+
+function snapToGrid(x: number, y: number): [number, number] {
+ const snappedX = Math.round(x / 32) * 32;
+ const snappedY = Math.round(y / 32) * 32;
+ return [snappedX, snappedY];
+}
+
+const layerStyles: CSSProperties = {
+ position: "fixed",
+ pointerEvents: "none",
+ zIndex: 1000,
+ left: 0,
+ top: 0,
+ width: "100%",
+ height: "100%",
+};
+
+function getItemStyles(
+ initialOffset: XYCoord | null,
+ currentOffset: XYCoord | null,
+ isSnapToGrid: boolean
+) {
+ if (!initialOffset || !currentOffset) {
+ return {
+ display: "none",
+ };
+ }
+
+ let { x, y } = currentOffset;
+
+ if (isSnapToGrid) {
+ x -= initialOffset.x;
+ y -= initialOffset.y;
+ [x, y] = snapToGrid(x, y);
+ x += initialOffset.x;
+ y += initialOffset.y;
+ }
+
+ const transform = `translate(${x}px, ${y}px)`;
+ return {
+ transform,
+ WebkitTransform: transform,
+ };
+}
+
+export interface CustomDragLayerProps {
+ snapToGrid: boolean;
+ publishRecord: PublishRecordItem;
+}
+
+export const CustomDragLayer: FC<CustomDragLayerProps> = (props) => {
+ const {
+ itemType,
+ isDragging,
+ item,
+ initialOffset,
+ currentOffset,
+ initialMouseOffset,
+ } = useDragLayer((monitor) => ({
+ item: monitor.getItem(),
+ itemType: monitor.getItemType(),
+ initialOffset: monitor.getInitialSourceClientOffset(), // 元素左上角位置
+ currentOffset: monitor.getSourceClientOffset(), // 鼠标当前位置
+ initialMouseOffset: monitor.getInitialClientOffset(), // 鼠标开始拖拽时的位置
+ isDragging: monitor.isDragging(),
+ }));
+
+ // 使用 Portal 将拖拽层渲染到 document.body,避免被父容器限制
+ if (!isDragging) {
+ return null;
+ }
+
+ return createPortal(
+ <div style={layerStyles}>
+ <div
+ style={{
+ ...getItemStyles(initialOffset, currentOffset, props.snapToGrid),
+ position: "relative",
+ zIndex: 10001111,
+ }}
+ >
+ <BoxDragPreview publishRecord={props.publishRecord} />
+ </div>
+ </div>,
+ document.body
+ );
+};
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/RecordCore.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/RecordCore.tsx
new file mode 100644
index 00000000..b4e26af2
--- /dev/null
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/components/RecordCore.tsx
@@ -0,0 +1,532 @@
+import type {
+ ForwardedRef,
+} from 'react'
+import type {
+ PublishRecordItem,
+} from '@/api/plat/types/publish.types'
+import {
+ CheckCircle2,
+ Clock,
+ XCircle,
+ ExternalLink,
+ Eye,
+ Calendar,
+ Maximize2,
+ Heart,
+ MessageCircle,
+ Loader2,
+ MoreVertical,
+ Send,
+ Share2,
+} from 'lucide-react'
+import {
+ forwardRef,
+ memo,
+ useMemo,
+ useState,
+} from 'react'
+import { MediaPreview } from '@/components/common/MediaPreview'
+import { useShallow } from 'zustand/react/shallow'
+import { deletePlatWorkApi, deletePublishRecordApi, nowPubTaskApi } from '@/api/plat/publish'
+import {
+ PublishStatus,
+} from '@/api/plat/types/publish.types'
+import { ClientType } from '@/app/[lng]/accounts/accounts.enums'
+import { getDays } from '@/app/[lng]/accounts/components/CalendarTiming/calendarTiming.utils'
+import { useCalendarTiming } from '@/app/[lng]/accounts/components/CalendarTiming/useCalendarTiming'
+import { AccountPlatInfoMap, PlatType } from '@/app/config/platConfig'
+import { useTransClient } from '@/app/i18n/client'
+import AvatarPlat from '@/components/AvatarPlat'
+import ScrollButtonContainer from '@/components/ScrollButtonContainer'
+import { Badge } from '@/components/ui/badge'
+import { Button } from '@/components/ui/button'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from '@/components/ui/popover'
+import { useAccountStore } from '@/store/account'
+import { cn } from '@/lib/utils'
+import { getOssUrl } from '@/utils/oss'
+
+export interface IRecordCoreRef {}
+
+export interface IRecordCoreProps {
+ publishRecord: PublishRecordItem
+}
+
+function PubStatus({ status }: { status: PublishStatus }) {
+ const { t } = useTransClient('publish')
+
+ return (
+ <div className="inline-flex items-center">
+ {status === PublishStatus.FAIL
+ ? (
+ <Badge variant="destructive" className="gap-1.5">
+ {t('status.publishFailed')}
+ <XCircle className="h-3 w-3" />
+ </Badge>
+ )
+ : status === PublishStatus.PUB_LOADING
+ ? (
+ <Badge variant="secondary" className="gap-1.5 bg-cyan-100 text-cyan-800 border-cyan-200 dark:bg-cyan-900 dark:text-cyan-200 dark:border-cyan-700">
+ {t('status.publishing')}
+ <Loader2 className="h-3 w-3 animate-spin" />
+ </Badge>
+ )
+ : status === PublishStatus.RELEASED
+ ? (
+ <Badge variant="secondary" className="gap-1.5 bg-green-100 text-green-800 border-green-200 dark:bg-green-900 dark:text-green-200 dark:border-green-700">
+ {t('status.publishSuccess')}
+ <CheckCircle2 className="h-3 w-3" />
+ </Badge>
+ )
+ : status === PublishStatus.UNPUBLISH
+ ? (
+ <Badge variant="secondary" className="gap-1.5 bg-blue-100 text-blue-800 border-blue-200 dark:bg-blue-900 dark:text-blue-200 dark:border-blue-700">
+ {t('status.waitingPublish')}
+ <Clock className="h-3 w-3" />
+ </Badge>
+ )
+ : (
+ <></>
+ )}
+ </div>
+ )
+}
+
+const RecordCore = memo(
+ forwardRef(
+ (
+ { publishRecord }: IRecordCoreProps,
+ ref: ForwardedRef<IRecordCoreRef>,
+ ) => {
+ const { calendarCallWidth, setListLoading, getPubRecord } = useCalendarTiming(
+ useShallow(state => ({
+ calendarCallWidth: state.calendarCallWidth,
+ setListLoading: state.setListLoading,
+ getPubRecord: state.getPubRecord,
+ })),
+ )
+ const { accountMap } = useAccountStore(
+ useShallow(state => ({
+ accountMap: state.accountMap,
+ })),
+ )
+ const [popoverOpen, setPopoverOpen] = useState(false)
+ const { t } = useTransClient('publish')
+ const [nowPubLoading, setNowPubLoading] = useState(false)
+ const [mediaPreviewOpen, setMediaPreviewOpen] = useState(false)
+ const [mediaPreviewIndex, setMediaPreviewIndex] = useState(0)
+
+ /**
+ * 删除按钮显示逻辑:
+ * 1. 未发布的、发布失败的,直接显示删除按钮。
+ * 2. 已发布的,除了小红书、抖音、视频号、ins、tiktok之外,其他平台均显示删除按钮。
+ * 注意:Facebook 只有post类型显示删除按钮。
+ */
+ const shouldShowDelete = useMemo(() => {
+ // 规则1:未发布或发布失败的,显示删除按钮
+ if (
+ publishRecord.status === PublishStatus.UNPUBLISH
+ || publishRecord.status === PublishStatus.FAIL
+ ) {
+ return true
+ }
+
+ // 规则2:已发布的,根据平台判断
+ if (publishRecord.status === PublishStatus.RELEASED) {
+ // 不允许删除的平台列表
+ const noDeletablePlats = [
+ PlatType.Xhs, // 小红书
+ PlatType.Douyin, // 抖音
+ PlatType.WxSph, // 视频号
+ PlatType.Instagram, // ins
+ PlatType.Tiktok, // tiktok
+ ]
+
+ // 如果是不允许删除的平台,不显示删除按钮
+ if (noDeletablePlats.includes(publishRecord.accountType)) {
+ return false
+ }
+
+ // Facebook特殊处理:post类型不显示删除按钮
+ if (publishRecord.accountType === PlatType.Facebook) {
+ // 如果是post类型,不显示删除按钮
+ return publishRecord.option?.facebook?.content_category === 'post'
+ }
+
+ // 其他已发布的平台,显示删除按钮
+ return true
+ }
+
+ // 发布中的状态,不显示删除按钮
+ return false
+ }, [publishRecord])
+
+ const days = useMemo(() => {
+ return getDays(publishRecord.publishTime)
+ }, [publishRecord])
+
+ const account = useMemo(() => {
+ return accountMap.get(publishRecord?.accountId ?? '')
+ }, [accountMap, publishRecord.accountId])
+
+ const platIcon = useMemo(() => {
+ return AccountPlatInfoMap.get(
+ publishRecord?.accountType ?? PlatType.Xhs,
+ )?.icon
+ }, [publishRecord])
+
+ /**
+ * 根据 clientType 获取显示的标签文本
+ * @param clientType 客户端类型(web/app)
+ * @returns 标签显示文本
+ */
+ const getClientTypeLabel = (clientType?: ClientType) => {
+ if (!clientType) return null
+ if (clientType === ClientType.WEB) {
+ return t('clientType.web' as any)
+ }
+ if (clientType === ClientType.APP) {
+ return t('clientType.app' as any)
+ }
+ return null
+ }
+
+ const recordInfo = useMemo(() => {
+ return [
+ {
+ label: t('record.metrics.views'),
+ icon: <Eye className="h-4 w-4" />,
+ key: 'viewCount',
+ },
+ {
+ label: t('record.metrics.comments'),
+ icon: <MessageCircle className="h-4 w-4" />,
+ key: 'commentCount',
+ },
+ {
+ label: t('record.metrics.likes'),
+ icon: <Heart className="h-4 w-4" />,
+ key: 'likeCount',
+ },
+ {
+ label: t('record.metrics.shares'),
+ icon: <Share2 className="h-4 w-4" />,
+ key: 'shareCount',
+ },
+ ]
+ }, [t])
+
+ const desc = useMemo(() => {
+ return `${publishRecord.desc} ${publishRecord.topics ? publishRecord.topics?.map(v => `#${v}`).join(' ') : ''}`
+ }, [publishRecord])
+
+ // 构建媒体预览 items
+ const mediaPreviewItems = useMemo(() => {
+ const items: Array<{ type: 'image' | 'video'; src: string }> = []
+
+ // 如果有视频,添加视频
+ if (publishRecord.videoUrl) {
+ items.push({
+ type: 'video',
+ src: getOssUrl(publishRecord.videoUrl),
+ })
+ }
+
+ // 如果有图片列表,添加所有图片
+ if (publishRecord.imgUrlList && publishRecord.imgUrlList.length > 0) {
+ publishRecord.imgUrlList.forEach((imgUrl) => {
+ items.push({
+ type: 'image',
+ src: getOssUrl(imgUrl),
+ })
+ })
+ }
+
+ // 如果只有封面图,也添加封面图
+ if (items.length === 0 && publishRecord.coverUrl) {
+ items.push({
+ type: 'image',
+ src: getOssUrl(publishRecord.coverUrl),
+ })
+ }
+
+ return items
+ }, [publishRecord])
+
+ // 处理封面点击
+ const handleCoverClick = (e: React.MouseEvent) => {
+ e.stopPropagation() // 阻止事件冒泡,防止 Popover 关闭
+ e.preventDefault()
+ if (mediaPreviewItems.length > 0) {
+ setMediaPreviewIndex(0)
+ setMediaPreviewOpen(true)
+ }
+ }
+
+ // 阻止鼠标按下事件冒泡
+ const handleCoverMouseDown = (e: React.MouseEvent) => {
+ e.stopPropagation() // 阻止事件冒泡,防止 Popover 关闭
+ }
+
+ return (
+ <>
+ <Popover open={popoverOpen} onOpenChange={setPopoverOpen}>
+ <PopoverTrigger asChild>
+ <Button
+ variant="outline"
+ className={cn(
+ 'flex justify-between items-center box-border px-1.5 w-full h-auto py-1.5',
+ 'bg-card hover:bg-accent border-border',
+ 'rounded-md transition-colors',
+ 'text-foreground font-normal',
+ 'shadow-none',
+ )}
+ style={{ width: `${calendarCallWidth}px` }}
+ >
+ <div className="flex items-center gap-1.5">
+ <img
+ src={platIcon}
+ className="w-[25px] h-[25px]"
+ alt="platform"
+ />
+ <div className="font-semibold text-sm">{days.format('HH:mm')}</div>
+ </div>
+ {publishRecord.coverUrl && (
+ <div className="flex items-center">
+ <img
+ src={getOssUrl(publishRecord.coverUrl || '')}
+ className="w-6 h-6 rounded object-cover"
+ alt="cover"
+ />
+ </div>
+ )}
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ side="right"
+ className="w-[450px] p-0"
+ align="start"
+ onInteractOutside={(e) => {
+ // MediaPreview 打开时,完全阻止 Popover 关闭
+ if (mediaPreviewOpen) {
+ e.preventDefault()
+ return
+ }
+ // 如果点击的是封面区域,阻止 Popover 关闭
+ const target = e.target as HTMLElement
+ if (target.closest('[data-cover-preview]')) {
+ e.preventDefault()
+ }
+ }}
+ onPointerDownOutside={(e) => {
+ // MediaPreview 打开时,完全阻止 Popover 关闭
+ if (mediaPreviewOpen) {
+ e.preventDefault()
+ return
+ }
+ // 如果点击的是封面区域,阻止 Popover 关闭
+ const target = e.target as HTMLElement
+ if (target.closest('[data-cover-preview]')) {
+ e.preventDefault()
+ }
+ }}
+ >
+ <div className="w-full box-border" onMouseDown={(e) => e.stopPropagation()}>
+ {/* 顶部:时间和全屏按钮 */}
+ <div className="flex justify-between items-center border-b border-border p-3">
+ <div className="font-semibold flex items-center gap-2">
+ {days.format('YYYY-MM-DD HH:mm')}
+ <Calendar className="h-4 w-4" />
+ </div>
+ </div>
+
+ {/* 中间:用户信息和内容 */}
+ <div className="flex justify-between gap-3 border-b border-border p-3">
+ <div className="flex-1 min-h-[150px]">
+ <div className="flex items-center mb-3">
+ <AvatarPlat account={account} size="large" />
+ <span className="ml-2.5 inline-block font-bold">
+ {account?.nickname}
+ </span>
+ {account?.clientType && (
+ <span
+ className={cn(
+ 'inline-block px-1.5 py-0.5 rounded text-[11px] font-medium ml-2',
+ account.clientType === 'web'
+ ? 'bg-blue-50 text-blue-600 border border-blue-200 dark:bg-blue-900 dark:text-blue-200 dark:border-blue-700'
+ : 'bg-green-50 text-green-600 border border-green-200 dark:bg-green-900 dark:text-green-200 dark:border-green-700',
+ )}
+ >
+ {getClientTypeLabel(account.clientType)}
+ </span>
+ )}
+ </div>
+ <div
+ title={desc}
+ className="line-clamp-2 overflow-hidden text-ellipsis mt-2.5 pr-2.5"
+ >
+ {desc}
+ </div>
+ <div className="mt-4">
+ {publishRecord && (
+ <PubStatus status={publishRecord.status} />
+ )}
+ </div>
+ {publishRecord.errorMsg && (
+ <div
+ title={publishRecord.errorMsg}
+ className="mt-1 text-xs text-destructive"
+ >
+ {publishRecord.errorMsg}
+ </div>
+ )}
+ </div>
+ {mediaPreviewItems.length > 0 && (
+ <div className="shrink-0" onClick={(e) => e.stopPropagation()} onMouseDown={(e) => e.stopPropagation()}>
+ <div
+ data-cover-preview
+ onClick={(e) => {
+ e.stopPropagation()
+ e.preventDefault()
+ handleCoverClick(e)
+ }}
+ onMouseDown={(e) => {
+ e.stopPropagation()
+ handleCoverMouseDown(e)
+ }}
+ className="w-[145px] h-[145px] rounded-md overflow-hidden cursor-pointer hover:opacity-90 transition-opacity border border-border"
+ >
+ <img
+ src={getOssUrl(publishRecord.coverUrl || publishRecord.imgUrlList?.[0] || '')}
+ className="w-full h-full object-cover pointer-events-none"
+ alt="cover"
+ />
+ </div>
+ </div>
+ )}
+ </div>
+
+ {/* 信息指标 */}
+ <ScrollButtonContainer>
+ <div className="flex gap-4 p-2.5 border-b border-border">
+ {recordInfo.map(v => (
+ <div key={v.label} className="flex-1">
+ <div className="flex items-center gap-1.5">
+ {v.icon}
+ <span className="text-xs text-muted-foreground">{v.label}</span>
+ </div>
+ {publishRecord.engagement && (
+ <div className="text-base font-semibold mt-1">
+ {publishRecord.engagement[v.key as 'viewCount'] ?? 0}
+ </div>
+ )}
+ </div>
+ ))}
+ </div>
+ </ScrollButtonContainer>
+
+ {/* 底部:操作按钮 */}
+ <div className="flex justify-end gap-2.5 p-3">
+ {publishRecord.workLink && (
+ <Button
+ onClick={() => {
+ window.open(publishRecord.workLink, '_blank')
+ }}
+ >
+ <ExternalLink className="h-4 w-4" />
+ {t('record.viewWork')}
+ </Button>
+ )}
+
+ {publishRecord.status !== PublishStatus.RELEASED
+ && publishRecord.status !== PublishStatus.PUB_LOADING
+ ? (
+ <Button
+ disabled={nowPubLoading}
+ onClick={async () => {
+ setNowPubLoading(true)
+ await nowPubTaskApi(publishRecord.id)
+ getPubRecord()
+ setNowPubLoading(false)
+ }}
+ >
+ {nowPubLoading ? (
+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />
+ ) : (
+ <Send className="mr-2 h-4 w-4" />
+ )}
+ {t('buttons.publishNow')}
+ </Button>
+ )
+ : null}
+
+ {(publishRecord.workLink || shouldShowDelete) && (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="outline" size="icon">
+ <MoreVertical className="h-4 w-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {publishRecord.workLink && (
+ <DropdownMenuItem
+ onClick={async () => {
+ await navigator.clipboard.writeText(
+ publishRecord?.workLink ?? '',
+ )
+ }}
+ >
+ {t('buttons.copyLink')}
+ </DropdownMenuItem>
+ )}
+ {shouldShowDelete && (
+ <DropdownMenuItem
+ className="text-destructive focus:text-destructive"
+ onClick={async () => {
+ setPopoverOpen(false)
+ setListLoading(true)
+ if (publishRecord.status === PublishStatus.RELEASED) {
+ const res = await deletePlatWorkApi(publishRecord.accountId!, publishRecord.dataId)
+ if (!res) {
+ setListLoading(false)
+ return
+ }
+ }
+ await deletePublishRecordApi(publishRecord.id)
+ getPubRecord()
+ }}
+ >
+ {t('buttons.delete')}
+ </DropdownMenuItem>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ </div>
+ </div>
+ </PopoverContent>
+ </Popover>
+
+ {/* 媒体预览 */}
+ <MediaPreview
+ open={mediaPreviewOpen}
+ items={mediaPreviewItems}
+ initialIndex={mediaPreviewIndex}
+ onClose={() => setMediaPreviewOpen(false)}
+ />
+ </>
+ )
+ },
+ ),
+)
+
+export default RecordCore
diff --git a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/index.tsx b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/index.tsx
similarity index 70%
rename from project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/index.tsx
rename to project/web/src/app/[lng]/accounts/components/CalendarTimingItem/index.tsx
index d47ec612..4161e327 100644
--- a/project/web/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/index.tsx
+++ b/project/web/src/app/[lng]/accounts/components/CalendarTimingItem/index.tsx
@@ -1,17 +1,18 @@
import type { DayCellContentArg } from '@fullcalendar/core'
import type { ForwardedRef } from 'react'
import type { PublishRecordItem } from '@/api/plat/types/publish.types'
-import { DownOutlined, PlusOutlined, UpOutlined } from '@ant-design/icons'
-import { Button, Skeleton } from 'antd'
+import { ChevronDown, ChevronUp, Plus } from 'lucide-react'
import dayjs from 'dayjs'
import { forwardRef, memo, useEffect, useMemo, useRef, useState } from 'react'
import { useDrop } from 'react-dnd'
import { useShallow } from 'zustand/react/shallow'
-import CalendarRecord from '@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/CalendarRecord'
-import { CustomDragLayer } from '@/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/components/CustomDragLayer'
import { useCalendarTiming } from '@/app/[lng]/accounts/components/CalendarTiming/useCalendarTiming'
import { useTransClient } from '@/app/i18n/client'
-import styles from './components/calendarTimingItem.module.scss'
+import { Button } from '@/components/ui/button'
+import { Skeleton } from '@/components/ui/skeleton'
+import { cn } from '@/lib/utils'
+import CalendarRecord from './components/CalendarRecord'
+import { CustomDragLayer } from './components/CustomDragLayer'
export interface ICalendarTimingItemRef {}
@@ -103,22 +104,30 @@ const CalendarTimingItem = memo(
}
cellRef.current = node
}}
- className={[
+ className={cn(
'calendarTimingItem--js',
- styles.calendarTimingItem,
- argDate < nowDate ? styles.calendarTimingItemPast : '',
- isOver ? styles.calendarTimingItem_over : '',
- ].join(' ')}
+ 'box-border p-2.5 flex flex-col font-semibold min-h-[200px] h-full group',
+ 'transition-colors',
+ argDate < nowDate && 'bg-muted/30',
+ isOver && 'bg-accent/50',
+ )}
>
- <div className="calendarTimingItem-top">
- <div className="calendarTimingItem-top-day">
+ {/* 顶部:日期和添加按钮 */}
+ <div className="flex justify-between items-center mb-1.5 group/top">
+ <div
+ className={cn(
+ 'w-6 h-6 leading-6 text-center rounded-full text-sm font-semibold',
+ argDate.getTime() === nowDate.getTime() && 'bg-(--primary-color) text-white',
+ )}
+ >
{arg.date.getDate()}
</div>
{argDate >= nowDate && (
<Button
- size="small"
- icon={<PlusOutlined />}
+ size="sm"
+ variant="ghost"
+ className="h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity"
onClick={() => {
const days = dayjs(arg.date)
const today = dayjs()
@@ -130,24 +139,30 @@ const CalendarTimingItem = memo(
onClickPub(days.format())
}
}}
- />
+ >
+ <Plus className="h-3.5 w-3.5" />
+ </Button>
)}
</div>
+
+ {/* 内容区域 */}
{loading
? (
- <>
- <Skeleton.Button active={true} block={true} size="small" />
- </>
+ <div className="flex flex-col gap-2">
+ <Skeleton className="h-[34px] w-full rounded-md" />
+ </div>
)
: (
- <div className="calendarTimingItem-con">
+ <div className="flex flex-col gap-2">
+ {/* 预约时间按钮 */}
{argDate >= nowDate
&& reservationsTimesLast.map((v, i) => {
return (
<Button
key={i}
- size="small"
- type="dashed"
+ size="sm"
+ variant="outline"
+ className="w-full h-[34px] text-xs group/btn relative overflow-hidden"
onClick={() => {
const days = dayjs(arg.date)
.set('hour', v[0])
@@ -155,19 +170,17 @@ const CalendarTimingItem = memo(
onClickPub(days.format())
}}
>
- <div className="calendarTimingItem-con-btn1">
- {v[0]}
- :
- {v[1]}
- {' '}
- PM
- </div>
- <div className="calendarTimingItem-con-btn2">
+ <span className="group-hover/btn:opacity-0 transition-opacity">
+ {v[0]}:{v[1]} PM
+ </span>
+ <span className="absolute inset-0 flex items-center justify-center opacity-0 group-hover/btn:opacity-100 transition-opacity">
{t('addPost')}
- </div>
+ </span>
</Button>
)
})}
+
+ {/* 发布记录 */}
{records
&& recordsLast.map((v) => {
return (
@@ -178,16 +191,11 @@ const CalendarTimingItem = memo(
)
})}
+ {/* 显示更多/收起按钮 */}
{records && records.length > 3 - reservationsTimesLast.length && (
<Button
- type="text"
- style={{
- height: 'auto',
- width: 'auto',
- padding: '3px 10px',
- fontSize: 'var(--fs-sm)',
- marginBottom: '0',
- }}
+ variant="ghost"
+ className="w-full h-auto py-2 px-3 text-sm text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors justify-start"
onClick={() => {
setIsMore(!isMore)
}}
@@ -195,13 +203,13 @@ const CalendarTimingItem = memo(
{isMore
? (
<>
- <UpOutlined style={{ marginRight: '8px' }} />
+ <ChevronUp className="mr-2 h-4 w-4" />
{t('calendar.hideMore')}
</>
)
: (
<>
- <DownOutlined style={{ marginRight: '8px' }} />
+ <ChevronDown className="mr-2 h-4 w-4" />
{records.length - recordsLast?.length}
{' '}
{t('calendar.showMore')}
diff --git a/project/web/src/app/[lng]/accounts/components/ProxyInput/index.tsx b/project/web/src/app/[lng]/accounts/components/ProxyInput/index.tsx
deleted file mode 100644
index a88f0def..00000000
--- a/project/web/src/app/[lng]/accounts/components/ProxyInput/index.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-import type { ForwardedRef } from 'react'
-import { Button, Input } from 'antd'
-import { toast } from '@/lib/toast'
-import { forwardRef, memo, useEffect, useState } from 'react'
-import { useTransClient } from '@/app/i18n/client'
-import styles from './proxyInput.module.scss'
-
-export interface IProxyInputRef {}
-
-export interface IProxyInputProps {
- onChange: (name: string) => void
-}
-
-export interface ProxyInfo {
- // 协议: 如 http, socks5
- protocol: string
- // IP+端口: 如 192.168.0.1:8000
- ipAndPort: string
- // 代理账号: 可选
- username?: string
- // 代理密码: 可选
- password?: string
- // 刷新URL: 可选
- refreshUrl?: string
- // 备注: 可选
- remark?: string
-}
-
-export function parseProxyString(proxyString: string): ProxyInfo | false {
- const regex
- = /^(?:(\w+):\/\/)?([\d.]+:\d+)(?::([^:]+):([^{}\s[\]]+))?(?:\[([^\]]+)\])?(?:\{([^}]+)\})?$/
-
- const match = proxyString.match(regex)
- if (!match) {
- return false // 无法解析则返回 false
- }
-
- const [, protocol, ipAndPort, username, password, refreshUrl, remark] = match
-
- return {
- protocol: protocol || 'http', // 如果未提供协议,默认为 http
- ipAndPort,
- username,
- password,
- refreshUrl,
- remark,
- }
-}
-
-// 验证代理地址
-export async function verifyProxy(proxyName: string) {
- const proxyInfo = parseProxyString(proxyName)
- if (proxyInfo === false)
- return false
- return true
-}
-
-const ProxyInput = memo(
- forwardRef(
- ({ onChange }: IProxyInputProps, ref: ForwardedRef<IProxyInputRef>) => {
- const { t } = useTransClient('account')
- const [proxyLoading, setProxyLoading] = useState(false)
- const [proxyName, setProxyName] = useState('')
-
- useEffect(() => {
- onChange(proxyName)
- }, [onChange, proxyName])
-
- return (
- <>
- <div
- className={`${styles.createGroup} ${styles.proxyInput}`}
- style={{ marginBottom: '20px' }}
- >
- <label>{t('proxy.label')}</label>
- <Input
- value={proxyName}
- placeholder={t('proxy.placeholder')}
- onChange={e => setProxyName(e.target.value)}
- />
- <Button
- disabled={proxyName.length === 0}
- loading={proxyLoading}
- onClick={async () => {
- const verifyRes = await verifyProxy(proxyName)
- if (verifyRes) {
- toast.success(t('proxy.available'))
- }
- else {
- toast.error(t('proxy.unavailable'))
- }
- }}
- >
- {t('proxy.verify')}
- </Button>
- </div>
- <div className={styles.proxyHint}>
- <p>{t('proxy.hint.line1')}</p>
- <p>{t('proxy.hint.line2')}</p>
- <p>
- 192.168.0.1:8000
- {`{${t('proxy.hint.remark')}}`}
- </p>
- <p>
- 192.168.0.1:8000:{t('proxy.hint.username')}:{t('proxy.hint.password')}
- {`{${t('proxy.hint.remark')}}`}
- </p>
- <p>
- socks5://192.168.0.1:8000:{t('proxy.hint.username')}:{t('proxy.hint.password')}
- {`{${t('proxy.hint.remark')}}`}
- </p>
- </div>
- </>
- )
- },
- ),
-)
-
-export default ProxyInput
diff --git a/project/web/src/app/[lng]/accounts/components/ProxyInput/proxyInput.module.scss b/project/web/src/app/[lng]/accounts/components/ProxyInput/proxyInput.module.scss
deleted file mode 100644
index ba63ce34..00000000
--- a/project/web/src/app/[lng]/accounts/components/ProxyInput/proxyInput.module.scss
+++ /dev/null
@@ -1,27 +0,0 @@
-.proxyInput {
- input {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
- }
- button {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- border-left: none;
- }
-}
-
-.proxyHint {
- margin: 20px 0 30px 0;
- font-size: var(--fs-sm);
- color: var(--grayColor8);
-}
-
-.createGroup {
- display: flex;
- align-items: center;
- margin: 30px 0 50px 0;
- label {
- white-space: nowrap;
- margin-right: 10px;
- }
-}
diff --git a/project/web/src/app/[lng]/interactive/interactive.module.css b/project/web/src/app/[lng]/interactive/interactive.module.css
deleted file mode 100644
index 020f815e..00000000
--- a/project/web/src/app/[lng]/interactive/interactive.module.css
+++ /dev/null
@@ -1,583 +0,0 @@
-.container {
- min-height: 0;
- height: 100%;
-}
-
-/* 页面头部样式 */
-.header {
- margin-bottom: 24px;
-}
-
-.headerContent {
- display: flex;
- justify-content: space-between;
- align-items: center;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- border-radius: 16px;
- padding: 24px;
- color: white;
- box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
- position: relative;
- overflow: hidden;
-}
-
-.headerContent::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
- animation: shimmer 3s ease-in-out infinite;
-}
-
-@keyframes shimmer {
- 0%,
- 100% {
- transform: translateX(-100%);
- }
- 50% {
- transform: translateX(100%);
- }
-}
-
-.headerLeft {
- display: flex;
- align-items: center;
- gap: 16px;
- position: relative;
- z-index: 1;
-}
-
-.headerIcon {
- width: 64px;
- height: 64px;
- background: rgba(255, 255, 255, 0.2);
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 28px;
- backdrop-filter: blur(10px);
- border: 2px solid rgba(255, 255, 255, 0.3);
-}
-
-.headerText {
- flex: 1;
-}
-
-.headerTitle {
- font-size: 28px;
- font-weight: 700;
- margin: 0 0 8px 0;
- background: linear-gradient(135deg, #ffffff, #f0f0f0);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
-}
-
-.headerSubtitle {
- font-size: 16px;
- margin: 0;
- color: rgba(255, 255, 255, 0.9);
- font-weight: 400;
-}
-
-.headerRight {
- position: relative;
- z-index: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 8px;
-}
-
-.balanceCard {
- background: rgba(255, 255, 255, 0.15);
- border-radius: 12px;
- padding: 20px;
- backdrop-filter: blur(10px);
- border: 1px solid rgba(255, 255, 255, 0.2);
- display: flex;
- align-items: center;
- gap: 12px;
- min-width: 200px;
-}
-
-.walletLink {
- display: inline-flex;
- align-items: center;
- padding: 6px 8px;
- color: #ffffff;
- opacity: 0.9;
- cursor: pointer;
- border-radius: 8px;
- transition: all 0.2s ease;
-}
-
-.walletLink:hover {
- background: rgba(255, 255, 255, 0.18);
- opacity: 1;
-}
-
-.balanceIcon {
- width: 48px;
- height: 48px;
- background: rgba(255, 255, 255, 0.2);
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 20px;
- color: #fff;
-}
-
-.balanceInfo {
- flex: 1;
-}
-
-.balanceLabel {
- font-size: 14px;
- color: rgba(255, 255, 255, 0.8);
- margin-bottom: 4px;
-}
-
-.balanceAmount {
- font-size: 24px;
- font-weight: 700;
- color: #fff;
- text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
-}
-
-/* 主要内容样式 */
-.content {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 16px;
- padding: 24px;
- min-height: 80vh;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
- backdrop-filter: blur(10px);
- border: 1px solid rgba(255, 255, 255, 0.2);
-}
-
-/* 标签页样式 */
-.content .ant-tabs > .ant-tabs-nav {
- margin-bottom: 24px;
- background: rgba(255, 255, 255, 0.5);
- border-radius: 12px;
- padding: 4px;
- backdrop-filter: blur(10px);
-}
-
-.content .ant-tabs > .ant-tabs-nav .ant-tabs-tab {
- padding: 12px 24px;
- font-size: 16px;
- font-weight: 600;
- border-radius: 8px;
- transition: all 0.3s ease;
- margin: 0 4px;
-}
-
-.content .ant-tabs > .ant-tabs-nav .ant-tabs-tab-active {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: white;
- box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
-}
-
-.content .ant-tabs > .ant-tabs-nav .ant-tabs-tab:hover {
- background: rgba(102, 126, 234, 0.1);
- color: #667eea;
-}
-
-.content .ant-tabs > .ant-tabs-nav .ant-tabs-tab-active:hover {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: white;
-}
-
-/* 卡片样式 */
-.content .ant-card {
- border-radius: 12px;
- box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
- border: 1px solid rgba(0, 0, 0, 0.06);
- overflow: hidden;
-}
-
-.content .ant-card-head {
- background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
- border-bottom: 1px solid rgba(0, 0, 0, 0.06);
-}
-
-.content .ant-card-head-title {
- font-size: 18px;
- font-weight: 600;
- color: #495057;
-}
-
-/* 表格样式 */
-.content .ant-table-thead > tr > th {
- background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
- color: #495057;
- font-weight: 600;
- font-size: 14px;
- padding: 16px 12px;
- border-bottom: 2px solid #dee2e6;
-}
-
-.content .ant-table-tbody > tr:hover > td {
- background-color: rgba(102, 126, 234, 0.05);
-}
-
-.content .ant-table-tbody > tr > td {
- padding: 12px;
- font-size: 14px;
- border-bottom: 1px solid #f0f0f0;
-}
-
-.content .ant-table-tbody > tr:last-child > td {
- border-bottom: none;
-}
-
-/* 按钮样式 */
-.content .ant-btn {
- border-radius: 8px;
- font-weight: 500;
- transition: all 0.3s ease;
- border: none;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
-}
-
-.content .ant-btn-primary {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: white;
-}
-
-.content .ant-btn-primary:hover {
- background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
- transform: translateY(-2px);
- box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
-}
-
-.content .ant-btn-primary:disabled {
- background: #d9d9d9;
- color: rgba(0, 0, 0, 0.25);
- transform: none;
- box-shadow: none;
-}
-
-.content .ant-btn-default {
- background: white;
- color: #495057;
- border: 1px solid #d9d9d9;
-}
-
-.content .ant-btn-default:hover {
- background: #f8f9fa;
- border-color: #667eea;
- color: #667eea;
- transform: translateY(-1px);
-}
-
-/* 标签样式 */
-.content .ant-tag {
- border-radius: 6px;
- font-size: 12px;
- padding: 4px 8px;
- font-weight: 500;
- border: none;
-}
-
-/* 分页样式 */
-.content .ant-pagination {
- margin-top: 24px;
- text-align: center;
-}
-
-.content .ant-pagination .ant-pagination-item {
- border-radius: 8px;
- border: 1px solid #d9d9d9;
-}
-
-.content .ant-pagination .ant-pagination-item-active {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- border-color: #667eea;
-}
-
-.content .ant-pagination .ant-pagination-item-active a {
- color: white;
-}
-
-.content .ant-pagination .ant-pagination-prev,
-.content .ant-pagination .ant-pagination-next {
- border-radius: 8px;
- border: 1px solid #d9d9d9;
-}
-
-/* 提现弹窗样式 */
-.withdrawModalContent {
- padding: 20px 0;
-}
-
-.withdrawInfo {
- background: #f8f9fa;
- border-radius: 12px;
- padding: 20px;
- margin-bottom: 20px;
- border: 1px solid #e9ecef;
-}
-
-.withdrawItem {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12px;
- padding: 8px 0;
- border-bottom: 1px solid #e9ecef;
-}
-
-.withdrawItem:last-child {
- margin-bottom: 0;
- border-bottom: none;
-}
-
-.withdrawLabel {
- font-weight: 600;
- color: #495057;
- font-size: 14px;
-}
-
-.withdrawValue {
- color: #6c757d;
- font-size: 14px;
- word-break: break-all;
- max-width: 200px;
- text-align: right;
-}
-
-.withdrawAmount {
- color: #28a745;
- font-weight: 700;
- font-size: 16px;
-}
-
-.withdrawWarning {
- background: #fff3cd;
- border: 1px solid #ffeaa7;
- border-radius: 8px;
- padding: 16px;
- color: #856404;
-}
-
-.withdrawWarning p {
- margin: 0 0 8px 0;
- font-size: 14px;
- line-height: 1.5;
-}
-
-.withdrawWarning p:last-child {
- margin-bottom: 0;
-}
-
-/* 移动端适配 */
-@media (max-width: 768px) {
- .container {
- padding: 12px;
- }
-
- .headerContent {
- flex-direction: column;
- gap: 20px;
- padding: 20px;
- text-align: center;
- }
-
- .headerLeft {
- flex-direction: column;
- gap: 12px;
- }
-
- .headerIcon {
- width: 48px;
- height: 48px;
- font-size: 20px;
- }
-
- .headerTitle {
- font-size: 24px;
- }
-
- .headerSubtitle {
- font-size: 14px;
- }
-
- .balanceCard {
- min-width: auto;
- width: 100%;
- justify-content: center;
- }
-
- .balanceAmount {
- font-size: 20px;
- }
-
- .content {
- padding: 16px;
- }
-
- .content .ant-tabs > .ant-tabs-nav .ant-tabs-tab {
- padding: 8px 16px;
- font-size: 14px;
- }
-
- .content .ant-table-thead > tr > th,
- .content .ant-table-tbody > tr > td {
- padding: 8px 6px;
- font-size: 12px;
- }
-
- .content .ant-btn {
- font-size: 12px;
- padding: 4px 8px;
- }
-
- .withdrawItem {
- flex-direction: column;
- align-items: flex-start;
- gap: 4px;
- }
-
- .withdrawValue {
- max-width: none;
- text-align: left;
- }
-}
-
-@media (max-width: 480px) {
- .headerContent {
- padding: 16px;
- }
-
- .headerTitle {
- font-size: 20px;
- }
-
- .balanceCard {
- padding: 16px;
- }
-
- .content {
- padding: 12px;
- }
-
- .content .ant-tabs > .ant-tabs-nav .ant-tabs-tab {
- padding: 6px 12px;
- font-size: 12px;
- }
-}
-
-/* 互动卡片瀑布流 */
-.grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
- gap: 18px;
-}
-
-.postCard {
- background: #fff;
- border: 1px solid #e9ecef;
- border-radius: 8px;
- overflow: hidden;
- display: flex;
- flex-direction: column;
-}
-
-.thumb {
- position: relative;
- width: 100%;
- padding-top: 75%;
- background: #fafafa;
-}
-.thumb img {
- position: absolute;
- inset: 0;
- width: 100%;
- height: 100%;
- object-fit: cover;
-}
-.playIcon {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 56px;
- height: 56px;
- border-radius: 50%;
- background: rgba(0, 0, 0, 0.25);
-}
-.thumbPlaceholder {
- position: absolute;
- inset: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #999;
-}
-.mediaType {
- position: absolute;
- left: 8px;
- bottom: 8px;
-}
-.postMeta {
- padding: 12px;
-}
-.postFooter {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-top: 8px;
-}
-.postTitle {
- font-size: 14px;
- font-weight: 600;
- color: #111;
- line-height: 1.4;
- max-height: 3.2em;
- overflow: hidden;
-}
-.postContent {
- margin-top: 6px;
- font-size: 12px;
- color: #4b5563;
- line-height: 1.6;
- max-height: 4.8em;
- overflow: hidden;
-}
-.statsRow {
- display: flex;
- gap: 12px;
- color: #666;
- font-size: 12px;
-}
-
-/* 评论弹窗布局修正 */
-.replyBlock {
- margin-top: 8px;
- margin-left: 36px; /* 与头像宽度一致的缩进,避免错位 */
-}
-
-/* 评论按钮样式(图标按钮) */
-.commentBtn {
- width: 44px;
- height: 44px;
- border-radius: 8px;
- border: 1px solid #e5e7eb;
- display: inline-flex;
- align-items: center;
- justify-content: center;
-}
-.commentBtn:hover {
- border-color: #d1d5db;
-}
diff --git a/project/web/src/app/[lng]/interactive/page.tsx b/project/web/src/app/[lng]/interactive/page.tsx
deleted file mode 100644
index 2d70fef9..00000000
--- a/project/web/src/app/[lng]/interactive/page.tsx
+++ /dev/null
@@ -1,844 +0,0 @@
-/**
- * InteractivePage - 互动管理页面
- * 帖子评论、AI 回复、互动管理功能
- */
-
-'use client'
-
-import type { EngagementPlatform, EngagementPostItem } from '@/api/types/engagement'
-import { CommentOutlined, DollarOutlined, EyeOutlined, HistoryOutlined, LikeOutlined, PlayCircleOutlined, RobotOutlined, WalletOutlined } from '@ant-design/icons'
-import { Avatar, Button, Card, Input, List, Select, Space, Tag } from 'antd'
-import { toast } from '@/lib/toast'
-import { Modal } from '@/components/ui/modal'
-import { useParams, useRouter } from 'next/navigation'
-import { useEffect, useRef, useState } from 'react'
-import { useShallow } from 'zustand/react/shallow'
-import { createAiReplyTask, getChatModels } from '@/api/ai'
-import { apiGetCommentReplies, apiGetEngagementComments, apiGetEngagementnew, apiGetEngagementPosts, apiGetPostComments, apiPublishCommentReply, apiPublishPostComment, apiReplyEngagementComment } from '@/api/engagement'
-import AccountSidebar from '@/app/[lng]/accounts/components/AccountSidebar/AccountSidebar'
-import { useTransClient } from '@/app/i18n/client'
-import WalletAccountSelect from '@/components/WalletAccountSelect'
-import { useAccountStore } from '@/store/account'
-import { useUserStore } from '@/store/user'
-import { request } from '@/utils/request'
-import styles from './interactive.module.css'
-// import { NoSSR } from "@kwooshung/react-no-ssr";
-
-const { Option } = Select
-
-export default function InteractivePage() {
- const router = useRouter()
- const { lng } = useParams()
- const { userInfo, token } = useUserStore()
- const { t } = useTransClient('interactive' as any)
-
- // 账户侧边栏相关
- const { accountInit, accountActive, setAccountActive } = useAccountStore(
- useShallow(state => ({
- accountInit: state.accountInit,
- accountActive: state.accountActive,
- setAccountActive: state.setAccountActive,
- })),
- )
-
- // 互动帖子列表状态
- const [posts, setPosts] = useState<EngagementPostItem[]>([])
- const [loading, setLoading] = useState(false)
- const [pagination, setPagination] = useState({ current: 1, pageSize: 20, total: 0 })
- const [hasMore, setHasMore] = useState(true)
- const [platform, setPlatform] = useState<EngagementPlatform | undefined>(undefined)
- const loadMoreRef = useRef<HTMLDivElement | null>(null)
- const [postsCursor, setPostsCursor] = useState<{ before?: string, after?: string }>({})
- const prevAccountIdRef = useRef<string | undefined>()
- // 评论状态
- const [commentVisible, setCommentVisible] = useState(false)
- const [commentLoading, setCommentLoading] = useState(false)
- const [commentPost, setCommentPost] = useState<EngagementPostItem | null>(null)
- const [comments, setComments] = useState<any[]>([])
- const [commentsCursor, setCommentsCursor] = useState<{ before?: string, after?: string } | undefined>()
- const [commentsTotal, setCommentsTotal] = useState<number | undefined>(undefined)
- const [replyText, setReplyText] = useState('')
- const [replyTarget, setReplyTarget] = useState<any>(null)
- const [sending, setSending] = useState(false)
- const replyInputRef = useRef<any>(null)
- // 二级回复:按评论ID存储
- const [repliesByComment, setRepliesByComment] = useState<Record<string, { list: any[], cursor?: { before?: string, after?: string }, loading: boolean, expanded: boolean }>>({})
-
- // AI回复相关状态
- const [aiModalVisible, setAiModalVisible] = useState(false)
- const [aiPrompt, setAiPrompt] = useState('')
- const [aiModel, setAiModel] = useState('')
- const [aiModels, setAiModels] = useState<any[]>([])
- const [aiLoading, setAiLoading] = useState(false)
- const [aiReplyTarget, setAiReplyTarget] = useState<{ postId: string, commentId?: string } | null>(null)
- const [aiSuggestLoading, setAiSuggestLoading] = useState(false)
-
- // 获取AI模型列表
- const fetchAiModels = async () => {
- try {
- const res = await getChatModels()
- if (res?.data && Array.isArray(res.data)) {
- setAiModels(res.data)
- if (res.data.length > 0 && !aiModel) {
- setAiModel(res.data[0].name)
- }
- }
- }
- catch (error) {
- console.error('获取AI模型列表失败:', error)
- }
- }
-
- // 获取互动帖子
- const fetchEngagementPosts = async (direction?: 'next' | 'prev', customCursor?: string) => {
- if (!accountActive?.uid || !platform)
- return
- setLoading(true)
- try {
- const params: any = {
- platform,
- accountId: accountActive.id,
-
- }
-
- // 根据方向添加 cursor 参数
- if (direction === 'next' && customCursor) {
- params.pagination.after = customCursor
- }
- else if (direction === 'prev' && postsCursor.before) {
- params.pagination.before = postsCursor.before
- }
-
- const res = await apiGetEngagementnew(params)
- if (res?.data) {
- const list = res.data.posts || []
- // 首次加载或切换方向时替换,加载更多时追加
- if (direction === 'next') {
- setPosts(prev => [...prev, ...list])
- }
- else if (direction === 'prev') {
- setPosts(prev => [...list, ...prev])
- }
- else {
- setPosts(list)
- }
-
- // 更新 cursor
- if (res.data.cursor) {
- setPostsCursor(res.data.cursor)
- // 判断是否还有更多内容
- setHasMore(!!res.data.cursor.after)
- }
- else {
- setHasMore(false)
- }
- }
- }
- finally {
- setLoading(false)
- }
- }
-
- // 当切换账户或平台时加载数据
- useEffect(() => {
- // 如果没有选中账户,清空数据
- if (!accountActive) {
- setPlatform(undefined)
- setPosts([])
- setPostsCursor({})
- setPagination(prev => ({ ...prev, total: 0, current: 1 }))
- setHasMore(false)
- prevAccountIdRef.current = undefined
- return
- }
-
- const currentAccountId = accountActive.id
- const accountChanged = prevAccountIdRef.current !== currentAccountId
-
- // 如果账户切换了,需要设置新的platform
- if (accountChanged) {
- prevAccountIdRef.current = currentAccountId
-
- const type = String((accountActive as any).type || '').toLowerCase()
- const map: Record<string, EngagementPlatform> = {
- bilibili: 'bilibili',
- douyin: 'douyin',
- facebook: 'facebook',
- wxgzh: 'wxGzh',
- wxsph: 'wxGzh',
- instagram: 'instagram',
- kwai: 'KWAI',
- kuaishou: 'KWAI',
- pinterest: 'pinterest',
- threads: 'threads',
- tiktok: 'tiktok',
- twitter: 'twitter',
- xhs: 'xhs',
- redbook: 'xhs',
- youtube: 'youtube',
- }
- const mapped = map[type]
-
- // 重置数据
- setPosts([])
- setPostsCursor({})
- setPagination(prev => ({ ...prev, total: 0, current: 1 }))
-
- // 设置platform(会触发下面的加载逻辑)
- if (mapped) {
- setHasMore(true)
- setPlatform(mapped)
- }
- else {
- setHasMore(false)
- setPlatform(undefined)
- }
- return // 等platform更新后再加载数据
- }
-
- // 如果账户没变,但platform或uid变了,重新加载数据
- if (accountActive?.uid && platform) {
- setPosts([])
- setPostsCursor({})
- setHasMore(true)
- fetchEngagementPosts()
- }
- }, [accountActive?.id, accountActive?.uid, platform])
-
- const PostCard = ({ item }: { item: EngagementPostItem }) => {
- const [currentMediaIndex, setCurrentMediaIndex] = useState(0)
- const medias = (item as any).medias || []
- const currentMedia = medias[currentMediaIndex]
-
- // 处理媒体点击
- const handleMediaClick = (e: React.MouseEvent) => {
- if (medias.length > 1) {
- e.preventDefault()
- setCurrentMediaIndex(prev => (prev + 1) % medias.length)
- }
- }
-
- // 显示视频预览模态框
- const [videoModalVisible, setVideoModalVisible] = useState(false)
- const [videoUrl, setVideoUrl] = useState('')
-
- const handleVideoPlay = (e: React.MouseEvent) => {
- e.preventDefault()
- if (currentMedia?.type === 'video' && currentMedia?.url) {
- setVideoUrl(currentMedia.url)
- setVideoModalVisible(true)
- }
- }
-
- return (
- <>
- <div className={styles.postCard}>
- <div className={styles.thumb} onClick={handleMediaClick} style={{ cursor: medias.length > 1 ? 'pointer' : 'default' }}>
- {currentMedia?.thumbnail || currentMedia?.url
- ? (
- <>
- <img src={currentMedia.thumbnail || currentMedia.url} alt={item.title} />
- {currentMedia.type === 'video' && (
- <span className={styles.playIcon} onClick={handleVideoPlay}>
- <PlayCircleOutlined style={{ fontSize: 40, color: 'rgba(255,255,255,0.95)' }} />
- </span>
- )}
- </>
- )
- : (
- <div className={styles.thumbPlaceholder}>{t('ui.noImage')}</div>
- )}
- {medias.length > 0 && (
- <span className={styles.mediaType}>
- <Tag color={currentMedia?.type === 'video' ? 'blue' : currentMedia?.type === 'image' ? 'green' : 'purple'}>
- {currentMedia?.type || 'unknown'}
- {medias.length > 1 && ` (${currentMediaIndex + 1}/${medias.length})`}
- </Tag>
- </span>
- )}
- </div>
- <div className={styles.postMeta}>
- <div className={styles.postTitle} title={item.title}>{item.title || '-'}</div>
- {item.content && (
- <div className={styles.postContent} title={item.content}>
- {item.content}
- </div>
- )}
- <div className={styles.postFooter}>
- <div className={styles.statsRow}>
- <span>
- <LikeOutlined style={{ marginRight: 6 }} />
- {item.likeCount}
- </span>
- <span>
- <CommentOutlined style={{ marginRight: 6 }} />
- {item.commentCount}
- </span>
- <span>
- <EyeOutlined style={{ marginRight: 6 }} />
- {item.viewCount}
- </span>
- </div>
- <Space size={8}>
- <Button className={styles.commentBtn} type="text" onClick={() => openAiModal(item.id)}>
- <RobotOutlined style={{ fontSize: 18 }} />
- </Button>
- <Button className={styles.commentBtn} type="text" onClick={() => openComments(item)}>
- <CommentOutlined style={{ fontSize: 20 }} />
- </Button>
- </Space>
- </div>
- </div>
- </div>
-
- {/* 视频播放模态框 */}
- <Modal
- title={t('ui.videoPreview' as any)}
- open={videoModalVisible}
- onCancel={() => setVideoModalVisible(false)}
- footer={null}
- width={800}
- centered
- >
- {videoUrl && (
- <video
- src={videoUrl}
- controls
- autoPlay
- style={{ width: '100%', maxHeight: '70vh' }}
- />
- )}
- </Modal>
- </>
- )
- }
-
- const openComments = async (item: EngagementPostItem) => {
- setCommentPost(item)
- setComments([])
- setCommentVisible(true)
- setReplyTarget(null)
- await loadCommentsV2(item.id, undefined, undefined)
- }
-
- const loadCommentsV2 = async (postId: string, before?: string, after?: string) => {
- if (!accountActive?.id || !platform)
- return
- setCommentLoading(true)
- try {
- const res = await apiGetPostComments({
- accountId: accountActive.id,
- platform: platform as any,
- postId,
- pagination: { before, after, limit: 20 },
- })
- if (res?.data) {
- const list = res.data.comments || []
- setComments(prev => after || before ? [...prev, ...list] : list)
- setCommentsTotal(res.data.total)
- setCommentsCursor(res.data.cursor)
- }
- }
- finally {
- setCommentLoading(false)
- }
- }
-
- const expandReplies = async (commentId: string) => {
- if (!accountActive?.id || !platform)
- return
- setRepliesByComment(prev => ({
- ...prev,
- [commentId]: { ...(prev[commentId] || { list: [], cursor: {}, expanded: true }), loading: true, expanded: true },
- }))
- const res = await apiGetCommentReplies({
- accountId: accountActive.id,
- platform: platform as any,
- commentId,
- pagination: { limit: 20 },
- })
- setRepliesByComment(prev => ({
- ...prev,
- [commentId]: {
- list: res?.data?.comments || [],
- cursor: res?.data?.cursor,
- loading: false,
- expanded: true,
- },
- }))
- }
-
- const collapseReplies = (commentId: string) => {
- setRepliesByComment(prev => ({
- ...prev,
- [commentId]: { ...(prev[commentId] || { list: [], cursor: {} }), expanded: false, loading: false },
- }))
- }
-
- const loadMoreReplies = async (commentId: string) => {
- const state = repliesByComment[commentId]
- if (!state?.cursor?.after || !accountActive?.id || !platform)
- return
- setRepliesByComment(prev => ({ ...prev, [commentId]: { ...(prev[commentId] as any), loading: true } }))
- const res = await apiGetCommentReplies({
- accountId: accountActive.id,
- platform: platform as any,
- commentId,
- pagination: { after: state.cursor.after, limit: 20 },
- })
- setRepliesByComment(prev => ({
- ...prev,
- [commentId]: {
- list: [...(prev[commentId]?.list || []), ...(res?.data?.comments || [])],
- cursor: res?.data?.cursor,
- loading: false,
- expanded: true,
- },
- }))
- }
-
- /**
- * 提交帖子评论
- */
- const submitPostComment = async () => {
- if (!commentPost || !replyText.trim() || !accountActive?.id || !platform || sending)
- return
- setSending(true)
- try {
- const res = await apiPublishPostComment({ accountId: accountActive.id, platform: platform as any, postId: commentPost.id, message: replyText.trim() })
- if (res) {
- setReplyText('')
- setReplyTarget(null)
- await loadCommentsV2(commentPost.id)
- toast.success(t('messages.commentSuccess'))
- }
- }
- catch (error) {
- toast.error(t('messages.commentFailed'))
- }
- finally {
- setSending(false)
- }
- }
-
- /**
- * 提交评论回复
- */
- const submitReply = async (parentId?: string) => {
- if (!commentPost || !replyText.trim() || !accountActive?.id || !platform || sending)
- return
- setSending(true)
- try {
- const res = await apiPublishCommentReply({ accountId: accountActive.id, platform: platform as any, commentId: parentId || '', message: replyText.trim() })
- if (res) {
- setReplyText('')
- setReplyTarget(null)
- await loadCommentsV2(commentPost.id)
- toast.success(t('messages.replySuccess'))
- }
- }
- catch (error) {
- toast.error(t('messages.replyFailed'))
- }
- finally {
- setSending(false)
- }
- }
-
- /**
- * 打开AI回复弹窗
- */
- const openAiModal = (postId: string, commentId?: string) => {
- setAiReplyTarget({ postId, commentId })
- setAiModalVisible(true)
- setAiPrompt('')
- if (aiModels.length === 0) {
- fetchAiModels()
- }
- }
-
- /**
- * 提交AI回复
- */
- const submitAiReply = async () => {
- if (!aiReplyTarget || !aiPrompt.trim() || !aiModel || !accountActive?.id || !platform || aiLoading)
- return
- setAiLoading(true)
- try {
- const res = await createAiReplyTask({
- accountId: accountActive.id,
- postId: aiReplyTarget.postId,
- prompt: aiPrompt.trim(),
- platform: platform as string,
- model: aiModel,
- })
- if (res) {
- setAiModalVisible(false)
- setAiPrompt('')
- setAiReplyTarget(null)
- toast.success(t('messages.aiReplyTaskCreated'))
- // 刷新评论列表
- if (commentPost) {
- await loadCommentsV2(commentPost.id)
- }
- }
- }
- catch (error) {
- toast.error(t('messages.aiReplyTaskFailed'))
- }
- finally {
- setAiLoading(false)
- }
- }
-
- // 获取AI评论建议,并填充到输入框
- const fetchAiSuggestion = async () => {
- if (!replyTarget || !replyTarget.id || !replyTarget.text) {
- toast.warning(t('ui.reply') as any)
- return
- }
- try {
- setAiSuggestLoading(true)
- // 选择模型:优先取用户配置的 aiInfo.agent.defaultModel;否则取聊天模型列表第一个
- let modelName: string | undefined = (userInfo as any)?.aiInfo?.agent?.defaultModel
- if (!modelName) {
- try {
- if (aiModels.length > 0) {
- modelName = aiModels[0]?.name
- }
- else {
- const listRes = await getChatModels()
- const list = (listRes?.data as any[]) || []
- modelName = list[0]?.name
- }
- }
- catch {}
- }
- const res: any = await request({
- url: 'channel/engagement/comment/ai/replies',
- method: 'POST',
- data: {
- model: modelName || 'gpt-5',
- prompt: '',
- comments: [{
- id: replyTarget.id,
- comment: replyTarget.text,
- }],
- },
- })
- const objjs = res?.data || {}
- const content = objjs?.[replyTarget.id] || objjs?.text
- if (content) {
- setReplyText(content)
- setTimeout(() => replyInputRef.current?.focus?.(), 0)
- }
- else {
- toast.warning(t('ui.noContent' as any) || '暂无AI建议')
- }
- }
- catch (e) {
- toast.error(t('ui.requestFailed' as any) || '请求失败')
- }
- finally {
- setAiSuggestLoading(false)
- }
- }
-
- // 删除收入/提现相关列定义(本页不需要)
-
- useEffect(() => {
- if (!token) {
- toast.error(t('messages.pleaseLoginFirst'))
- router.push('/auth/login')
- return
- }
-
- // 初始化账户
- accountInit()
- }, [token, router])
-
- // 底部自动加载更多(IntersectionObserver)
- useEffect(() => {
- if (!loadMoreRef.current)
- return
- const el = loadMoreRef.current
- const io = new IntersectionObserver((entries) => {
- const first = entries[0]
- if (first.isIntersecting && hasMore && !loading && postsCursor.after) {
- fetchEngagementPosts('next', postsCursor.after)
- }
- }, { rootMargin: '200px' })
- io.observe(el)
- return () => io.disconnect()
- }, [loadMoreRef.current, hasMore, loading, postsCursor.after])
-
- return (
- <>
- <div className={styles.container} style={{ display: 'flex', gap: 16 }}>
- {/* 左侧账户选择栏 */}
- <div>
- <AccountSidebar
- activeAccountId={accountActive?.id || ''}
- onAccountChange={(account) => {
- if (account.id === accountActive?.id) {
- setAccountActive(undefined)
- }
- else {
- setAccountActive(account)
- }
- }}
- isInteractivePage={true}
- />
- </div>
-
- {/* 右侧内容 */}
- <div style={{ flex: 1, minWidth: 0, height: '100%', overflow: 'auto' }}>
- {!accountActive?.uid ? (
- <Card style={{ height: '100%', minHeight: 360, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
- <div style={{ textAlign: 'center', maxWidth: 520 }}>
- <div style={{
- width: 72,
- height: 72,
- borderRadius: 16,
- border: '1px solid #e5e7eb',
- display: 'inline-flex',
- alignItems: 'center',
- justifyContent: 'center',
- marginBottom: 16,
- }}
- >
- <CommentOutlined style={{ fontSize: 36, color: '#9ca3af' }} />
- </div>
- <div style={{ fontSize: 18, fontWeight: 600, color: '#111827', marginBottom: 8 }}>{t('ui.selectChannel')}</div>
- <div style={{ color: '#6b7280' }}>{t('ui.selectChannelDesc')}</div>
- </div>
- </Card>
- ) : (
- /* 主要内容:互动帖子卡片瀑布流 */
- <div className={styles.content}>
- <div className={styles.grid}>
- {posts.map(item => (
- <PostCard key={`${item.id}`} item={item} />
- ))}
- </div>
- <div style={{ display: 'flex', justifyContent: 'center', marginTop: 12 }}>
- {hasMore && postsCursor.after
- ? (
- <Button
- loading={loading}
- onClick={() => fetchEngagementPosts('next', postsCursor.after)}
- disabled={loading}
- >
- {t('ui.loadMore')}
- </Button>
- )
- : posts.length > 0
- ? (
- <span style={{ color: '#999' }}>{t('ui.noMorePosts')}</span>
- )
- : null}
- </div>
- <div ref={loadMoreRef} style={{ height: 1 }} />
- </div>
- )}
- </div>
-
- {/* 评论弹窗 */}
- <Modal
- open={commentVisible}
- onCancel={() => setCommentVisible(false)}
- title={commentPost?.title || t('ui.reply')}
- footer={null}
- width={600}
- // height={600}
- // style={{ maxHeight: '80vh' }}
- >
- <List
- itemLayout="vertical"
- loading={commentLoading}
- dataSource={comments}
- style={{ maxHeight: '600px', overflow: 'auto' }}
- renderItem={(c: any) => {
- const canExpand = !!c.hasReplies
- const replyState = repliesByComment[c.id]
- const expanded = !!replyState?.expanded
- return (
- <List.Item
- style={{ alignItems: 'flex-start' }}
- actions={[
- canExpand && !expanded
- ? (
- <a key="expand" onClick={() => expandReplies(c.id)}>{t('ui.expandReplies')}</a>
- )
- : canExpand && expanded
- ? (
- <a key="collapse" onClick={() => collapseReplies(c.id)}>{t('ui.collapseReplies')}</a>
- )
- : null,
- // <a
- // key="ai-reply"
- // onClick={() => openAiModal(commentPost!.id, c.id)}
- // >
- // AI
- // </a>,
- ].filter(Boolean)}
- >
- <List.Item.Meta
- avatar={
- c.author?.avatar && (
- <Avatar src={c.author.avatar} />
- )
- }
- title={<span style={{ fontSize: '15px', fontWeight: 500 }}>{c.author?.username || c.author?.name}</span>}
- description={(
- <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-start' }}>
- <div>
- <span style={{ fontSize: '14px', color: '#333' }}>{c.message}</span>
- <a
- style={{ marginLeft: '12px', fontSize: '12px', color: '#a66ae4', cursor: 'pointer' }}
- onClick={() => {
- const name = c.author?.username || c.author?.name || c.author?.id || ''
- setReplyTarget({ id: c.id, name, text: c.message })
- setTimeout(() => replyInputRef.current?.focus?.(), 0)
- }}
- >
- {t('ui.reply')}
- </a>
- </div>
- <span style={{ fontSize: '12px', color: '#999', marginTop: '4px', whiteSpace: 'nowrap', marginLeft: '12px' }}>
- {new Date(c.createdAt).toLocaleString()}
- </span>
- </div>
- )}
- />
- {expanded && (
- <div className={styles.replyBlock}>
- <List
- size="small"
- itemLayout="vertical"
- dataSource={replyState?.list || []}
- loading={replyState?.loading}
- renderItem={(r: any) => (
- <List.Item style={{ padding: '4px 0' }}>
- <List.Item.Meta
- avatar={
- r.author?.avatar && (
- <Avatar src={r.author.avatar} />
- )
- }
- title={<span style={{ fontSize: '14px', fontWeight: 500 }}>{r.author?.username || r.author?.name}</span>}
- description={(
- <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-start' }}>
- <span style={{ fontSize: '14px', color: '#333' }}>{r.message}</span>
- <span style={{ fontSize: '12px', color: '#999', whiteSpace: 'nowrap', marginLeft: '12px' }}>
- {new Date(r.createdAt).toLocaleString()}
- </span>
- </div>
- )}
- />
- </List.Item>
- )}
- />
- <div style={{ display: 'flex', justifyContent: 'flex-start', paddingLeft: 0 }}>
- <Button style={{ paddingLeft: 0 }} size="small" type="link" onClick={() => loadMoreReplies(c.id)} disabled={!replyState?.cursor?.after} loading={replyState?.loading}>
- {t('ui.loadMoreReplies')}
- </Button>
- </div>
- </div>
- )}
- </List.Item>
- )
- }}
- />
- {commentsCursor?.after && (
- <div
- style={{ textAlign: 'center', marginTop: 10, color: '#1677ff', cursor: 'pointer' }}
- onClick={() => !commentLoading && loadCommentsV2(commentPost!.id, undefined, commentsCursor?.after)}
- >
- {commentLoading ? t('ui.loading') : t('ui.loadMoreComments')}
- </div>
- )}
- <div style={{ display: 'flex', gap: 8, marginTop: 12, paddingBottom: 20 }}>
- <div style={{ flex: 1, position: 'relative' }}>
- <Input
- style={{ paddingRight: 30 }}
- ref={replyInputRef}
- value={replyText}
- onChange={e => setReplyText(e.target.value)}
- placeholder={replyTarget ? `${t('ui.replyPlaceholder')}${replyTarget.name} - ${replyTarget.text.substring(0, 50)}${replyTarget.text.length > 50 ? '...' : ''}` : t('ui.commentPlaceholder')}
- />
- <Button
- type="text"
- onClick={fetchAiSuggestion}
- loading={aiSuggestLoading}
- style={{ position: 'absolute', right: 6, top: 1, padding: 4 }}
- title={t('ui.aiSuggest' as any) || 'AI建议'}
- disabled={!replyTarget}
- >
- <RobotOutlined style={{ fontSize: 18 }} />
- </Button>
- </div>
-
- <Button
- type="primary"
- loading={sending}
- disabled={sending || !replyText.trim()}
- onClick={() => (replyTarget ? submitReply(replyTarget.id) : submitPostComment())}
- style={{ width: 88, minWidth: 88 }}
- >
- {sending ? t('ui.sending') : t('ui.send')}
- </Button>
- </div>
- </Modal>
-
- {/* AI回复弹窗 */}
- <Modal
- open={aiModalVisible}
- onCancel={() => setAiModalVisible(false)}
- title={t('ui.aiReplyModalTitle')}
- footer={null}
- width={500}
- >
- <div style={{ marginBottom: 16 }}>
- <label style={{ display: 'block', marginBottom: 8, fontWeight: 500 }}>{t('ui.selectAiModel')}</label>
- <Select
- value={aiModel}
- onChange={setAiModel}
- style={{ width: '100%' }}
- placeholder={t('ui.aiModelPlaceholder')}
- loading={aiModels.length === 0}
- >
- {aiModels.map(model => (
- <Option key={model.name} value={model.name}>
- {model.description}
- </Option>
- ))}
- </Select>
- </div>
- <div style={{ marginBottom: 16 }}>
- <label style={{ display: 'block', marginBottom: 8, fontWeight: 500 }}>{t('ui.replyPrompt')}</label>
- <Input.TextArea
- value={aiPrompt}
- onChange={e => setAiPrompt(e.target.value)}
- rows={4}
- placeholder={t('ui.promptPlaceholder')}
- />
- </div>
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8 }}>
- <Button onClick={() => setAiModalVisible(false)}>
- {t('ui.cancel')}
- </Button>
- <Button
- type="primary"
- loading={aiLoading}
- disabled={!aiPrompt.trim() || !aiModel || aiLoading}
- onClick={submitAiReply}
- >
- {aiLoading ? t('ui.creating') : t('ui.createAiReplyTask')}
- </Button>
- </div>
- </Modal>
- </div>
- </>
- )
-}
diff --git a/project/web/src/app/[lng]/websit/data-deletion/page.tsx b/project/web/src/app/[lng]/websit/data-deletion/page.tsx
index 82af61f0..97521828 100644
--- a/project/web/src/app/[lng]/websit/data-deletion/page.tsx
+++ b/project/web/src/app/[lng]/websit/data-deletion/page.tsx
@@ -1,35 +1,10 @@
'use client'
-import { useTransClient } from '@/app/i18n/client'
import styles from '../websit.module.scss'
-// 导入首页的Header组件
-function Header() {
- const { t } = useTransClient('home')
-
- return (
- <header className={styles.header}>
- <div className={styles.headerContainer}>
- <div className={styles.logo}>
- <span className={styles.logoText}>{t('header.logo')}</span>
- </div>
- <nav className={styles.nav}>
- <a href="#marketplace" className={styles.navLink}>{t('header.nav.marketplace')}</a>
- <a href="#pricing" className={styles.navLink}>{t('header.nav.pricing')}</a>
- <a href="#docs" className={styles.navLink}>{t('header.nav.docs')}</a>
- {/* <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a> */}
- </nav>
- <button className={styles.getStartedBtn}>{t('header.getStarted')}</button>
- </div>
- </header>
- )
-}
-
export default function DataDeletionPage() {
return (
<div className={styles.websitPage}>
- <Header />
-
<main className={styles.main}>
<div className={styles.container}>
<div className={styles.header}>
diff --git a/project/web/src/app/[lng]/websit/extension-privacy-policy/page.tsx b/project/web/src/app/[lng]/websit/extension-privacy-policy/page.tsx
index bc7a9465..2f723337 100644
--- a/project/web/src/app/[lng]/websit/extension-privacy-policy/page.tsx
+++ b/project/web/src/app/[lng]/websit/extension-privacy-policy/page.tsx
@@ -1,33 +1,10 @@
'use client'
-import { useTransClient } from '@/app/i18n/client'
import styles from '../websit.module.scss'
-// 导入首页的Header组件
-function Header() {
- const { t } = useTransClient('home')
-
- return (
- <header className={styles.header}>
- <div className={styles.headerContainer}>
- <div className={styles.logo}>
- <span className={styles.logoText}>{t('header.logo')}</span>
- </div>
- <nav className={styles.nav}>
- <a href="#marketplace" className={styles.navLink}>{t('header.nav.marketplace')}</a>
- <a href="#pricing" className={styles.navLink}>{t('header.nav.pricing')}</a>
- <a href="#docs" className={styles.navLink}>{t('header.nav.docs')}</a>
- </nav>
- <button className={styles.getStartedBtn}>{t('header.getStarted')}</button>
- </div>
- </header>
- )
-}
-
export default function ExtensionPrivacyPolicyPage() {
return (
<div className={styles.websitPage}>
- <Header />
<main className={styles.main}>
<div className={styles.container}>
diff --git a/project/web/src/app/[lng]/websit/plugin-guide/page.tsx b/project/web/src/app/[lng]/websit/plugin-guide/page.tsx
index 069c3375..26214c8e 100644
--- a/project/web/src/app/[lng]/websit/plugin-guide/page.tsx
+++ b/project/web/src/app/[lng]/websit/plugin-guide/page.tsx
@@ -13,29 +13,6 @@ import image8 from './images/gyude-image8.png'
import image9 from './images/gyude-image9.png'
import image10 from './images/gyude-image10.png'
-/**
- * Header 组件
- */
-function Header() {
- const { t } = useTransClient('home')
-
- return (
- <header className={styles.header}>
- <div className={styles.headerContainer}>
- <div className={styles.logo}>
- <span className={styles.logoText}>{t('header.logo')}</span>
- </div>
- <nav className={styles.nav}>
- <a href="#marketplace" className={styles.navLink}>{t('header.nav.marketplace')}</a>
- <a href="#pricing" className={styles.navLink}>{t('header.nav.pricing')}</a>
- <a href="#docs" className={styles.navLink}>{t('header.nav.docs')}</a>
- </nav>
- <button className={styles.getStartedBtn}>{t('header.getStarted')}</button>
- </div>
- </header>
- )
-}
-
/**
* 教程步骤组件
*/
@@ -89,8 +66,6 @@ export default function PluginGuidePage() {
return (
<div className={styles.pluginGuidePage}>
- <Header />
-
<main className={styles.main}>
<div className={styles.container}>
{/* 页面标题 */}
diff --git a/project/web/src/app/[lng]/websit/privacy-policy/page.tsx b/project/web/src/app/[lng]/websit/privacy-policy/page.tsx
index cf8bfeea..4fdef089 100644
--- a/project/web/src/app/[lng]/websit/privacy-policy/page.tsx
+++ b/project/web/src/app/[lng]/websit/privacy-policy/page.tsx
@@ -1,35 +1,10 @@
'use client'
-import { useTransClient } from '@/app/i18n/client'
import styles from '../websit.module.scss'
-// 导入首页的Header组件
-function Header() {
- const { t } = useTransClient('home')
-
- return (
- <header className={styles.header}>
- <div className={styles.headerContainer}>
- <div className={styles.logo}>
- <span className={styles.logoText}>{t('header.logo')}</span>
- </div>
- <nav className={styles.nav}>
- <a href="#marketplace" className={styles.navLink}>{t('header.nav.marketplace')}</a>
- <a href="#pricing" className={styles.navLink}>{t('header.nav.pricing')}</a>
- <a href="#docs" className={styles.navLink}>{t('header.nav.docs')}</a>
- {/* <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a> */}
- </nav>
- <button className={styles.getStartedBtn}>{t('header.getStarted')}</button>
- </div>
- </header>
- )
-}
-
export default function PrivacyPolicyPage() {
return (
<div className={styles.websitPage}>
- <Header />
-
<main className={styles.main}>
<div className={styles.container}>
<div className={styles.header}>
diff --git a/project/web/src/app/[lng]/websit/terms-of-service/page.tsx b/project/web/src/app/[lng]/websit/terms-of-service/page.tsx
index c2885bba..c83b3878 100644
--- a/project/web/src/app/[lng]/websit/terms-of-service/page.tsx
+++ b/project/web/src/app/[lng]/websit/terms-of-service/page.tsx
@@ -1,35 +1,10 @@
'use client'
-import { useTransClient } from '@/app/i18n/client'
import styles from '../websit.module.scss'
-// 导入首页的Header组件
-function Header() {
- const { t } = useTransClient('home')
-
- return (
- <header className={styles.header}>
- <div className={styles.headerContainer}>
- <div className={styles.logo}>
- <span className={styles.logoText}>{t('header.logo')}</span>
- </div>
- <nav className={styles.nav}>
- <a href="#marketplace" className={styles.navLink}>{t('header.nav.marketplace')}</a>
- <a href="#pricing" className={styles.navLink}>{t('header.nav.pricing')}</a>
- <a href="#docs" className={styles.navLink}>{t('header.nav.docs')}</a>
- {/* <a href="#blog" className={styles.navLink}>{t('header.nav.blog')}</a> */}
- </nav>
- <button className={styles.getStartedBtn}>{t('header.getStarted')}</button>
- </div>
- </header>
- )
-}
-
export default function TermsOfServicePage() {
return (
<div className={styles.websitPage}>
- <Header />
-
<main className={styles.main}>
<div className={styles.container}>
<div className={styles.header}>
diff --git a/project/web/src/app/globals.css b/project/web/src/app/globals.css
index 7ec8e0bc..a8cb7e3f 100644
--- a/project/web/src/app/globals.css
+++ b/project/web/src/app/globals.css
@@ -9,6 +9,10 @@ body {
font-family: "SourceHanSansCN-Regular";
}
+button {
+ cursor: pointer;
+}
+
@theme inline {
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
@@ -147,4 +151,8 @@ body {
body {
@apply bg-background text-foreground text-sm;
}
+}
+
+body > div {
+ pointer-events: auto;
}
\ No newline at end of file
diff --git a/project/web/src/app/i18n/locales/en/account.json b/project/web/src/app/i18n/locales/en/account.json
index 1706b903..5fd9fd36 100644
--- a/project/web/src/app/i18n/locales/en/account.json
+++ b/project/web/src/app/i18n/locales/en/account.json
@@ -5,9 +5,15 @@
"defaultSpace": "Default Space",
"addPost": "Add a Post",
"calendarMode": "Calendar Mode",
+ "calendarModeTab": "Calendar Mode",
"listModeTab": "List Mode",
"newWork": "New Work",
"allPlatforms": "All Platforms",
+ "allChannels": "All Channels",
+ "allSpaces": "All Spaces",
+ "viewAllChannels": "View all channels",
+ "userManagement": "User Management",
+ "space": "Space",
"accountManager": "Acct Manager",
"addAccount": "Add Channels",
"mcpManagerTit": "MCP Manager",
diff --git a/project/web/src/app/i18n/locales/en/plugin.json b/project/web/src/app/i18n/locales/en/plugin.json
index 84ae2e8e..211e3b98 100644
--- a/project/web/src/app/i18n/locales/en/plugin.json
+++ b/project/web/src/app/i18n/locales/en/plugin.json
@@ -87,6 +87,7 @@
"xhsHome": "Home",
"xhsCreator": "Creator",
"xhsLoginHomeTip": "Login to Xiaohongshu Homepage",
- "xhsLoginCreatorTip": "Login to Xiaohongshu Creator Center"
+ "xhsLoginCreatorTip": "Login to Xiaohongshu Creator Center",
+ "viewGuide": "View Installation Guide"
}
}
diff --git a/project/web/src/app/i18n/locales/en/publish.json b/project/web/src/app/i18n/locales/en/publish.json
index 7a1b8bae..9e57176f 100644
--- a/project/web/src/app/i18n/locales/en/publish.json
+++ b/project/web/src/app/i18n/locales/en/publish.json
@@ -12,8 +12,9 @@
},
"buttons": {
"customizePerAccount": "Customize per account",
+ "cancel": "Cancel",
"cancelPublish": "Cancel Publish",
- "schedulePublish": "Schedule Publish",
+ "schedulePublish": "Publish",
"publishNow": "Now",
"copyLink": "Copy link",
"delete": "Delete",
@@ -335,5 +336,15 @@
"pluginPublish": {
"ready": "Plugin",
"notReady": "Plugin Not Ready"
+ },
+ "dateTimePicker": {
+ "sunday": "Su",
+ "monday": "Mo",
+ "tuesday": "Tu",
+ "wednesday": "We",
+ "thursday": "Th",
+ "friday": "Fr",
+ "saturday": "Sa",
+ "yearMonth": "{{month}}/{{year}}"
}
}
diff --git a/project/web/src/app/i18n/locales/zh-CN/account.json b/project/web/src/app/i18n/locales/zh-CN/account.json
index 3b32ae2b..e035fe57 100644
--- a/project/web/src/app/i18n/locales/zh-CN/account.json
+++ b/project/web/src/app/i18n/locales/zh-CN/account.json
@@ -2,12 +2,18 @@
"title": "账户",
"describe": "账户页面",
"today": "今天",
- "defaultSpace": "defaultSpace",
+ "defaultSpace": "默认空间",
"addPost": "添加帖子",
"calendarMode": "日历模式",
+ "calendarModeTab": "日历模式",
"listModeTab": "列表模式",
"newWork": "新建作品",
"allPlatforms": "所有平台",
+ "allChannels": "全部频道",
+ "allSpaces": "全部空间",
+ "viewAllChannels": "查看所有频道的内容",
+ "userManagement": "用户管理",
+ "space": "空间",
"accountManager": "账号管理器",
"addAccount": "添加频道",
"mcpManagerTit": "MCP 管理器",
@@ -276,5 +282,6 @@
"label": "来源",
"web": "网页端",
"app": "App端"
- }
+ },
+ "rightClickTip": "右键点击空间或频道可进行删除、排序等操作"
}
diff --git a/project/web/src/app/i18n/locales/zh-CN/plugin.json b/project/web/src/app/i18n/locales/zh-CN/plugin.json
index a3b9669b..6b6831c3 100644
--- a/project/web/src/app/i18n/locales/zh-CN/plugin.json
+++ b/project/web/src/app/i18n/locales/zh-CN/plugin.json
@@ -87,6 +87,7 @@
"xhsHome": "主页",
"xhsCreator": "创作者",
"xhsLoginHomeTip": "登录小红书主页",
- "xhsLoginCreatorTip": "登录小红书创作者后台"
+ "xhsLoginCreatorTip": "登录小红书创作者后台",
+ "viewGuide": "查看安装教程"
}
}
diff --git a/project/web/src/app/i18n/locales/zh-CN/publish.json b/project/web/src/app/i18n/locales/zh-CN/publish.json
index f6aa9cde..eb60798e 100644
--- a/project/web/src/app/i18n/locales/zh-CN/publish.json
+++ b/project/web/src/app/i18n/locales/zh-CN/publish.json
@@ -12,8 +12,9 @@
},
"buttons": {
"customizePerAccount": "自定义每个账户",
+ "cancel": "取消",
"cancelPublish": "取消发布",
- "schedulePublish": "定时发布",
+ "schedulePublish": "发布",
"publishNow": "立即发布",
"copyLink": "复制链接",
"delete": "删除",
@@ -336,5 +337,15 @@
"pluginPublish": {
"ready": "插件发布",
"notReady": "插件未就绪"
+ },
+ "dateTimePicker": {
+ "sunday": "日",
+ "monday": "一",
+ "tuesday": "二",
+ "wednesday": "三",
+ "thursday": "四",
+ "friday": "五",
+ "saturday": "六",
+ "yearMonth": "{{year}}年 {{month}}月"
}
}
diff --git a/project/web/src/app/layout/LayoutSidebar/index.tsx b/project/web/src/app/layout/LayoutSidebar/index.tsx
index e8cabb83..b8574033 100644
--- a/project/web/src/app/layout/LayoutSidebar/index.tsx
+++ b/project/web/src/app/layout/LayoutSidebar/index.tsx
@@ -52,8 +52,8 @@ const LayoutSidebar = () => {
currRouter = `/${route.slice(0, 2).join('/')}`
}
- // auth 页面不显示侧边栏
- const isAuthPage = route[0] === 'auth'
+ // auth 和 websit 页面不显示侧边栏
+ const isAuthPage = route[0] === 'auth' || route[0] === 'websit'
if (isAuthPage) {
return null
}
diff --git a/project/web/src/components/AvatarPlat/index.tsx b/project/web/src/components/AvatarPlat/index.tsx
index bc24aeda..e5ebd070 100644
--- a/project/web/src/components/AvatarPlat/index.tsx
+++ b/project/web/src/components/AvatarPlat/index.tsx
@@ -4,8 +4,8 @@ import type { SocialAccount } from '@/api/types/account.type'
import { Avatar } from 'antd'
import { forwardRef, memo } from 'react'
import { AccountPlatInfoMap } from '@/app/config/platConfig'
-import { OSS_URL } from '@/constant'
import styles from './avatarPlat.module.scss'
+import { getOssUrl } from '@/utils/oss'
export interface IAvatarPlatRef {}
@@ -23,7 +23,7 @@ function getAvatar(url: string) {
return url
}
else {
- return `${OSS_URL}/${url}`
+ return `${getOssUrl(url)}`
}
}
diff --git a/project/web/src/components/Plugin/PluginNotInstalled.tsx b/project/web/src/components/Plugin/PluginNotInstalled.tsx
index 99ad58dc..8e3135ce 100644
--- a/project/web/src/components/Plugin/PluginNotInstalled.tsx
+++ b/project/web/src/components/Plugin/PluginNotInstalled.tsx
@@ -5,7 +5,7 @@
'use client'
-import { Chrome, Github, Puzzle } from 'lucide-react'
+import { BookOpen, Chrome, Github, Puzzle } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import { PLUGIN_DOWNLOAD_LINKS } from '@/store/plugin/constants'
import { Button } from '@/components/ui/button'
@@ -63,6 +63,21 @@ export function PluginNotInstalled() {
{t('header.githubRelease')}
</a>
</Button>
+
+ {/* <Button
+ variant="ghost"
+ className="w-full gap-2"
+ asChild
+ >
+ <a
+ href="/websit/plugin-guide"
+ target="_blank"-
+ rel="noopener noreferrer"
+ >
+ <BookOpen className="h-4 w-4" />
+ {t('header.viewGuide')}
+ </a>
+ </Button> */}
</div>
</div>
)
diff --git a/project/web/src/components/PublishDialog/compoents/PublishDatePicker/DateTimePicker.tsx b/project/web/src/components/PublishDialog/compoents/PublishDatePicker/DateTimePicker.tsx
new file mode 100644
index 00000000..748733ee
--- /dev/null
+++ b/project/web/src/components/PublishDialog/compoents/PublishDatePicker/DateTimePicker.tsx
@@ -0,0 +1,272 @@
+/**
+ * DateTimePicker Component
+ * 自定义日期时间选择器组件 - 支持深色/浅色主题切换
+ */
+
+import type { Dayjs } from 'dayjs'
+import dayjs from 'dayjs'
+import { ChevronLeft, ChevronRight } from 'lucide-react'
+import { useEffect, useRef, useState } from 'react'
+import { Button } from '@/components/ui/button'
+import { cn } from '@/lib/utils'
+import { useTransClient } from '@/app/i18n/client'
+
+interface DateTimePickerProps {
+ value: Dayjs | null
+ onChange: (date: Dayjs) => void
+ disabledDate?: (current: Dayjs) => boolean
+ disabledTime?: (current: Dayjs | null) => {
+ disabledHours?: () => number[]
+ disabledMinutes?: (hour: number) => number[]
+ }
+}
+
+export function DateTimePicker({ value, onChange, disabledDate, disabledTime }: DateTimePickerProps) {
+ const { t } = useTransClient('publish')
+ const [currentMonth, setCurrentMonth] = useState(value || dayjs())
+ const [selectedDate, setSelectedDate] = useState(value)
+ const [selectedHour, setSelectedHour] = useState(value?.hour() || 0)
+ const [selectedMinute, setSelectedMinute] = useState(value?.minute() || 0)
+
+ const hourScrollRef = useRef<HTMLDivElement>(null)
+ const minuteScrollRef = useRef<HTMLDivElement>(null)
+
+ const daysInMonth = currentMonth.daysInMonth()
+ const firstDayOfMonth = currentMonth.startOf('month').day()
+ const today = dayjs()
+
+ // 自动滚动到选中的时间
+ useEffect(() => {
+ if (hourScrollRef.current) {
+ const selectedElement = hourScrollRef.current.querySelector('[data-selected="true"]')
+ if (selectedElement) {
+ selectedElement.scrollIntoView({ block: 'center', behavior: 'smooth' })
+ }
+ }
+ }, [selectedHour])
+
+ useEffect(() => {
+ if (minuteScrollRef.current) {
+ const selectedElement = minuteScrollRef.current.querySelector('[data-selected="true"]')
+ if (selectedElement) {
+ selectedElement.scrollIntoView({ block: 'center', behavior: 'smooth' })
+ }
+ }
+ }, [selectedMinute])
+
+ // 生成日历网格
+ const calendarDays = []
+ const prevMonthDays = currentMonth.subtract(1, 'month').daysInMonth()
+
+ // 上个月的日期
+ for (let i = firstDayOfMonth - 1; i >= 0; i--) {
+ calendarDays.push({
+ date: currentMonth.subtract(1, 'month').date(prevMonthDays - i),
+ isCurrentMonth: false,
+ })
+ }
+
+ // 当前月的日期
+ for (let i = 1; i <= daysInMonth; i++) {
+ calendarDays.push({
+ date: currentMonth.date(i),
+ isCurrentMonth: true,
+ })
+ }
+
+ // 下个月的日期(补齐到42天,6周)
+ const remainingDays = 42 - calendarDays.length
+ for (let i = 1; i <= remainingDays; i++) {
+ calendarDays.push({
+ date: currentMonth.add(1, 'month').date(i),
+ isCurrentMonth: false,
+ })
+ }
+
+ const handlePrevMonth = () => {
+ setCurrentMonth(currentMonth.subtract(1, 'month'))
+ }
+
+ const handleNextMonth = () => {
+ setCurrentMonth(currentMonth.add(1, 'month'))
+ }
+
+ const handleSelectDate = (date: Dayjs) => {
+ if (disabledDate && disabledDate(date)) return
+
+ setSelectedDate(date)
+ const newDateTime = date.hour(selectedHour).minute(selectedMinute)
+ onChange(newDateTime)
+ }
+
+ const handleTimeChange = (hour: number, minute: number) => {
+ setSelectedHour(hour)
+ setSelectedMinute(minute)
+ if (selectedDate) {
+ const newDateTime = selectedDate.hour(hour).minute(minute)
+ onChange(newDateTime)
+ }
+ }
+
+ // 获取禁用的小时和分钟
+ const disabledTimeConfig = disabledTime ? disabledTime(selectedDate) : {}
+ const disabledHours = disabledTimeConfig.disabledHours?.() || []
+ const disabledMinutes = disabledTimeConfig.disabledMinutes?.(selectedHour) || []
+
+ const weekDays = [
+ t('dateTimePicker.sunday'),
+ t('dateTimePicker.monday'),
+ t('dateTimePicker.tuesday'),
+ t('dateTimePicker.wednesday'),
+ t('dateTimePicker.thursday'),
+ t('dateTimePicker.friday'),
+ t('dateTimePicker.saturday'),
+ ]
+
+ // 格式化年月显示
+ const formatYearMonth = (date: Dayjs) => {
+ const year = date.year()
+ const month = date.month() + 1 // dayjs 的月份是 0-11
+ return t('dateTimePicker.yearMonth', { year, month })
+ }
+
+ return (
+ <div className="flex">
+ {/* 左侧日历部分 */}
+ <div className="flex-1 p-4 border-r border-border">
+ {/* 月份导航 */}
+ <div className="flex items-center justify-between mb-4">
+ <Button variant="ghost" size="sm" onClick={handlePrevMonth} className="h-8 w-8 p-0">
+ <ChevronLeft className="w-4 h-4" />
+ </Button>
+ <div className="text-sm font-medium">{formatYearMonth(currentMonth)}</div>
+ <Button variant="ghost" size="sm" onClick={handleNextMonth} className="h-8 w-8 p-0">
+ <ChevronRight className="w-4 h-4" />
+ </Button>
+ </div>
+
+ {/* 星期标题 */}
+ <div className="grid grid-cols-7 gap-1 mb-2">
+ {weekDays.map(day => (
+ <div key={day} className="text-center text-xs font-medium text-muted-foreground py-2">
+ {day}
+ </div>
+ ))}
+ </div>
+
+ {/* 日期网格 */}
+ <div className="grid grid-cols-7 gap-1">
+ {calendarDays.map((item, index) => {
+ const isToday = item.date.isSame(today, 'day')
+ const isSelected = selectedDate?.isSame(item.date, 'day')
+ const isDisabled = !item.isCurrentMonth || (disabledDate && disabledDate(item.date))
+
+ return (
+ <button
+ key={index}
+ onClick={() => handleSelectDate(item.date)}
+ disabled={isDisabled}
+ className={cn(
+ 'h-9 w-full text-sm rounded-md transition-colors',
+ 'hover:bg-accent hover:text-accent-foreground',
+ 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
+ !item.isCurrentMonth && 'text-muted-foreground opacity-50',
+ isToday && 'border border-primary',
+ isSelected && 'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground',
+ isDisabled && 'opacity-30 cursor-not-allowed hover:bg-transparent',
+ )}
+ >
+ {item.date.date()}
+ </button>
+ )
+ })}
+ </div>
+ </div>
+
+ {/* 右侧时间选择部分 */}
+ <div className="w-[120px] flex flex-col h-[350px]">
+ {/* 时间显示 */}
+ <div className="p-3 border-b border-border shrink-0">
+ <div className="text-center">
+ <div className="text-lg font-semibold tabular-nums">
+ {selectedHour.toString().padStart(2, '0')}:{selectedMinute.toString().padStart(2, '0')}
+ </div>
+ </div>
+ </div>
+
+ {/* 时间选择滚动列表 */}
+ <div className="flex-1 flex overflow-hidden">
+ {/* 小时列 */}
+ <div className="flex-1 border-r border-border overflow-hidden">
+ <div
+ ref={hourScrollRef}
+ className="h-full overflow-y-auto scrollbar-thin scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent hover:scrollbar-thumb-muted-foreground/40"
+ onWheel={(e) => {
+ e.stopPropagation()
+ if (hourScrollRef.current) {
+ hourScrollRef.current.scrollTop += e.deltaY
+ }
+ }}
+ >
+ {Array.from({ length: 24 }, (_, i) => i).map(hour => {
+ const isDisabled = disabledHours.includes(hour)
+ const isSelected = hour === selectedHour
+ return (
+ <button
+ key={hour}
+ data-selected={isSelected}
+ onClick={() => !isDisabled && handleTimeChange(hour, selectedMinute)}
+ disabled={isDisabled}
+ className={cn(
+ 'w-full text-center py-2 text-sm transition-colors tabular-nums',
+ 'hover:bg-accent hover:text-accent-foreground',
+ isSelected && 'bg-primary/10 text-primary font-semibold',
+ isDisabled && 'opacity-30 cursor-not-allowed hover:bg-transparent',
+ )}
+ >
+ {hour.toString().padStart(2, '0')}
+ </button>
+ )
+ })}
+ </div>
+ </div>
+
+ {/* 分钟列 */}
+ <div className="flex-1 overflow-hidden">
+ <div
+ ref={minuteScrollRef}
+ className="h-full overflow-y-auto scrollbar-thin scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent hover:scrollbar-thumb-muted-foreground/40"
+ onWheel={(e) => {
+ e.stopPropagation()
+ if (minuteScrollRef.current) {
+ minuteScrollRef.current.scrollTop += e.deltaY
+ }
+ }}
+ >
+ {Array.from({ length: 60 }, (_, i) => i).map(minute => {
+ const isDisabled = disabledMinutes.includes(minute)
+ const isSelected = minute === selectedMinute
+ return (
+ <button
+ key={minute}
+ data-selected={isSelected}
+ onClick={() => !isDisabled && handleTimeChange(selectedHour, minute)}
+ disabled={isDisabled}
+ className={cn(
+ 'w-full text-center py-2 text-sm transition-colors tabular-nums',
+ 'hover:bg-accent hover:text-accent-foreground',
+ isSelected && 'bg-primary/10 text-primary font-semibold',
+ isDisabled && 'opacity-30 cursor-not-allowed hover:bg-transparent',
+ )}
+ >
+ {minute.toString().padStart(2, '0')}
+ </button>
+ )
+ })}
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/project/web/src/components/PublishDialog/compoents/PublishDatePicker/index.tsx b/project/web/src/components/PublishDialog/compoents/PublishDatePicker/index.tsx
index 1734ebc7..51bb0abc 100644
--- a/project/web/src/components/PublishDialog/compoents/PublishDatePicker/index.tsx
+++ b/project/web/src/components/PublishDialog/compoents/PublishDatePicker/index.tsx
@@ -1,36 +1,24 @@
+/**
+ * PublishDatePicker Component
+ * 发布日期选择器组件 - 支持立即发布和定时发布两种模式
+ */
+
import type { Dayjs } from 'dayjs'
-import type {
- ForwardedRef,
-} from 'react'
-import {
- ArrowLeftOutlined,
- CheckOutlined,
- ClockCircleOutlined,
- DownOutlined,
- PushpinOutlined,
- SendOutlined,
- StarFilled,
- StarOutlined,
- ThunderboltOutlined,
-} from '@ant-design/icons'
-import { Button, DatePicker, Popover, Space } from 'antd'
-import { toast } from '@/lib/toast'
+import type { ForwardedRef } from 'react'
import dayjs from 'dayjs'
-import {
- forwardRef,
- memo,
- useMemo,
- useState,
-} from 'react'
+import { ArrowLeft, Check, ChevronDown, Clock, Send, Star } from 'lucide-react'
+import { forwardRef, memo, useMemo, useState } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { useTransClient } from '@/app/i18n/client'
import { PublishDatePickerType } from '@/components/PublishDialog/compoents/PublishDatePicker/publishDatePicker.enums'
import { usePublishDialog } from '@/components/PublishDialog/usePublishDialog'
import { useUserStore } from '@/store/user'
-import styles from './publishDatePicker.module.scss'
+import { Button } from '@/components/ui/button'
+import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
+import { cn } from '@/lib/utils'
+import { DateTimePicker } from './DateTimePicker'
-export interface IPublishDatePickerRef {
-}
+export interface IPublishDatePickerRef {}
export interface IPublishDatePickerProps {
loading: boolean
@@ -38,22 +26,19 @@ export interface IPublishDatePickerProps {
}
const PublishDatePicker = memo(
- forwardRef(
- (
- { loading, onClick }: IPublishDatePickerProps,
- ref: ForwardedRef<IPublishDatePickerRef>,
- ) => {
- const { t } = useTransClient('publish')
- const [menuOpen, setMenuOpen] = useState(false)
- const [tempDate, setTempDate] = useState<Dayjs | null>(null)
- const [showMenu, setShowMenu] = useState(true)
- const { pubTime, setPubTime } = usePublishDialog(
- useShallow(state => ({
- pubTime: state.pubTime,
- setPubTime: state.setPubTime,
- })),
- )
- const { currentDatePickerType, defaultCurrentDatePickerType, setDefaultCurrentDatePickerType, setCurrentDatePickerType } = useUserStore(
+ forwardRef(({ loading, onClick }: IPublishDatePickerProps, ref: ForwardedRef<IPublishDatePickerRef>) => {
+ const { t } = useTransClient('publish')
+ const [menuOpen, setMenuOpen] = useState(false)
+ const [tempDate, setTempDate] = useState<Dayjs | null>(null)
+ const [showMenu, setShowMenu] = useState(true)
+ const { pubTime, setPubTime } = usePublishDialog(
+ useShallow(state => ({
+ pubTime: state.pubTime,
+ setPubTime: state.setPubTime,
+ })),
+ )
+ const { currentDatePickerType, defaultCurrentDatePickerType, setDefaultCurrentDatePickerType, setCurrentDatePickerType } =
+ useUserStore(
useShallow(state => ({
currentDatePickerType: state.currentDatePickerType,
defaultCurrentDatePickerType: state.defaultCurrentDatePickerType,
@@ -62,257 +47,300 @@ const PublishDatePicker = memo(
})),
)
- const handleCalendarChange = (date: Dayjs | Dayjs[]) => {
- setTempDate(date as Dayjs)
- }
+ const handleCalendarChange = (date: Dayjs) => {
+ setTempDate(date)
+ }
- const handleConfirm = (e: React.MouseEvent) => {
- e.stopPropagation()
- if (currentDatePickerType === PublishDatePickerType.DATE) {
- setPubTime(tempDate ? tempDate.format() : undefined)
- }
- else {
- setPubTime(undefined)
- }
- setMenuOpen(false)
- setShowMenu(true)
- }
+ const handleConfirm = (e: React.MouseEvent) => {
+ e.stopPropagation()
- const handleSelectPublishType = (type: PublishDatePickerType) => {
- setCurrentDatePickerType(type)
- if (type === PublishDatePickerType.Now) {
- setPubTime(undefined)
- setMenuOpen(false)
- setShowMenu(true)
- }
- else {
- setShowMenu(false)
- }
+ // 更新时间
+ if (currentDatePickerType === PublishDatePickerType.DATE) {
+ setPubTime(tempDate ? tempDate.format() : undefined)
+ } else {
+ setPubTime(undefined)
}
- const handleBackToMenu = (e: React.MouseEvent) => {
- e.stopPropagation()
+ // 直接关闭弹窗,不要在关闭前切换视图
+ setMenuOpen(false)
+
+ // 等待弹窗完全关闭后(约 300ms)再重置菜单状态
+ setTimeout(() => {
setShowMenu(true)
- }
+ }, 300)
+ }
- const handleToggleFavorite = (type: PublishDatePickerType) => {
- if (defaultCurrentDatePickerType === type) {
- setDefaultCurrentDatePickerType(PublishDatePickerType.DATE)
- }
- else {
- setDefaultCurrentDatePickerType(type)
- }
+ const handleSelectPublishType = (type: PublishDatePickerType) => {
+ setCurrentDatePickerType(type)
+ if (type === PublishDatePickerType.Now) {
+ setPubTime(undefined)
+ setMenuOpen(false)
+ setShowMenu(true)
+ } else {
+ setShowMenu(false)
}
+ }
+
+ const handleBackToMenu = (e: React.MouseEvent) => {
+ e.stopPropagation()
+ setShowMenu(true)
+ }
- // 禁用今天之前的日期
- const disabledDate = (current: dayjs.Dayjs) => {
- return current && current < dayjs().startOf('day')
+ const handleToggleFavorite = (type: PublishDatePickerType) => {
+ if (defaultCurrentDatePickerType === type) {
+ setDefaultCurrentDatePickerType(PublishDatePickerType.DATE)
+ } else {
+ setDefaultCurrentDatePickerType(type)
}
+ }
- // 禁用当前时间之前和当前时间20分钟内的时间(只精确到分钟,不考虑秒)
- const disabledDateTime = (current: dayjs.Dayjs | null) => {
- if (!current)
- return {}
+ // 禁用今天之前的日期
+ const disabledDate = (current: dayjs.Dayjs) => {
+ return current && current < dayjs().startOf('day')
+ }
- const now = dayjs()
- const minTime = now.add(20, 'minute')
+ // 禁用当前时间之前和当前时间20分钟内的时间(只精确到分钟,不考虑秒)
+ const disabledDateTime = (current: dayjs.Dayjs | null) => {
+ if (!current) return {}
- // 只对今天限制
- if (current.isSame(now, 'day')) {
- const minHour = minTime.hour()
- const minMinute = minTime.minute()
+ const now = dayjs()
+ const minTime = now.add(20, 'minute')
- // 禁用小时
- const disabledHours = () => {
- const hours: number[] = []
- for (let i = 0; i < 24; i++) {
- if (i < minHour)
- hours.push(i)
- }
- return hours
+ // 只对今天限制
+ if (current.isSame(now, 'day')) {
+ const minHour = minTime.hour()
+ const minMinute = minTime.minute()
+
+ // 禁用小时
+ const disabledHours = () => {
+ const hours: number[] = []
+ for (let i = 0; i < 24; i++) {
+ if (i < minHour) hours.push(i)
}
+ return hours
+ }
- // 禁用分钟
- const disabledMinutes = (selectedHour: number) => {
- const minutes: number[] = []
- if (selectedHour === minHour) {
- for (let i = 0; i < minMinute; i++) {
- minutes.push(i)
- }
+ // 禁用分钟
+ const disabledMinutes = (selectedHour: number) => {
+ const minutes: number[] = []
+ if (selectedHour === minHour) {
+ for (let i = 0; i < minMinute; i++) {
+ minutes.push(i)
}
- else if (selectedHour < minHour) {
- // 小时都禁用了,分钟全部禁用
- for (let i = 0; i < 60; i++) {
- minutes.push(i)
- }
+ } else if (selectedHour < minHour) {
+ // 小时都禁用了,分钟全部禁用
+ for (let i = 0; i < 60; i++) {
+ minutes.push(i)
}
- return minutes
}
+ return minutes
+ }
- return {
- disabledHours,
- disabledMinutes,
- }
+ return {
+ disabledHours,
+ disabledMinutes,
}
- // 非今天不限制
- return {}
}
+ // 非今天不限制
+ return {}
+ }
- const pubTimeValue = useMemo(() => {
- if (pubTime) {
- return dayjs(pubTime)
- }
- return null
- }, [pubTime])
+ const pubTimeValue = useMemo(() => {
+ if (pubTime) {
+ return dayjs(pubTime)
+ }
+ return null
+ }, [pubTime])
- // 当打开弹窗时,初始化临时日期
- const handleOpenChange = (open: boolean) => {
- if (open) {
- setTempDate(pubTimeValue)
- // 如果当前是定时发布,直接显示日期选择器;否则显示菜单
- setShowMenu(currentDatePickerType === PublishDatePickerType.Now)
- }
- setMenuOpen(open)
+ // 当打开弹窗时,初始化临时日期
+ const handleOpenChange = (open: boolean) => {
+ if (open) {
+ setTempDate(pubTimeValue)
+ // 如果当前是定时发布,直接显示日期选择器;否则显示菜单
+ setShowMenu(currentDatePickerType === PublishDatePickerType.Now)
}
+ // 只在弹窗状态变化时更新 menuOpen,不要在这里切换视图
+ setMenuOpen(open)
+ }
- // 菜单选项内容
- const menuContent = (
- <div className={styles.menuContent}>
- <div
- className={`${styles.menuItem} ${currentDatePickerType === PublishDatePickerType.Now ? styles.menuItemActive : ''}`}
- onClick={() => handleSelectPublishType(PublishDatePickerType.Now)}
- >
- <div className={styles.menuItemLeft}>
- <SendOutlined className={styles.menuIcon} />
- <div className={styles.menuItemText}>
- <div className={styles.menuItemTitle}>{t('buttons.publishNow')}</div>
- <div className={styles.menuItemDesc}>{t('buttons.publishNowDesc')}</div>
+ // 菜单选项内容
+ const menuContent = (
+ <div className="min-w-[280px] p-3 flex flex-col gap-1">
+ {/* 立即发布选项 */}
+ <div
+ className={cn(
+ 'flex items-center justify-between p-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50',
+ currentDatePickerType === PublishDatePickerType.Now && 'bg-primary/10',
+ )}
+ onClick={() => handleSelectPublishType(PublishDatePickerType.Now)}
+ >
+ <div className="flex items-center gap-3 flex-1">
+ <Send
+ className={cn(
+ 'w-[18px] h-[18px] text-muted-foreground',
+ currentDatePickerType === PublishDatePickerType.Now && 'text-primary',
+ )}
+ />
+ <div className="flex flex-col gap-0.5">
+ <div
+ className={cn(
+ 'text-sm font-medium leading-tight',
+ currentDatePickerType === PublishDatePickerType.Now && 'text-primary',
+ )}
+ >
+ {t('buttons.publishNow')}
</div>
- </div>
- <div className={styles.menuItemRight}>
- <Button
- type="text"
- size="small"
- title={t('buttons.defaultPublishAction')}
- icon={defaultCurrentDatePickerType === PublishDatePickerType.Now ? <StarFilled /> : <StarOutlined />}
- onClick={(e) => {
- e.stopPropagation()
- handleToggleFavorite(PublishDatePickerType.Now)
- }}
- />
+ <div className="text-xs text-muted-foreground leading-tight">{t('buttons.publishNowDesc')}</div>
</div>
</div>
- <div
- className={`${styles.menuItem} ${currentDatePickerType === PublishDatePickerType.DATE ? styles.menuItemActive : ''}`}
- onClick={() => handleSelectPublishType(PublishDatePickerType.DATE)}
+ <Button
+ variant="ghost"
+ size="sm"
+ className="h-8 w-8 p-0"
+ title={t('buttons.defaultPublishAction')}
+ onClick={e => {
+ e.stopPropagation()
+ handleToggleFavorite(PublishDatePickerType.Now)
+ }}
>
- <div className={styles.menuItemLeft}>
- <ClockCircleOutlined className={styles.menuIcon} />
- <div className={styles.menuItemText}>
- <div className={styles.menuItemTitle}>{t('buttons.setDateTime')}</div>
- <div className={styles.menuItemDesc}>{t('buttons.schedulePublishDesc')}</div>
+ <Star
+ className={cn(
+ 'w-4 h-4',
+ defaultCurrentDatePickerType === PublishDatePickerType.Now
+ ? 'fill-primary text-primary'
+ : 'text-muted-foreground',
+ )}
+ />
+ </Button>
+ </div>
+
+ {/* 定时发布选项 */}
+ <div
+ className={cn(
+ 'flex items-center justify-between p-3 rounded-lg cursor-pointer transition-all hover:bg-accent/50',
+ currentDatePickerType === PublishDatePickerType.DATE && 'bg-primary/10',
+ )}
+ onClick={() => handleSelectPublishType(PublishDatePickerType.DATE)}
+ >
+ <div className="flex items-center gap-3 flex-1">
+ <Clock
+ className={cn(
+ 'w-[18px] h-[18px] text-muted-foreground',
+ currentDatePickerType === PublishDatePickerType.DATE && 'text-primary',
+ )}
+ />
+ <div className="flex flex-col gap-0.5">
+ <div
+ className={cn(
+ 'text-sm font-medium leading-tight',
+ currentDatePickerType === PublishDatePickerType.DATE && 'text-primary',
+ )}
+ >
+ {t('buttons.setDateTime')}
</div>
- </div>
- <div className={styles.menuItemRight}>
- <Button
- type="text"
- size="small"
- title={t('buttons.defaultPublishAction')}
- icon={defaultCurrentDatePickerType === PublishDatePickerType.DATE ? <StarFilled /> : <StarOutlined />}
- onClick={(e) => {
- e.stopPropagation()
- handleToggleFavorite(PublishDatePickerType.DATE)
- }}
- />
+ <div className="text-xs text-muted-foreground leading-tight">{t('buttons.schedulePublishDesc')}</div>
</div>
</div>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="h-8 w-8 p-0"
+ title={t('buttons.defaultPublishAction')}
+ onClick={e => {
+ e.stopPropagation()
+ handleToggleFavorite(PublishDatePickerType.DATE)
+ }}
+ >
+ <Star
+ className={cn(
+ 'w-4 h-4',
+ defaultCurrentDatePickerType === PublishDatePickerType.DATE
+ ? 'fill-primary text-primary'
+ : 'text-muted-foreground',
+ )}
+ />
+ </Button>
</div>
- )
+ </div>
+ )
- // 日期选择器内容
- const datePickerContent = (
- <div className={styles.datePickerContent}>
- <DatePicker
- showTime={{ format: 'HH:mm' }}
- format="YYYY-MM-DD HH:mm"
- value={tempDate}
- onCalendarChange={handleCalendarChange}
- disabledDate={disabledDate}
- disabledTime={disabledDateTime}
- showNow={false}
- renderExtraFooter={() => (
- <div className={styles.datePickerFooter}>
- <Button
- type="text"
- size="small"
- icon={<ArrowLeftOutlined />}
- onClick={handleBackToMenu}
- >
- {t('buttons.morePostingActions')}
- </Button>
+ // 日期选择器内容
+ const datePickerContent = (
+ <div className="w-[400px]">
+ <DateTimePicker
+ value={tempDate}
+ onChange={handleCalendarChange}
+ disabledDate={disabledDate}
+ disabledTime={disabledDateTime}
+ />
- <Button
- type="text"
- size="small"
- onClick={handleConfirm}
- icon={<CheckOutlined />}
- >
- {t('buttons.confirm')}
- </Button>
- </div>
- )}
- open
- getPopupContainer={trigger => trigger.parentElement || document.body}
- />
+ <div className="flex items-center justify-between py-2.5 px-4 border-t border-border">
+ <Button variant="ghost" size="sm" onClick={handleBackToMenu} className="gap-2">
+ <ArrowLeft className="w-4 h-4" />
+ {t('buttons.morePostingActions')}
+ </Button>
+
+ <Button variant="ghost" size="sm" onClick={handleConfirm} className="gap-2">
+ <Check className="w-4 h-4" />
+ {t('buttons.confirm')}
+ </Button>
</div>
- )
+ </div>
+ )
- return (
- <Space.Compact size="large">
- <Popover
- rootClassName={styles.publishDatePicker}
- open={menuOpen}
- content={showMenu ? menuContent : datePickerContent}
- trigger="click"
- onOpenChange={handleOpenChange}
- arrow={false}
- styles={{ body: { padding: 0 } }}
- >
+ return (
+ <div className="flex gap-0">
+ <Popover open={menuOpen} onOpenChange={handleOpenChange}>
+ <PopoverTrigger asChild>
<Button
- style={{ margin: '0', display: 'flex', alignItems: 'center', gap: '10px' }}
+ variant="outline"
+ className="flex items-center gap-2.5 rounded-r-none border-r-0 h-10 px-4"
onClick={() => {
setMenuOpen(true)
}}
>
- {
- currentDatePickerType === PublishDatePickerType.Now
- ? <SendOutlined style={{ fontSize: '16px' }} />
- : <ClockCircleOutlined style={{ fontSize: '16px' }} />
- }
- <span style={{ flex: 1, textAlign: 'left' }}>
+ {currentDatePickerType === PublishDatePickerType.Now ? (
+ <Send className="w-4 h-4" />
+ ) : (
+ <Clock className="w-4 h-4" />
+ )}
+ <span className="flex-1 text-left">
{currentDatePickerType === PublishDatePickerType.Now
? t('buttons.publishNow')
: pubTimeValue
? pubTimeValue.format('YYYY-MM-DD HH:mm')
: t('buttons.schedulePublish')}
</span>
- <DownOutlined style={{ fontSize: '16px' }} />
+ <ChevronDown className="w-4 h-4" />
</Button>
- </Popover>
- <Button
- size="large"
- type="primary"
- loading={loading}
- onClick={() => {
- onClick()
- }}
- >
- {t('buttons.schedulePublish')}
- </Button>
- </Space.Compact>
- )
- },
- ),
+ </PopoverTrigger>
+ <PopoverContent className="w-auto p-0" align="start">
+ {showMenu ? menuContent : datePickerContent}
+ </PopoverContent>
+ </Popover>
+ <Button className="rounded-l-none h-10 px-6" disabled={loading} onClick={() => onClick()}>
+ {loading && (
+ <svg
+ className="animate-spin -ml-1 mr-2 h-4 w-4"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 24 24"
+ >
+ <circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
+ <path
+ className="opacity-75"
+ fill="currentColor"
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
+ ></path>
+ </svg>
+ )}
+ {t('buttons.schedulePublish')}
+ </Button>
+ </div>
+ )
+ }),
)
+PublishDatePicker.displayName = 'PublishDatePicker'
+
export default PublishDatePicker
diff --git a/project/web/src/components/PublishDialog/compoents/PublishDatePicker/publishDatePicker.module.scss b/project/web/src/components/PublishDialog/compoents/PublishDatePicker/publishDatePicker.module.scss
deleted file mode 100644
index 771ce634..00000000
--- a/project/web/src/components/PublishDialog/compoents/PublishDatePicker/publishDatePicker.module.scss
+++ /dev/null
@@ -1,112 +0,0 @@
-.publishDatePicker {
- :global {
- .ant-popover-inner {
- padding: 0;
- }
- }
-}
-
-.menuContent {
- min-width: 280px;
- padding: 12px;
- gap: 3px;
- display: flex;
- flex-direction: column;
-}
-
-.menuItem {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 12px;
- cursor: pointer;
- transition: all 0.2s;
- position: relative;
- border-radius: 6px;
-
- &:hover {
- background-color: var(--grayColor1);
- }
-
- &.menuItemActive {
- background-color: var(--primary-light);
-
- .menuIcon {
- color: var(--primary-color);
- }
-
- .menuItemTitle {
- color: var(--primary-color);
- }
- }
-}
-
-.menuItemLeft {
- display: flex;
- align-items: center;
- gap: 12px;
- flex: 1;
-
- span {
- font-size: var(--fs-sm);
- }
-}
-
-.menuItemText {
- display: flex;
- flex-direction: column;
- gap: 2px;
-}
-
-.menuItemTitle {
- font-size: var(--fs-sm);
- font-weight: 500;
- line-height: 1.4;
-}
-
-.menuItemDesc {
- font-size: 12px;
- color: var(--text-secondary);
- line-height: 1.4;
-}
-
-.menuItemRight {
- display: flex;
- align-items: center;
- gap: 8px;
-}
-
-.menuIcon {
- font-size: 18px;
- color: var(--text-secondary);
-}
-
-.datePickerContent {
- :global {
- .ant-picker {
- display: none;
- .ant-picker-panel-container {
- box-shadow: none;
- }
- }
-
- .ant-picker-dropdown {
- position: static !important;
- }
-
- .ant-picker-ranges {
- display: none !important;
- }
- }
-}
-
-.datePickerFooter {
- justify-content: space-between;
- padding: 10px 0;
- display: flex;
- :global {
- .ant-btn {
- padding: 15px 10px;
- }
- }
-}
\ No newline at end of file
diff --git a/project/web/src/components/PublishDialog/compoents/PublishDialogAi.tsx b/project/web/src/components/PublishDialog/compoents/PublishDialogAi.tsx
index a509df63..c0037c5f 100644
--- a/project/web/src/components/PublishDialog/compoents/PublishDialogAi.tsx
+++ b/project/web/src/components/PublishDialog/compoents/PublishDialogAi.tsx
@@ -29,7 +29,6 @@ import { uploadToOss } from '@/api/oss'
import { formatImg, VideoGrabFrame } from '@/components/PublishDialog/PublishDialog.util'
import type { IImgFile, IVideoFile } from '@/components/PublishDialog/publishDialog.type'
import { getOssUrl } from '@/utils/oss'
-import { OSS_URL } from '@/constant'
import styles from '../publishDialog.module.scss'
@@ -756,7 +755,7 @@ const PublishDialogAi = memo(
try {
// Upload to OSS
const ossKey = await uploadToOss(file)
- const ossUrl = `${OSS_URL}${ossKey}`
+ const ossUrl = `${getOssUrl(ossKey)}`
// Update with OSS URL
setUploadedImage({ file, preview, ossUrl, uploading: false })
@@ -963,7 +962,7 @@ const PublishDialogAi = memo(
// Convert relative path to full S3 URL for publishing
// API returns: ai/video/sora-2/...
// Publishing expects: https://aitoearn.s3.ap-southeast-1.amazonaws.com/ai/video/...
- const ossUrl = `${OSS_URL}${url}`
+ const ossUrl = `${getOssUrl(url)}`
const filename = `ai-generated-video.mp4`
// Extract video info using proxy URL for preview (only for VideoGrabFrame)
diff --git a/project/web/src/components/PublishDialog/compoents/PublishManageUpload/usePublishManageUpload.ts b/project/web/src/components/PublishDialog/compoents/PublishManageUpload/usePublishManageUpload.ts
index 99e8c60c..e33d753a 100644
--- a/project/web/src/components/PublishDialog/compoents/PublishManageUpload/usePublishManageUpload.ts
+++ b/project/web/src/components/PublishDialog/compoents/PublishManageUpload/usePublishManageUpload.ts
@@ -15,8 +15,8 @@ import {
createTaskId,
isAbortError,
} from '@/components/PublishDialog/compoents/PublishManageUpload/usePublishManageUpload.utils'
-import { OSS_URL } from '@/constant'
import { UploadTaskStatusEnum } from './publishManageUpload.enum'
+import { getOssUrl } from '@/utils/oss'
// 仅定义状态形状,方法类型走类型推断
const initialState: IPublishManageUploadState = {
@@ -109,7 +109,7 @@ export const usePublishManageUpload = create(
runtime!.completed = true
const result: UploadCacheItem = {
ossKey,
- ossUrl: `${OSS_URL}${ossKey}`,
+ ossUrl: `${getOssUrl(ossKey)}`,
}
set(state => ({
diff --git a/project/web/src/components/PublishDialog/index.tsx b/project/web/src/components/PublishDialog/index.tsx
index 89bc36fd..6aad4278 100644
--- a/project/web/src/components/PublishDialog/index.tsx
+++ b/project/web/src/components/PublishDialog/index.tsx
@@ -550,6 +550,7 @@ const PublishDialog = memo(
content: t('confirmClose.content'),
okType: 'destructive',
centered: true,
+ cancelText: t('buttons.cancel'),
onOk() {
onClose()
},
diff --git a/project/web/src/components/PublishDialog/publishDialog.module.scss b/project/web/src/components/PublishDialog/publishDialog.module.scss
index 488b4447..186702a4 100644
--- a/project/web/src/components/PublishDialog/publishDialog.module.scss
+++ b/project/web/src/components/PublishDialog/publishDialog.module.scss
@@ -132,7 +132,7 @@ $assistantWidth: 380px;
justify-content: right;
gap: 12px;
- button {
+ & > button {
margin-right: 10px;
}
}
diff --git a/project/web/src/components/ui/modal.tsx b/project/web/src/components/ui/modal.tsx
index cf68dda5..be3ce9bd 100644
--- a/project/web/src/components/ui/modal.tsx
+++ b/project/web/src/components/ui/modal.tsx
@@ -156,7 +156,7 @@ export const Modal: React.FC<ModalProps> = ({
)}
{shouldRenderContent && (
- <div className={cn('flex-1 overflow-auto py-2', bodyClassName)}>
+ <div className={cn('flex-1 py-2 flex', bodyClassName)}>
{children}
</div>
)}
diff --git a/project/web/src/components/ui/scroll-area.tsx b/project/web/src/components/ui/scroll-area.tsx
new file mode 100644
index 00000000..cf253cf1
--- /dev/null
+++ b/project/web/src/components/ui/scroll-area.tsx
@@ -0,0 +1,46 @@
+import * as React from "react"
+import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
+
+import { cn } from "@/lib/utils"
+
+const ScrollArea = React.forwardRef<
+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
+>(({ className, children, ...props }, ref) => (
+ <ScrollAreaPrimitive.Root
+ ref={ref}
+ className={cn("relative overflow-hidden", className)}
+ {...props}
+ >
+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
+ {children}
+ </ScrollAreaPrimitive.Viewport>
+ <ScrollBar />
+ <ScrollAreaPrimitive.Corner />
+ </ScrollAreaPrimitive.Root>
+))
+ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
+
+const ScrollBar = React.forwardRef<
+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
+>(({ className, orientation = "vertical", ...props }, ref) => (
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
+ ref={ref}
+ orientation={orientation}
+ className={cn(
+ "flex touch-none select-none transition-colors",
+ orientation === "vertical" &&
+ "h-full w-2.5 border-l border-l-transparent p-[1px]",
+ orientation === "horizontal" &&
+ "h-2.5 flex-col border-t border-t-transparent p-[1px]",
+ className
+ )}
+ {...props}
+ >
+ <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
+))
+ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
+
+export { ScrollArea, ScrollBar }