Skip to content

Conversation

@miraserver
Copy link

@miraserver miraserver commented Jan 3, 2026

Summary

  • Fix virtualizer row overlap on filter change by deferring measure to next frame
  • Make provider/sensitive-words/error-rules dialogs scrollable with fixed header/footer
  • Add autocomplete suggestions for Provider Group field
  • Fix hardcoded Chinese strings in provider forms (i18n)
  • Remove duplicate addProvider keys in settings.json (en, ja, ru, zh-TW)
  • Prevent URL validation error during provider URL input

Related Issues

Changes

Core Changes

  • Virtualizer fix (user-management-table.tsx:262-268): Defer rowVirtualizer.measure() to next frame using requestAnimationFrame to prevent row overlap when filter changes
  • Scrollable dialogs (provider/error-rules/sensitive-words): Applied fixed header/footer pattern with scrollable content area for better UX on smaller screens
  • Provider Group autocomplete (provider-form.tsx:236-242): Fetch existing provider groups and show as autocomplete suggestions
  • i18n fixes (api-test-button.tsx, provider-form.tsx): Replace hardcoded Chinese strings with translation keys for timeout, geminiAuthFallback, and cacheTtl sections
  • URL validation (url.ts:512-519): Add early validation in previewProxyUrls() to prevent "Invalid URL" error during typing

Supporting Changes

  • Add translations for new i18n keys across all 5 locales (en, ja, ru, zh-CN, zh-TW)
  • Remove duplicate addProvider translation keys from settings.json files
  • Auto-format code changes

Test plan

  • Open provider add/edit dialog → verify scrollable content with visible Save/Cancel buttons
  • Open sensitive words add/edit dialog → verify scrollable and buttons visible
  • Open error rules add/edit dialog → verify scrollable and buttons visible
  • In provider form, type in Provider Group field → verify autocomplete suggestions appear
  • Filter users table rapidly → verify no row overlap glitches
  • Switch locale to ru/ja/zh-TW → verify no "addProvider" key errors in console

Description enhanced by Claude AI

John Doe and others added 8 commits January 3, 2026 01:17
…hange

Use requestAnimationFrame to delay rowVirtualizer.measure() call,
ensuring DOM has updated before recalculating row positions.
This fixes table rows overlapping when switching status filter.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add max-height constraint and flex layout to error-rules dialogs
to keep save/cancel buttons and close icon visible when content
exceeds viewport height. Mirrors the pattern used in request-filters.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add max-height constraint and flex layout to sensitive-words dialogs
to keep save/cancel buttons and close icon visible when content
exceeds viewport height.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add missing translations for timeout, geminiAuthFallback, and cacheTtl
sections in provider form components.

Changes:
- api-test-button.tsx: Replace Chinese timeout labels and Gemini auth
  fallback warning with t() calls
- provider-form.tsx: Replace Chinese Cache TTL labels with t() calls
- Add translations to all 5 locales (EN, RU, JA, ZH-CN, ZH-TW)

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Move Provider Group field to after Provider Type (before Forward client IP)
- Add autocomplete suggestions from existing provider groups
- Fetch groups via getDistinctProviderGroupsAction on component mount
- Keep ability to enter new custom groups via TagInput

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Apply the same scrollable layout pattern from Request Filters dialog
to provider add/edit/clone dialogs:

- Fixed header (DialogHeader with flex-shrink-0)
- Scrollable content area (overflow-y-auto flex-1)
- Fixed footer with action buttons (DialogFooter with flex-shrink-0)

This improves UX on smaller screens where provider forms are tall.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add early URL validation in previewProxyUrls() to prevent "Invalid URL"
error when user is typing an incomplete URL in the provider form.

The error was thrown by new URL() constructor before the try-catch
could handle it gracefully in development mode.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Remove duplicate 'addProvider' keys that were erroneously added to the end
of settings.json files in en, ja, ru, and zh-TW locales.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@gemini-code-assist
Copy link

Summary of Changes

Hello @miraserver, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user experience and internationalization capabilities of the admin interface. It tackles common UI frustrations like content overflow in dialogs and virtualizer glitches, while also ensuring the application is more robust against invalid inputs and better localized for various languages. The changes aim to make the admin panel more intuitive and reliable for users worldwide.

