feat(title): 标题预览改为叠加在视频画面上 #1234

Merged
xiaoxia merged 3 commits from fix/title-preview-overlay into develop 2026-08-04 14:21:49 +08:00
Owner

修改内容

修改 PreviewVideoPanel.tsx,将标题预览从「视频下方独立区域」改为「叠加在视频画面上」。

具体改动

  • positionOverlayStyle 替代原 positionAlignStyle,返回 absolute 定位样式
    • top: 距顶部 16px
    • center: top 50% + translateY(-50%)
    • bottom: 距底部 56px(给视频控制条留空间)
  • 视频容器改为 position: relative,标题用 position: absolute 叠加
  • 标题设置 width: 100% + zIndex: 1 + pointerEvents: none(不阻挡视频控件)
  • 复用 buildTitleStyle,字号/颜色/描边/阴影效果不变
  • 无视频时(idle/loading/error)标题预览仍独立显示兜底

影响范围

  • 仅 PreviewVideoPanel.tsx 一个文件
  • 不影响 Step4 标题设置逻辑,仅改展示方式
## 修改内容 修改 PreviewVideoPanel.tsx,将标题预览从「视频下方独立区域」改为「叠加在视频画面上」。 ### 具体改动 - `positionOverlayStyle` 替代原 `positionAlignStyle`,返回 absolute 定位样式 - top: 距顶部 16px - center: top 50% + translateY(-50%) - bottom: 距底部 56px(给视频控制条留空间) - 视频容器改为 `position: relative`,标题用 `position: absolute` 叠加 - 标题设置 `width: 100%` + `zIndex: 1` + `pointerEvents: none`(不阻挡视频控件) - 复用 `buildTitleStyle`,字号/颜色/描边/阴影效果不变 - 无视频时(idle/loading/error)标题预览仍独立显示兜底 ### 影响范围 - 仅 PreviewVideoPanel.tsx 一个文件 - 不影响 Step4 标题设置逻辑,仅改展示方式
xiaoxia added 2 commits 2026-08-04 14:05:51 +08:00
feat(title): 标题预览改为叠加在视频画面上,支持top/center/bottom定位
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 30s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 44s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 41s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m13s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m41s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m40s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 1m28s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m3s
AI Code Review / AI Code Review (pull_request) Failing after 2m3s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m55s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 4m25s
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Failing after 5s
8120d1c5a3

🚀 预览环境已部署

项目 详情
PR号 #1234
预览链接 https://pr-1234.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1234 | | 预览链接 | [https://pr-1234.preview.xiaoxiajianji.com](https://pr-1234.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
xiaoxia scheduled this pull request to auto merge when all checks succeed 2026-08-04 14:13:53 +08:00
xiaoxia added 1 commit 2026-08-04 14:17:42 +08:00
style: fix prettier formatting for PreviewVideoPanel.tsx
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 40s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 43s
CI/CD Pipeline / PR Build API Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 57s
AI Code Review / AI Code Review (pull_request) Successful in 1m45s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m44s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m46s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m13s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m31s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m36s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m18s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 3m59s
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 5s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 37s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 47s
0b8f8dd18c
Collaborator

代码审查结果 - PR #1234

⚠️ 问题(2个需要修改)

  1. PreviewVideoPanel.tsx 第159行:逻辑错误,无视频预览时忽略了用户的垂直对齐设置。
    • !hasPreview 分支中,容器的 justifyContent 被硬编码为 "center",而旧代码使用了 positionAlignStyle 来应用用户的设置(top/center/bottom)。这导致用户在生成视频前无法正确预览标题在顶部或底部的效果,造成预览行为与实际生成结果不一致。
  2. PreviewVideoPanel.tsx 第134、142行:潜在的空指针引用风险。
    • 代码中使用了非空断言操作符 titleSettings!。虽然 showTitlePreview 为 true 时通常意味着配置存在,但如果 props 传递异常导致 titleSettingsundefined,这里会在运行时抛出 "Cannot read properties of undefined" 错误导致白屏。应使用可选链 titleSettings?. 或提供默认值以增强鲁棒性。

💡 建议(1个可选)

  1. 性能优化建议:建议将内联的 style 对象提取到组件外部或使用 useMemo 缓存。
    • 当前代码在每次组件渲染时都会重新创建 style 对象(如 { position: "relative" }{ background: "..." }),虽然 React diff 开销很小,但在高频渲染场景下会产生不必要的垃圾回收。提取为常量可优化内存分配。

格式检查通过 | 逻辑审查需修改 | 性能良好


🤖 由 AI 代码审查机器人自动生成 | 2026-08-04 06:19:21 | 模型:

## 代码审查结果 - PR #1234 ### ⚠️ 问题(2个需要修改) 1. **PreviewVideoPanel.tsx 第159行**:逻辑错误,无视频预览时忽略了用户的垂直对齐设置。 - 在 `!hasPreview` 分支中,容器的 `justifyContent` 被硬编码为 `"center"`,而旧代码使用了 `positionAlignStyle` 来应用用户的设置(`top`/`center`/`bottom`)。这导致用户在生成视频前无法正确预览标题在顶部或底部的效果,造成预览行为与实际生成结果不一致。 2. **PreviewVideoPanel.tsx 第134、142行**:潜在的空指针引用风险。 - 代码中使用了非空断言操作符 `titleSettings!`。虽然 `showTitlePreview` 为 true 时通常意味着配置存在,但如果 props 传递异常导致 `titleSettings` 为 `undefined`,这里会在运行时抛出 "Cannot read properties of undefined" 错误导致白屏。应使用可选链 `titleSettings?.` 或提供默认值以增强鲁棒性。 ### 💡 建议(1个可选) 1. **性能优化建议**:建议将内联的 style 对象提取到组件外部或使用 `useMemo` 缓存。 - 当前代码在每次组件渲染时都会重新创建 style 对象(如 `{ position: "relative" }` 和 `{ background: "..." }`),虽然 React diff 开销很小,但在高频渲染场景下会产生不必要的垃圾回收。提取为常量可优化内存分配。 --- ✅ 格式检查通过 | ❌ 逻辑审查需修改 | ✅ 性能良好 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-08-04 06:19:21 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->
auto-approve-bot approved these changes 2026-08-04 14:20:01 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
auto-approve-bot approved these changes 2026-08-04 14:20:01 +08:00
auto-approve-bot left a comment
Collaborator

CI全绿,自动审批通过。

CI全绿,自动审批通过。
xiaoxia merged commit dc38e494e7 into develop 2026-08-04 14:21:49 +08:00

🗑️ 预览环境已清理

PR #1234 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #1234 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Sign in to join this conversation.