发布

  • [issue-2801] [FE] Follow-up improvements for Prompt Version tags (#4476)

    frostbyte_neo 发布于 2025-12-19 09:39:34 +00:00

    • [issue-2801] [FE] Follow-up improvements for Prompt Version tags

    • Revision 2: Address Copilot review: Add text truncation to TagListTooltipContent to prevent layout issues with long user-generated tags

    • Revision 3: Address baz review: Fix separator dot logic to show for any tags, not just overflow

    • Revision 4: Improve tag display UX based on product feedback

    1. Show only hidden tags in tooltip (not all tags)

      • Modified useVisibleTags hook to return hiddenItems
      • Tooltip now displays only tags that are not visible inline
    2. Use bullet separator (•) instead of stacked tags

      • TagListTooltipContent now displays tags horizontally
      • Tags wrap naturally across multiple lines with bullets
    3. Remove tooltip title/header

      • Cleaner, more focused display showing just the tags
    4. Reduce gaps between tags

      • Changed gap-1.5 to gap-1 in ListCell
      • Changed gap-1 to gap-0.5 in CommitHistory
    5. Ensure proper text truncation with ellipsis

      • Added truncate class to inner span in ColoredTag
      • Added min-w-0 to container for proper overflow handling
      • Tags now show '...' when text is cut while preserving padding

    Files changed:

    • useVisibleTags.ts: Added hiddenItems to hook return
    • TagListTooltipContent.tsx: Simplified to show only hidden tags with bullets
    • ListCell.tsx: Pass hiddenItems instead of all items
    • CommitHistory.tsx: Pass hiddenItems, reduced gap
    • ColoredTag.tsx: Added proper truncation support
    • Revision 5: Extract VersionTags and VersionActions to separate files

    Address aadereiko's code review feedback to improve maintainability and
    component organization.

    Changes:

    • Extracted VersionTags component to separate file (VersionTags.tsx)
    • Extracted VersionActions component to separate file (VersionActions.tsx)
    • Moved separator dot out of VersionTags component (now peer element)
    • Simplified CommitHistory.tsx (from 188 to 95 lines)

    Rationale:

    • Better separation of concerns (dot is layout, not tag logic)
    • Improved file organization and readability
    • Makes components more reusable and testable
    • Follows single-file-per-component pattern
    • Reduces cognitive load when reading CommitHistory

    Benefits:

    • CommitHistory.tsx is now 49% smaller and easier to read
    • VersionTags is purely about tags (no layout concerns)
    • Each component can be tested independently
    • Better code organization for future maintenance
    • remainingCount as non negative
    下载附件