Skip to content

Conversation

@jokester
Copy link
Member

@jokester jokester commented Sep 1, 2025

Summary by CodeRabbit

  • New Features

    • AI-powered “Auto Translate” for images/files via Moeflow Companion.
    • Runtime configuration support via a sample runtime config file.
  • UX Improvements

    • Project Files page: clearer target selection, loading spinner, and import-status gating before file actions.
    • Improved upload/translation UI texts; image viewer zoom labels changed to “Fit Width/Height”.
  • Localization

    • Reorganized i18n keys (moved site.* to project*/projectSet*), added new strings for Auto Translate, and refined selection texts.
  • Refactor

    • Consolidated and reorganized components/exports; API access namespaced.
  • Chores

    • Added Makefile tasks for locale generation/formatting, updated .gitignore, and removed an unused dependency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Introduces runtime-config-driven Moeflow Companion integration and reworks module structure. Adds Makefile tasks for locale generation, reorganizes component exports/paths, updates API surface (named api, namespaced calls), adjusts List API, refactors FileList flow, adds AI translate modal/hook, revises i18n keys/strings, and initializes runtime config at app startup.

Changes

Cohort / File(s) Summary
Tooling & Repo Meta
/.gitignore, /Makefile, /package.json, /public/moeflow-runtime-config.sample.json
Ignore runtime config; add Makefile targets for locale JSON generation/watch/format/build; remove @gradio/client from dependencies; add sample runtime config JSON (moeflowCompanion).
Runtime Config Integration
/src/configs.tsx, /src/index.tsx, /src/store/site/slice.ts
Export RuntimeConfig; load runtimeConfig at startup and dispatch setRuntimeConfig; extend SiteState (require osName/platform; add runtimeConfig); add setRuntimeConfig reducer/action.
API Surface & Services
/src/apis/index.ts, /src/services/ai/use_moeflow_companion.ts, /src/services/ai/multimodal_recognize.ts, /src/services/ai/TranslateCompanion.tsx, /src/services/ai/mit_preprocess.ts
Remove unused configs import; introduce Moeflow Companion hook/service (states, multimodalTranslate, TranslatedFile); add multimodal presets; adjust imports/paths; switch request imports to new locations.
Component Barrel Reorg
/src/components/index.ts
Large-scale re-exports moved into categorized folders (shared, shared-form, shared-member, project, project-list, project-set, team, dashboard); some exports removed; paths updated.
Shared List API Update
/src/components/shared/List.tsx
Add ListPageSpec interface; ListProps.onSearch now accepts ListPageSpec; update imports to aliases.
Project Files Feature Changes
/src/components/project/FileList.tsx, /src/components/project/FileListAiTranslate.tsx, /src/components/project/FileItem.tsx, /src/components/project/FileUploadProgress.tsx
FileList: switch to Redux runtimeConfig, MFile typing, new paging/load flow, refined FilePond handling, route change helper; add AI translate modal/hook integrating Moeflow; move CSS to constant in FileItem; alias imports cleanup.
Project/File UI Adjustments
/src/components/project-file/ImageSelect.tsx, /src/components/project-file/ImageViewer.tsx, /src/components/project-file/MovableLabel.tsx
Update imports to new barrels/paths; switch API usage to named api namespaces; add debug logger in ImageViewer; minor JSX tweak.
Pages Flow Changes
/src/pages/ProjectFiles.tsx, /src/pages/ImageTranslator.tsx, /src/pages/ProjectSet.tsx, /src/pages/Team.tsx, /src/pages/Dashboard.tsx, /src/pages/Login.tsx, /src/pages/Project.tsx, /src/pages/ProjectSetSetting.tsx
ProjectFiles: new guarded rendering (loading/target selector/content), target persistence, import-status gating; ImageTranslator: extract hotkeys/window-size into local hooks; update i18n keys and component paths; import path fixes.
Team/Project Set Lists & Forms
/src/components/team/*, /src/components/project-set/*, /src/components/project-list/*
Migrate to alias paths; switch API to named export with namespaced methods; minor label/i18n key updates; no logic changes except api call paths.
Shared/Shared-Form/Shared-Member
/src/components/shared/*, /src/components/shared-form/*, /src/components/shared-member/*, /src/components/setting/LocalePicker.tsx
Convert to alias imports; remove redundant React default imports; minor typing/path tweaks; no functional changes.
Locales & I18n
/src/locales/messages.yaml, /src/locales/en.json, /src/locales/zh-cn.json
Rename keys from site.* to project.* / projectSet.*; add fileList.aiTranslate and tip; adjust strings (Fit Width/Height, selection labels); punctuation mappings; Makefile supports generation.
Style & Typings
/src/style.ts, /src/store/project/sagas.ts, /src/store/projectSet/sagas.ts, /src/interfaces/file.ts, /src/components/shared/Movable.tsx
style default export gains const assertion; add explicit any types in sagas; comment docs in File interface; non-null assertion in Movable callback.
Misc/Unused
/src/components/unused/*
Update import paths to new structure; no logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant App as App Startup
  participant Cfg as runtimeConfig (async)
  participant Store as Redux Store
  participant I18n as i18n Init
  Note over App: mountApp()
  App->>Cfg: await runtimeConfig
  Cfg-->>App: RuntimeConfig
  App->>Store: dispatch setRuntimeConfig(config)
  App->>I18n: initialize()
  I18n-->>App: ready
  App-->>U: Render application
Loading
sequenceDiagram
  autonumber
  participant U as User
  participant FL as FileList
  participant Modal as AI Translate Modal
  participant Hook as useMoeflowCompanion
  participant Svc as Moeflow Companion Service
  participant API as Backend API
  Note over FL: User clicks "Auto Translate"
  FL->>Modal: openTranslateModal(files)
  Modal->>Hook: useMoeflowCompanion()
  Hook->>Svc: connect(gradioUrl, model)
  Svc-->>Hook: connected | disabled | disconnected
  alt connected
    loop files (constrained concurrency)
      Modal->>Svc: multimodalTranslate(blob, targetLang, model)
      Svc-->>Modal: translated blocks
      Modal->>API: create Source(s)
      API-->>Modal: source id(s)
      Modal->>API: create Translation(s)
      API-->>Modal: saved
      Modal-->>U: update status (done)
    end
    Modal-->>U: Enable OK button
  else disabled/disconnected
    Modal-->>U: Show inactive/failed statuses
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

In burrows of code I hop and weave,
New paths mapped out, imports reprieve.
Configs bloom at runtime’s dawn,
AI whispers, “translate on.”
Keys renamed, the pages sing—
Thump-thump! I ship the spring. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8ce4e53 and 6df8bf7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (103)
  • .gitignore (1 hunks)
  • Makefile (1 hunks)
  • package.json (0 hunks)
  • public/moeflow-runtime-config.sample.json (1 hunks)
  • src/apis/index.ts (1 hunks)
  • src/components/admin/AdminSiteSetting.tsx (1 hunks)
  • src/components/admin/AdminUserList.tsx (1 hunks)
  • src/components/dashboard/DashboardMenu.tsx (1 hunks)
  • src/components/index.ts (1 hunks)
  • src/components/project-file/ImageSelect.tsx (2 hunks)
  • src/components/project-file/ImageViewer.tsx (4 hunks)
  • src/components/project-file/MovableLabel.tsx (1 hunks)
  • src/components/project-list/ProjectItem.tsx (1 hunks)
  • src/components/project-list/ProjectList.tsx (1 hunks)
  • src/components/project-set/ProjectSetCreateForm.tsx (1 hunks)
  • src/components/project-set/ProjectSetEditForm.tsx (1 hunks)
  • src/components/project-set/ProjectSetList.tsx (1 hunks)
  • src/components/project-set/ProjectSetSettingBase.tsx (1 hunks)
  • src/components/project/FileItem.tsx (3 hunks)
  • src/components/project/FileList.tsx (16 hunks)
  • src/components/project/FileListAiTranslate.tsx (1 hunks)
  • src/components/project/FileUploadProgress.tsx (1 hunks)
  • src/components/project/LanguageSelect.tsx (1 hunks)
  • src/components/project/Output.tsx (1 hunks)
  • src/components/project/OutputList.tsx (1 hunks)
  • src/components/project/ProjectCreateForm.tsx (5 hunks)
  • src/components/project/ProjectImportForm.tsx (1 hunks)
  • src/components/project/ProjectSettingTarget.tsx (1 hunks)
  • src/components/project/ProjectTargetList.tsx (6 hunks)
  • src/components/setting/LocalePicker.tsx (1 hunks)
  • src/components/setting/UserBasicSettings.tsx (1 hunks)
  • src/components/shared-form/AuthFormWrapper.tsx (1 hunks)
  • src/components/shared-form/AuthLoginedTip.tsx (1 hunks)
  • src/components/shared-form/CAPTCHAInput.tsx (1 hunks)
  • src/components/shared-form/CAPTCHAModal.tsx (1 hunks)
  • src/components/shared-form/EmailVCodeInputItem.tsx (1 hunks)
  • src/components/shared-form/Form.tsx (1 hunks)
  • src/components/shared-form/FormItem.tsx (1 hunks)
  • src/components/shared-form/GroupJoinForm.tsx (1 hunks)
  • src/components/shared-form/MemberList.tsx (1 hunks)
  • src/components/shared-form/RoleRadioGroup.tsx (1 hunks)
  • src/components/shared-form/RoleSelect.tsx (1 hunks)
  • src/components/shared-form/TypeRadioGroup.tsx (1 hunks)
  • src/components/shared-form/UserEmailEditForm.tsx (1 hunks)
  • src/components/shared-form/UserPasswordEditForm.tsx (1 hunks)
  • src/components/shared-member/ApplicationList.tsx (2 hunks)
  • src/components/shared-member/InvitationList.tsx (1 hunks)
  • src/components/shared-member/InviteUser.tsx (1 hunks)
  • src/components/shared-member/UserInvitationList.tsx (1 hunks)
  • src/components/shared/Avatar.tsx (1 hunks)
  • src/components/shared/AvatarUpload.tsx (1 hunks)
  • src/components/shared/Button.tsx (1 hunks)
  • src/components/shared/Content.tsx (1 hunks)
  • src/components/shared/ContentItem.tsx (1 hunks)
  • src/components/shared/ContentTitle.tsx (1 hunks)
  • src/components/shared/DashboardBox.tsx (1 hunks)
  • src/components/shared/DebounceStatus.tsx (1 hunks)
  • src/components/shared/Dropdown.tsx (1 hunks)
  • src/components/shared/EmptyTip.tsx (1 hunks)
  • src/components/shared/Header.tsx (1 hunks)
  • src/components/shared/Label.tsx (1 hunks)
  • src/components/shared/List.tsx (2 hunks)
  • src/components/shared/ListItem.tsx (1 hunks)
  • src/components/shared/ListSearchInput.tsx (1 hunks)
  • src/components/shared/ListSkeletonItem.tsx (1 hunks)
  • src/components/shared/Movable.tsx (2 hunks)
  • src/components/shared/NavTab.tsx (1 hunks)
  • src/components/shared/NavTabs.tsx (1 hunks)
  • src/components/shared/Spin.tsx (1 hunks)
  • src/components/shared/TabBarM.tsx (1 hunks)
  • src/components/shared/Tooltip.tsx (1 hunks)
  • src/components/shared/TranslationProgress.tsx (1 hunks)
  • src/components/team/TeamCreateForm.tsx (1 hunks)
  • src/components/team/TeamEditForm.tsx (1 hunks)
  • src/components/team/TeamInsightProjectList.tsx (2 hunks)
  • src/components/team/TeamInsightUserList.tsx (1 hunks)
  • src/components/team/TeamList.tsx (2 hunks)
  • src/components/team/TeamSearchList.tsx (1 hunks)
  • src/components/team/TeamSettingBase.tsx (1 hunks)
  • src/components/unused/FileCover.tsx (1 hunks)
  • src/components/unused/ImageOCRProgress.tsx (1 hunks)
  • src/configs.tsx (2 hunks)
  • src/index.tsx (2 hunks)
  • src/interfaces/file.ts (1 hunks)
  • src/locales/en.json (6 hunks)
  • src/locales/messages.yaml (7 hunks)
  • src/locales/zh-cn.json (5 hunks)
  • src/pages/Dashboard.tsx (1 hunks)
  • src/pages/ImageTranslator.tsx (3 hunks)
  • src/pages/Login.tsx (1 hunks)
  • src/pages/Project.tsx (1 hunks)
  • src/pages/ProjectFiles.tsx (3 hunks)
  • src/pages/ProjectSet.tsx (5 hunks)
  • src/pages/ProjectSetSetting.tsx (1 hunks)
  • src/pages/Team.tsx (2 hunks)
  • src/services/ai/TranslateCompanion.tsx (1 hunks)
  • src/services/ai/mit_preprocess.ts (1 hunks)
  • src/services/ai/multimodal_recognize.ts (1 hunks)
  • src/services/ai/use_moeflow_companion.ts (1 hunks)
  • src/store/project/sagas.ts (1 hunks)
  • src/store/projectSet/sagas.ts (2 hunks)
  • src/store/site/slice.ts (3 hunks)
  • src/style.ts (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 1, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
3.2% Duplication on New Code (required ≤ 3%)
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@jokester jokester merged commit 6f2fe3b into moeflow-com:main Sep 1, 2025
2 of 3 checks passed
@jokester jokester deleted the organize-old-components branch September 1, 2025 16:53
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