-
Notifications
You must be signed in to change notification settings - Fork 5
Add NPM Downloads page displaying weekly download statistics in compact centered list format #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
136486b
Initial plan
Copilot ddbed83
Add NPM Downloads page with shields.io badges
Copilot af0518e
Add click functionality to NPM package cards to open package URLs
Copilot 7281150
Convert NPM Downloads page to 2-column table layout
Copilot d1479e1
Convert NPM Downloads page to tight list format with adjacent package…
Copilot 5dd4053
Make NPM Downloads list compact and centered for improved readability
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| interface NpmDownloadsProps {} | ||
|
|
||
| // List of npm packages to display download counts for | ||
| const packages = [ | ||
| 'vite', | ||
| 'rolldown-vite', | ||
| 'rolldown', | ||
| 'tsdown', | ||
| 'oxlint', | ||
| 'oxc-parser', | ||
| 'oxc-transform', | ||
| 'oxc-minify', | ||
| 'oxc-resolver' | ||
| ]; | ||
|
|
||
| function NpmDownloads({}: NpmDownloadsProps) { | ||
| const handleCardClick = (packageName: string) => { | ||
| const npmUrl = `https://www.npmjs.com/package/${packageName}`; | ||
| window.open(npmUrl, '_blank', 'noopener,noreferrer'); | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <main className='dashboard-main'> | ||
| <div className='chart-container'> | ||
| <h2>NPM Weekly Downloads</h2> | ||
|
|
||
| <div className='npm-downloads-list-container'> | ||
| <ul className='npm-downloads-list'> | ||
| {packages.map((packageName) => ( | ||
| <li | ||
| key={packageName} | ||
| className='npm-download-item' | ||
| onClick={() => handleCardClick(packageName)} | ||
| role="button" | ||
| tabIndex={0} | ||
| onKeyDown={(e) => { | ||
| if (e.key === 'Enter' || e.key === ' ') { | ||
| e.preventDefault(); | ||
| handleCardClick(packageName); | ||
| } | ||
| }} | ||
| > | ||
| <span className='package-name'>{packageName}</span> | ||
| <img | ||
| className='download-badge' | ||
| src={`https://img.shields.io/npm/dw/${packageName}?label=npm`} | ||
| alt={`Weekly downloads for ${packageName}`} | ||
| loading="lazy" | ||
| /> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className='stats-grid'> | ||
| <div className='stat-card'> | ||
| <h3>Total Packages</h3> | ||
| <p className='stat-value'>{packages.length}</p> | ||
| <span className='stat-change positive'>NPM Packages</span> | ||
| </div> | ||
| <div className='stat-card'> | ||
| <h3>Registry</h3> | ||
| <p className='stat-value'>NPM</p> | ||
| <span className='stat-change positive'>Public Registry</span> | ||
| </div> | ||
| <div className='stat-card'> | ||
| <h3>Update Frequency</h3> | ||
| <p className='stat-value'>Weekly</p> | ||
| <span className='stat-change positive'>Auto Updated</span> | ||
| </div> | ||
| <div className='stat-card'> | ||
| <h3>Data Source</h3> | ||
| <p className='stat-value'>Shields.io</p> | ||
| <span className='stat-change positive'>Live Data</span> | ||
| </div> | ||
| </div> | ||
| </main> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export default NpmDownloads; | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { BarChart3 } from 'lucide-react'; | ||
| import NpmDownloads from '../NpmDownloads'; | ||
|
|
||
| function NpmDownloadsPage() { | ||
| return ( | ||
| <div className='dashboard'> | ||
| <header className='dashboard-header'> | ||
| <div className='header-content'> | ||
| <div className='logo'> | ||
| <BarChart3 size={28} /> | ||
| <h1>NPM Downloads</h1> | ||
| </div> | ||
| <p className='header-subtitle'> | ||
| Weekly download statistics for key packages | ||
| </p> | ||
| </div> | ||
| </header> | ||
|
|
||
| <NpmDownloads /> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default NpmDownloadsPage; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot when clicked on the card, open a new tab to the npm package url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added click functionality to NPM package cards. When clicked, cards now open the corresponding npm package URL (https://www.npmjs.com/package/{package-name}) in a new tab. Also added keyboard navigation support - you can Tab to focus on cards and press Enter or Space to activate them. Added visual feedback with hover effects and focus indicators for better accessibility.
Commit: af0518e