improvement(docs): added a copy page button to the docs pages#1743
Merged
waleedlatif1 merged 2 commits intostagingfrom Oct 27, 2025
Merged
improvement(docs): added a copy page button to the docs pages#1743waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Added a "Copy page" button to documentation pages that allows users to quickly copy the full page content (title, description, and body) to their clipboard. The button is positioned in the top-right corner of the page header and provides visual feedback when content is copied.
Key changes:
- Created new
CopyPageButtonclient component with copy-to-clipboard functionality and timeout-based state reset - Integrated button into docs page header using absolute positioning
- Button copies formatted markdown string containing page title, description, and content
- Follows existing patterns from
CodeBlockcomponent for copy functionality - Uses proper accessibility labels and error handling
Confidence Score: 4/5
- This PR is safe to merge with minor considerations
- The implementation is clean and follows established patterns in the codebase. The button component has proper error handling, accessibility labels, and state management. The only minor consideration is that
page.data.contentmay not be available for all page types, but this is handled with a fallback empty string. - No files require special attention - verify that the copy button appears correctly and the content format meets user expectations
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/docs/app/[lang]/[[...slug]]/page.tsx | 4/5 | Added copy page button to docs header with proper positioning and content formatting |
| apps/docs/components/ui/copy-page-button.tsx | 5/5 | Clean client-side button component with proper state management, error handling, and accessibility |
Sequence Diagram
sequenceDiagram
participant User
participant Browser
participant DocsPage
participant CopyPageButton
participant Clipboard
User->>Browser: Visits documentation page
Browser->>DocsPage: Render page component
DocsPage->>DocsPage: Load page.data (title, description, content)
DocsPage->>CopyPageButton: Render with formatted content string
CopyPageButton->>Browser: Display "Copy page" button
User->>CopyPageButton: Click copy button
CopyPageButton->>Clipboard: navigator.clipboard.writeText(content)
Clipboard-->>CopyPageButton: Success/Error
alt Copy successful
CopyPageButton->>CopyPageButton: setCopied(true)
CopyPageButton->>Browser: Display "Copied" with check icon
Note over CopyPageButton: Wait 2000ms
CopyPageButton->>CopyPageButton: setCopied(false)
CopyPageButton->>Browser: Display "Copy page" with copy icon
else Copy failed
CopyPageButton->>Browser: console.error('Failed to copy')
end
2 files reviewed, no comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
added a copy page button to the docs pages
Type of Change
Testing
Tested manually.
Checklist