Skip to content

Commit 16dc489

Browse files
Merge branch 'main' into fix/org
2 parents e22bd3c + 609a391 commit 16dc489

File tree

15 files changed

+145
-28
lines changed

15 files changed

+145
-28
lines changed

.storybook/handlers.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,37 @@ export const contributorsHandler = http.get('/api/contributors', () => {
5757
},
5858
])
5959
})
60+
61+
export const pdsUsersHandler = http.get('/api/atproto/pds-users', () => {
62+
return HttpResponse.json([
63+
{
64+
did: 'did:plc:mock0001',
65+
handle: 'patak.dog',
66+
displayName: 'Patak Dog',
67+
avatar:
68+
'https://cdn.bsky.app/img/avatar/plain/did:plc:zjfptjaegvgc7r2axkkyyzqn/bafkreihrcqhp575f6dph4uztbeyxfrmfnbv7x2gvovrgu4idgdsdw7wety',
69+
},
70+
{
71+
did: 'did:plc:mock0002',
72+
handle: 'patakllama.mockpmx.social',
73+
displayName: 'Patak Llama',
74+
avatar: 'https://api.dicebear.com/9.x/initials/svg?seed=llama',
75+
},
76+
{
77+
did: 'did:plc:mock0003',
78+
handle: 'patak.horse',
79+
displayName: 'Patak Horse',
80+
avatar:
81+
'https://cdn.bsky.app/img/avatar/plain/did:plc:vqh7id7sddkrfkhgt7tstlpd/bafkreifodkgqszgpt2qnoyljnbafokr6eujqwztj2kxo473adv5b57hjse',
82+
},
83+
{
84+
did: 'did:plc:mock0004',
85+
handle: 'patakcatapiller.mockpmx.social',
86+
},
87+
{
88+
did: 'did:plc:mock0005',
89+
handle: 'patakgoat.mockpmx.social',
90+
displayName: 'Patak Goat',
91+
},
92+
])
93+
})

app/components/Chart/SplitSparkline.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ const props = defineProps<{
3131
3232
const { locale } = useI18n()
3333
const colorMode = useColorMode()
34+
const numberFormatter = useNumberFormatter({
35+
maximumFractionDigits: 0,
36+
})
3437
const resolvedMode = shallowRef<'light' | 'dark'>('light')
3538
const rootEl = shallowRef<HTMLElement | null>(null)
3639
const palette = getPalette('')
@@ -153,6 +156,9 @@ const configs = computed(() => {
153156
fontSize: 24,
154157
bold: false,
155158
color: colors.value.fg,
159+
formatter: ({ value }) => {
160+
return numberFormatter.value.format(value)
161+
},
156162
datetimeFormatter: {
157163
enable: true,
158164
locale: locale.value,

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ function handleModalTransitioned() {
6060
}
6161
6262
const { fetchPackageDownloadEvolution } = useCharts()
63+
const numberFormatter = useNumberFormatter({
64+
maximumFractionDigits: 0,
65+
})
6366
6467
const { accentColors, selectedAccentColor } = useAccentColor()
6568
@@ -359,6 +362,9 @@ const config = computed<VueUiSparklineConfig>(() => {
359362
fontSize: 28,
360363
bold: false,
361364
color: colors.value.fg,
365+
formatter: ({ value }) => {
366+
return numberFormatter.value.format(value)
367+
},
362368
},
363369
line: {
364370
color: colors.value.borderHover,

app/components/Readme.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function handleClick(event: MouseEvent) {
8989
min-width: 0;
9090
/* Contain all children z-index values inside this container */
9191
isolation: isolate;
92+
contain: layout paint;
9293
}
9394
9495
/* README headings - styled by visual level (data-level), not semantic level */

app/components/Tab/Panel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const resolvedTabId = computed(() => getTabId(props.value))
2121

2222
<template>
2323
<div
24-
v-show="isSelected"
24+
v-if="isSelected"
2525
:id="resolvedPanelId"
2626
role="tabpanel"
2727
:aria-labelledby="resolvedTabId"

app/composables/npm/useAlgoliaSearch.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ export function useAlgoliaSearch() {
161161
}
162162
}
163163

164-
/** Fetch all packages for an owner using `owner.name` filter with pagination. */
165-
async function searchByOwner(
164+
/** Fetch all packages for a maintainer using `owners.name` filter with pagination. */
165+
async function searchByMaintainer(
166166
ownerName: string,
167167
options: { maxResults?: number } = {},
168168
): Promise<NpmSearchResponse> {
@@ -185,7 +185,7 @@ export function useAlgoliaSearch() {
185185
query: '',
186186
offset,
187187
length,
188-
filters: `owner.name:${ownerName}`,
188+
filters: `owners.name:${ownerName}`,
189189
analyticsTags: ['npmx.dev'],
190190
attributesToRetrieve: ATTRIBUTES_TO_RETRIEVE,
191191
attributesToHighlight: [],
@@ -314,7 +314,7 @@ export function useAlgoliaSearch() {
314314
requests.push({
315315
indexName,
316316
query: '',
317-
filters: `owner.name:${checks.name}`,
317+
filters: `owners.name:${checks.name}`,
318318
length: 1,
319319
analyticsTags: ['npmx.dev'],
320320
attributesToRetrieve: EXISTENCE_CHECK_ATTRS,
@@ -375,7 +375,7 @@ export function useAlgoliaSearch() {
375375
return {
376376
search,
377377
searchWithSuggestions,
378-
searchByOwner,
378+
searchByMaintainer,
379379
getPackagesByName,
380380
}
381381
}

app/composables/npm/useUserPackages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function useUserPackages(username: MaybeRefOrGetter<string>) {
2828
})
2929
// this is only used in npm path, but we need to extract it when the composable runs
3030
const { $npmRegistry } = useNuxtApp()
31-
const { searchByOwner } = useAlgoliaSearch()
31+
const { searchByMaintainer } = useAlgoliaSearch()
3232

3333
// --- Incremental loading state (npm path) ---
3434
const currentPage = shallowRef(1)
@@ -58,7 +58,7 @@ export function useUserPackages(username: MaybeRefOrGetter<string>) {
5858
// --- Algolia: fetch all at once ---
5959
if (provider === 'algolia') {
6060
try {
61-
const response = await searchByOwner(user)
61+
const response = await searchByMaintainer(user)
6262

6363
// Guard against stale response (user/provider changed during await)
6464
if (user !== toValue(username) || provider !== searchProviderValue.value) {

app/composables/useSelectedPackageManager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export const useSelectedPackageManager = createSharedComposable(
1212

1313
// Sync to data-pm attribute on the client
1414
if (import.meta.client) {
15+
const queryPM = new URLSearchParams(window.location.search).get('pm')
16+
if (queryPM && packageManagers.some(pm => pm.id === queryPM)) {
17+
pm.value = queryPM as PackageManagerId
18+
}
1519
// Watch for changes and update the attribute
1620
watch(
1721
pm,

app/composables/useSettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const DEFAULT_SETTINGS: AppSettings = {
7373
},
7474
chartFilter: {
7575
averageWindow: 0,
76-
smoothingTau: 1,
76+
smoothingTau: 0,
7777
anomaliesFixed: true,
7878
predictionPoints: 4,
7979
},

app/pages/pds.stories.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import Pds from './pds.vue'
2+
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
3+
import { pageDecorator } from '../../.storybook/decorators'
4+
import { pdsUsersHandler } from '../../.storybook/handlers'
5+
6+
const meta = {
7+
component: Pds,
8+
parameters: {
9+
layout: 'fullscreen',
10+
msw: {
11+
handlers: [pdsUsersHandler],
12+
},
13+
},
14+
decorators: [pageDecorator],
15+
} satisfies Meta<typeof Pds>
16+
17+
export default meta
18+
type Story = StoryObj<typeof meta>
19+
20+
/** `/api/atproto/pds-users` is intercepted by MSW so the community section displays both avatar images and text-only entries. */
21+
export const Default: Story = {}
22+
23+
/** Community section shows an empty/loading state with no API response. */
24+
export const WithoutUsers: Story = {
25+
parameters: {
26+
msw: {
27+
handlers: [],
28+
},
29+
},
30+
}

0 commit comments

Comments
 (0)