Highlights

  • Improved Dialog UX: Admin dialogs for providers, sensitive words, and error rules are now scrollable with fixed headers and footers, preventing content overlap and ensuring 'Save/Cancel' buttons are always visible, especially on smaller screens or with extensive content.
  • Virtualizer Row Overlap Fix: Resolved an issue where virtualized table rows would overlap when filters changed rapidly by deferring the row measurement to the next animation frame, ensuring proper layout updates.
  • Provider Group Autocomplete: Added autocomplete suggestions to the 'Provider Group' field in provider forms, drawing from existing provider groups to enhance usability and consistency.
  • Internationalization (i18n) Enhancements: Addressed several i18n issues, including replacing hardcoded Chinese strings with localized keys for timeout and Gemini authentication fallback messages, and removing duplicate 'addProvider' keys across various language files.
  • Robust URL Validation: Implemented a try-catch block for URL validation during proxy URL preview generation, preventing potential application crashes when an invalid URL is entered.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions bot added bug Something isn't working area:UI area:i18n area:UX size/XL Extra Large PR (> 1000 lines) labels Jan 3, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily focuses on internationalizing UI elements, enhancing user experience with scrollable dialogs, and improving the provider management features. Specifically, new translation keys were added across multiple language files for API timeout settings, Gemini authentication fallback warnings, and prompt cache TTL overrides. The ApiTestButton and ProviderForm components were updated to use these new translation keys, replacing hardcoded Chinese strings. The ProviderForm also gained the ability to fetch and suggest existing provider groups for the group tag input, and its layout was refactored to ensure the header and footer remain visible while the content scrolls. Similar scrollable dialog patterns were applied to AddRuleDialog, EditRuleDialog, AddProviderDialog, ProviderRichListItem (for edit/clone dialogs), AddWordDialog, and EditWordDialog components. An optimization was introduced in UserManagementTable to defer rowVirtualizer.measure() to the next animation frame for better rendering performance. Additionally, url.ts was updated to include a try-catch block for URL validation in previewProxyUrls to prevent exceptions. Review comments highlighted the need to translate Chinese comments into English for consistency and to add error handling for the getDistinctProviderGroupsAction promise in ProviderForm.

Comment on lines 237 to 243
useEffect(() => {
getDistinctProviderGroupsAction().then((res) => {
if (res.ok && res.data) {
setGroupSuggestions(res.data);
}
});
}, []);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment on line 236 is in Chinese. For consistency with the rest of the codebase, please use English for comments. Also, the promise returned by getDistinctProviderGroupsAction is not fully handled. It's good practice to handle the error case, for example by logging it to the console. This helps with debugging if the suggestions fail to load.

  // Fetch existing provider groups for suggestions
  useEffect(() => {
    getDistinctProviderGroupsAction().then((res) => {
      if (res.ok && res.data) {
        setGroupSuggestions(res.data);
      } else if (!res.ok) {
        console.error("Failed to fetch provider group suggestions:", res.error);
      }
    });
  }, []);

