Skip to content

Conversation

@knktc
Copy link
Owner

@knktc knktc commented Jun 24, 2025

No description provided.

Copilot AI review requested due to automatic review settings June 24, 2025 07:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a copy button to the request body area, along with localization entries and positioning adjustments.

  • Introduced new i18n keys for “copy” and “copied” in both English and Chinese.
  • Wrapped the body display in a relatively positioned container and added a copy button with icon and localized label.
  • Updated CSS classes to position the button at the top-right of the body block.
Comments suppressed due to low confidence (1)

templates/main.tmpl:218

  • New copy-button functionality is introduced here but lacks accompanying tests. Consider adding a UI or integration test to verify that clicking the button copies the correct text and updates the button label to “copied.”
                        <div class="relative">

<pre class="bg-gray-800 text-white p-4 rounded-md text-sm overflow-x-auto"><code>{{prettyPrintJson .SelectedRequest.Body}}</code></pre>
<div class="relative">
<pre id="body-text" class="bg-gray-800 text-white p-4 rounded-md text-sm overflow-x-auto"><code>{{prettyPrintJson .SelectedRequest.Body}}</code></pre>
<button id="copy-body-btn" class="absolute top-2 right-2 bg-blue-600 hover:bg-blue-700 text-white p-2 rounded-md text-xs transition-colors duration-200 flex items-center gap-1" title="复制正文内容">
Copy link

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

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

The button's title attribute is hard-coded in Chinese, even for the English locale. Consider using a data-i18n attribute or a dedicated locale key for the title to ensure proper translation.

Copilot uses AI. Check for mistakes.
<div class="relative">
<pre id="body-text" class="bg-gray-800 text-white p-4 rounded-md text-sm overflow-x-auto"><code>{{prettyPrintJson .SelectedRequest.Body}}</code></pre>
<button id="copy-body-btn" class="absolute top-2 right-2 bg-blue-600 hover:bg-blue-700 text-white p-2 rounded-md text-xs transition-colors duration-200 flex items-center gap-1" title="复制正文内容">
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
Copy link

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

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

The SVG is decorative and should include aria-hidden="true" (or role="img" with a proper title) so screen readers don’t announce it unnecessarily.

Copilot uses AI. Check for mistakes.
@knktc knktc merged commit c67d7d1 into main Jun 24, 2025
@knktc knktc deleted the add-copy-to-request-body branch July 25, 2025 09:10
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.

2 participants