Skip to content

Fix: Resolve styled-components unknown prop warnings#227

Merged
mkdir700 merged 2 commits into
devfrom
fix/styled-components-unknown-props-warning
Oct 21, 2025
Merged

Fix: Resolve styled-components unknown prop warnings#227
mkdir700 merged 2 commits into
devfrom
fix/styled-components-unknown-props-warning

Conversation

@mkdir700
Copy link
Copy Markdown
Owner

@mkdir700 mkdir700 commented Oct 21, 2025

Background

Encountered styled-components warnings related to passing unknown props (gap, alignItems, isActive, justifyContent, flexDirection) to DOM elements. This often happens when props intended for styling are mistakenly rendered as HTML attributes.

Changes

  • src/renderer/src/components/Layout/index.ts:
    • Renamed layout-related props in BoxProps and StackProps interfaces to use the $ prefix, marking them as transient props (gap -> $gap, alignItems -> $alignItems, justifyContent -> $justifyContent, flexDirection -> $flexDirection).
    • Removed a duplicate gap property definition in the Box styled component.
  • src/renderer/src/pages/settings/AppearanceSettings.tsx:
    • Renamed the isActive prop in ColorCircle to $isActive.
    • Updated HStack usage to use transient props for gap and alignItems.
  • src/renderer/src/pages/settings/AboutSettings.tsx:
    • Updated HStack usage to use $alignItems.
  • src/renderer/src/pages/settings/ShortcutSettings.tsx:
    • Updated HStack usage to use $justifyContent.

Testing

  • Navigate to settings and verify no styled-components unknown prop warnings appear in the console.
  • Confirm all layout and styling props within settings pages are functioning as expected.

Summary by CodeRabbit

发布说明

重构

  • 统一优化了布局组件的属性命名规范,改进了代码的标准化程度。
  • 调整了多个界面组件中的属性使用方式,确保与新的命名规范同步。
  • 增强了代码结构的一致性,提升了整体的可维护性。

mkdir700 and others added 2 commits October 22, 2025 07:41
- Convert HStack layout props (gap, alignItems, justifyContent) to transient props with $ prefix
- Convert ColorCircle isActive prop to transient prop $isActive
- Update all usage across settings components to use transient props
- Remove duplicate gap property in Box component
- Build passes without styled-components warnings

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 21, 2025

Caution

Review failed

The pull request is closed.

总体概述

本次变更将Layout组件中的布局相关属性(gapjustifyContentalignItemsflexDirection)统一重命名为带$前缀的版本($gap$justifyContent$alignItems$flexDirection),并同步更新所有依赖组件的属性使用,遵循styled-components的样式属性命名规范。

变更内容

组件/文件 变更摘要
Layout组件属性重定义
src/renderer/src/components/Layout/index.ts
BoxProps中的gap属性重命名为$gap;StackProps中的justifyContentalignItemsflexDirection属性分别重命名为$justifyContent$alignItems$flexDirection;样式计算逻辑相应更新以引用新的$前缀属性
设置页面属性同步更新
src/renderer/src/pages/settings/AboutSettings.tsx, src/renderer/src/pages/settings/AppearanceSettings.tsx, src/renderer/src/pages/settings/ShortcutSettings.tsx
HStack组件中的alignItemsjustifyContentgap属性全部更新为$alignItems$justifyContent$gap;ColorCircle样式组件的isActive属性重命名为$isActive

估计代码审查工作量

🎯 2 (简单) | ⏱️ ~12 分钟

变更具有高度一致性和重复性,属于系统化的属性命名规范迁移。涉及文件相对分散但每个文件的改动遵循相同模式,不涉及复杂的业务逻辑或控制流变更,主要为机械性的属性名称替换。

庆祝诗

🐰 ✨
属性加上美元号,整洁划一新风采
styled-components的规范我们来遵守
从组件到页面,齐心协力大更新
代码更清爽,小兔子也开心呢!
🌟

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/styled-components-unknown-props-warning

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da67b83 and f98ed4d.