Comment on lines +98 to +104
// 验证 URL 格式有效性(防止 new URL() 抛出异常)
try {
new URL(baseUrl);
} catch {
// URL 无效,返回空预览
return previews;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comments here are in Chinese. To maintain consistency across the codebase, please write comments in English.

Suggested change
// 验证 URL 格式有效性(防止 new URL() 抛出异常)
try {
new URL(baseUrl);
} catch {
// URL 无效,返回空预览
return previews;
}
// Validate URL format to prevent `new URL()` from throwing an exception.
try {
new URL(baseUrl);
} catch {
// If the URL is invalid, return an empty preview object.
return previews;
}

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

This PR addresses multiple UI/UX improvements and i18n fixes for admin dialogs. The changes are well-structured and follow existing patterns in the codebase.

PR Size: XL

  • Lines changed: 2538
  • Files changed: 15

Split Suggestion: This PR mixes multiple concerns that could be split into smaller, more focused PRs:

  1. Dialog scrollability fixes (add-rule-dialog, edit-rule-dialog, add-provider-dialog, sensitive-words dialogs)
  2. Virtualizer row overlap fix (user-management-table.tsx)
  3. i18n updates (5 locale files)
  4. Provider form autocomplete feature
  5. URL validation fix

Issues Found

Category Critical High Medium Low
Logic/Bugs 0 0 0 0
Security 0 0 0 0
Error Handling 0 0 1 0
Types 0 0 0 0
Comments/Docs 0 0 0 0
Tests 0 0 0 0
Simplification 0 0 0 0

Medium Priority Issues (Should Fix)

1. Missing cleanup for requestAnimationFrame in user-management-table.tsx:262-266

  • Location: src/app/[locale]/dashboard/_components/user/user-management-table.tsx:266
  • Issue: The cleanup function returns the result of cancelAnimationFrame, which is undefined, instead of being a proper cleanup function
  • Impact: Minor memory leak potential - the RAF is cancelled but the return pattern is incorrect

Review Coverage

  • Logic and correctness - Clean
  • Security (OWASP Top 10) - Clean
  • Error handling - One minor issue found
  • Type safety - Clean
  • Documentation accuracy - Clean
  • Test coverage - Adequate (manual test plan provided)
  • Code clarity - Good

Notable Improvements

  • Fixed virtualizer row overlap issue with proper RAF timing
  • Made dialogs scrollable with fixed headers/footers (improves UX on small screens)
  • Removed duplicate i18n keys across multiple locales
  • Added autocomplete for Provider Group field
  • Fixed hardcoded Chinese strings in provider forms

Automated review by Claude AI

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

This PR addresses multiple UI/UX improvements and i18n fixes for admin dialogs. The changes are well-structured and follow existing patterns in the codebase.

PR Size: XL

  • Lines changed: 2538
  • Files changed: 15

Split Suggestion: This PR mixes multiple concerns that could be split into smaller, more focused PRs:

  1. Dialog scrollability fixes (add-rule-dialog, edit-rule-dialog, add-provider-dialog, sensitive-words dialogs)
  2. Virtualizer row overlap fix (user-management-table.tsx)
  3. i18n updates (5 locale files)
  4. Provider form autocomplete feature
  5. URL validation fix

Issues Found

Category Critical High Medium Low
Logic/Bugs 0 0 0 0
Security 0 0 0 0
Error Handling 0 0 1 0
Types 0 0 0 0
Comments/Docs 0 0 0 0
Tests 0 0 0 0
Simplification 0 0 0 0

Medium Priority Issues (Should Fix)

1. Incorrect cleanup function return pattern

File: src/app/[locale]/dashboard/_components/user/user-management-table.tsx:262-268

Current code:

useEffect(() => {
  if (\!scrollResetKey) return;
  parentRef.current?.scrollTo({ top: 0 });
  // Defer measurement to next frame to ensure DOM has updated
  const rafId = requestAnimationFrame(() => {
    rowVirtualizer.measure();
  });
  return () => cancelAnimationFrame(rafId);  // ⚠️ Issue here
}, [scrollResetKey, rowVirtualizer]);

Problem: The cleanup function returns the result of cancelAnimationFrame(rafId) (which is undefined). While this doesn't cause runtime errors, it's not the correct pattern for React cleanup functions.

Why this matters:

  • React cleanup functions should not return values
  • The current pattern is return () => cancelAnimationFrame(rafId) which executes the function and returns its result
  • This is subtly different from the intended pattern

Suggested fix:

return () => {
  cancelAnimationFrame(rafId);
};

Confidence Score: 82/100

  • ✅ Issue exists in NEW code (+30)
  • ✅ Can point to exact line (+20)
  • ✅ Violates React best practices (+20)
  • ✅ Affects code clarity (+10)
  • ⚠️ Low severity (code works but not optimal) (-8)

Review Coverage

  • Logic and correctness - Clean
  • Security (OWASP Top 10) - Clean
  • Error handling - One minor issue found
  • Type safety - Clean
  • Documentation accuracy - Clean
  • Test coverage - Adequate (manual test plan provided)
  • Code clarity - Good

Notable Improvements

  • ✅ Fixed virtualizer row overlap issue with proper RAF timing
  • ✅ Made dialogs scrollable with fixed headers/footers (improves UX on small screens)
  • ✅ Removed duplicate i18n keys across multiple locales
  • ✅ Added autocomplete for Provider Group field using getDistinctProviderGroupsAction
  • ✅ Fixed hardcoded Chinese strings in provider forms
  • ✅ Applied proper Flexbox layout to dialogs (flex flex-col) for consistent scroll behavior

Architectural Observations

  • The dialog refactoring follows a consistent pattern across all affected files
  • The use of flex-shrink-0 on headers/footers and overflow-y-auto on content is the correct approach
  • The virtualizer fix properly defers measurement to the next frame, avoiding race conditions

Automated review by Claude AI

Address PR review comment - add .catch() handler to prevent
unhandled promise rejection in getDistinctProviderGroupsAction.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@ding113 ding113 merged commit aadff85 into ding113:dev Jan 3, 2026
5 of 7 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Claude Code Hub Roadmap Jan 3, 2026
@github-actions github-actions bot mentioned this pull request Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:i18n area:UI area:UX bug Something isn't working size/XL Extra Large PR (> 1000 lines)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants