Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PatchNotes.Api/Routes/WatchlistRoutes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public static WebApplication MapWatchlistRoutes(this WebApplication app)
var packages = await db.Watchlists
.AsNoTracking()
.Where(w => w.UserId == user.Id)
.OrderBy(w => w.Package.GithubOwner).ThenBy(w => w.Package.GithubRepo)
.Select(w => new WatchlistPackageDto(
w.Package.Id,
w.Package.Name,
Expand Down
32 changes: 21 additions & 11 deletions patchnotes-web/src/pages/WatchlistPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,27 @@ export function WatchlistPage() {
</p>
</div>
) : (
(watchlist ?? []).map((pkg) => (
<WatchedPackageItem
key={pkg.id}
pkg={pkg}
onRemove={() => handleRemove(pkg.id)}
isRemoving={
removeFromWatchlist.isPending &&
removeFromWatchlist.variables === pkg.id
}
/>
))
[...(watchlist ?? [])]
.sort((a, b) => {
const nameA = (
a.npmName ?? `${a.githubOwner}/${a.githubRepo}`
).toLowerCase()
const nameB = (
b.npmName ?? `${b.githubOwner}/${b.githubRepo}`
).toLowerCase()
return nameA.localeCompare(nameB)
})
.map((pkg) => (
<WatchedPackageItem
key={pkg.id}
pkg={pkg}
onRemove={() => handleRemove(pkg.id)}
isRemoving={
removeFromWatchlist.isPending &&
removeFromWatchlist.variables === pkg.id
}
/>
))
)}
</Card>
</div>
Expand Down