📒 Files selected for processing (4)
  • src/renderer/src/components/Layout/index.ts (4 hunks)
  • src/renderer/src/pages/settings/AboutSettings.tsx (1 hunks)
  • src/renderer/src/pages/settings/AppearanceSettings.tsx (3 hunks)
  • src/renderer/src/pages/settings/ShortcutSettings.tsx (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mkdir700 mkdir700 merged commit 035a31b into dev Oct 21, 2025
5 of 6 checks passed
@mkdir700 mkdir700 deleted the fix/styled-components-unknown-props-warning branch October 21, 2025 23:45
mkdir700 added a commit that referenced this pull request Oct 22, 2025
…tle translation (#228)

* ci(workflows): fix sync-release-to-gitcode.yml automatic triggering

Replace release event trigger with workflow_run mechanism to ensure reliable
automatic triggering after semantic-release creates GitHub releases.

- Change trigger from release event to workflow_run listening to Release workflow
- Add workflow_run event handling with GitHub API fetching
- Maintain backward compatibility and manual dispatch functionality
- Improve trigger type identification in summary display

This resolves the issue where semantic-release created releases
would not automatically trigger the GitCode sync workflow.

* fix: Resolve styled-components unknown prop warnings (#227)

* conductor-checkpoint-start

* fix(styled-components): resolve unknown props warnings in settings page

- Convert HStack layout props (gap, alignItems, justifyContent) to transient props with $ prefix
- Convert ColorCircle isActive prop to transient prop $isActive
- Update all usage across settings components to use transient props
- Remove duplicate gap property in Box component
- Build passes without styled-components warnings

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>

* feat(i18n): implement comprehensive subtitle translation service with Zhipu AI integration

- Add SubtitleTranslationService with batch processing and intelligent context handling
- Extend ConfigManager to support Zhipu API Key configuration with secure storage
- Refactor ASR settings page to "Subtitle Generation" with translation configuration group
- Add comprehensive TypeScript types for translation service interfaces
- Implement database layer support for batch subtitle translation updates
- Add IPC channel for API Key validation between frontend and backend
- Update dependencies with AI SDK packages for translation functionality
- Add OpenSpec specifications for config management, translation service, and UI integration
- Enable automatic background translation after subtitle generation
- Add comprehensive internationalization support for translation UI components

Key Features:
- Intelligent translation with video filename context and subtitle batching
- Automatic background translation without blocking main workflow
- Robust error handling with exponential backoff retry mechanism
- Comprehensive UI for API Key configuration and validation
- Full internationalization support in Chinese and English

Technical Improvements:
- Follow project conventions with styled-components and lucide-react icons
- Implement proper Zustand state management patterns
- Add comprehensive logging using loggerService
- Maintain type safety throughout the translation pipeline

* fix(db): resolve inaccurate error counting in updateSubtitleTranslations

Track subtitle ID processing status to ensure each translation item is counted exactly once, replacing the previous record-based counting logic.

Key improvements:
- Use Set<string> to track processed and failed subtitle IDs
- Count failures based on individual translation items rather than records
- Prevent double counting by tracking each subtitleId's processing state
- Provide detailed error messages with specific subtitle IDs
- Ensure successCount + failureCount equals input translations.length

This resolves the issue where successCount + failureCount could exceed the total number of input translations, making it difficult for callers to determine actual processing results.

* refactor: improve translation result type and options

- refine `TranslationOptions` to enforce `targetLanguage` as 'zh-CN'
- improve `TranslationResult` type using discriminated union for success/failure
- make `results` property in `TranslationBatchResult` readonly

* refactor(asr): move background translation task after completion

  - move startBackgroundTranslation after ASR process completion
  - ensure translation starts only after successful ASR and DB save

* refactor: enhance subtitle translation service

- add sourceLanguage option to translation results
- improve API key validation logic

* fix(types): resolve TranslationOptions type mismatch in ASRSubtitleService

Import TranslationOptions type and add explicit type annotation to fix TypeScript compilation error where targetLanguage string was incompatible with 'zh-CN' literal type.

* test: fix missing mock methods in test files

- Add getZhipuApiKey method to ConfigManager mocks in both test files
- Add debug method to LoggerService mock in ipc.database.test.ts
- Resolves TypeError: configManager.getZhipuApiKey is not a function
- Resolves TypeError: logger.debug is not a function
- All 665 tests now pass successfully

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant