-
-
Notifications
You must be signed in to change notification settings - Fork 432
feat: add a badge type for package likes #2478
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -496,6 +496,13 @@ const badgeStrategies = { | |
| color: isDeprecated ? COLORS.red : COLORS.green, | ||
| } | ||
| }, | ||
|
|
||
| 'likes': async (pkgData: globalThis.Packument) => { | ||
| const likesUtil = new PackageLikesUtils() | ||
| const { totalLikes } = await likesUtil.getLikes(pkgData.name) | ||
|
|
||
| return { label: 'likes', value: String(totalLikes ?? 0), color: COLORS.blue } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the default colour should be red? 👀 We could use the same colour that we do on the frontend
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only reason I suggested the frontend one was an attempt at distinguishing from other badges that use red to indicate a failure - but I think we could change this in a follow up if necessary |
||
| }, | ||
| } | ||
|
|
||
| const BadgeTypeSchema = v.picklist(Object.keys(badgeStrategies) as [string, ...string[]]) | ||
|
|
||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 344
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 676
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 43
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 43
Add missing import for
PackageLikesUtilsto fix type-checking error.Line 501 instantiates
PackageLikesUtils, but the file does not import it. Add the following import to resolve the unresolved symbol:import { handleApiError } from '#server/utils/error-handler' +import { PackageLikesUtils } from '#server/utils/atproto/utils/likes'📝 Committable suggestion