Skip to content

Commit f959a57

Browse files
Merge branch 'main' into feat/mobile-bottom-bar-nav
2 parents 0dfb06e + 189a568 commit f959a57

8 files changed

Lines changed: 503 additions & 79 deletions

File tree

app/components/Readme.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,20 @@ function handleClick(event: MouseEvent) {
487487
summary {
488488
font-size: 1rem;
489489
color: var(--fg-muted);
490+
491+
/* Markdown often wraps headings/paragraphs inside <summary>, which
492+
forces them onto new lines. Inline them so the disclosure marker
493+
sits next to the label while preserving heading styles. */
494+
> h1,
495+
> h2,
496+
> h3,
497+
> h4,
498+
> h5,
499+
> h6,
500+
> p {
501+
display: inline;
502+
margin: 0;
503+
}
490504
}
491505
}
492506
</style>

app/error.stories.ts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import Error from './error.vue'
2+
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
3+
import type { NuxtError } from '#app'
4+
5+
const meta = {
6+
title: 'pages/error',
7+
component: Error,
8+
parameters: {
9+
layout: 'fullscreen',
10+
},
11+
} satisfies Meta<typeof Error>
12+
13+
export default meta
14+
type Story = StoryObj<typeof meta>
15+
16+
/** Package, org, or page not found. */
17+
export const NotFound: Story = {
18+
args: {
19+
error: {
20+
status: 404,
21+
} as NuxtError,
22+
},
23+
}
24+
25+
/** Unauthorized access - shown when authentication is required. */
26+
export const Unauthorized: Story = {
27+
args: {
28+
error: {
29+
status: 401,
30+
} as NuxtError,
31+
},
32+
}
33+
34+
/** Generic server error with default message. */
35+
export const ServerError: Story = {
36+
args: {
37+
error: {
38+
status: 500,
39+
} as NuxtError,
40+
},
41+
}
42+
43+
/** Service unavailable - occurs when external services (jsDelivr, npm registry) fail. */
44+
export const ServiceUnavailable: Story = {
45+
args: {
46+
error: {
47+
status: 503,
48+
} as NuxtError,
49+
},
50+
}
51+
52+
export const Teapot: Story = {
53+
args: {
54+
error: {
55+
status: 418,
56+
} as NuxtError,
57+
},
58+
}
59+
60+
/** Error with a message. */
61+
export const WithMessage: Story = {
62+
args: {
63+
error: {
64+
status: 404,
65+
message: 'The page you are looking for does not exist.',
66+
} as NuxtError,
67+
},
68+
}
69+
70+
/** Error with a detailed message to test text wrapping and layout. */
71+
export const LongMessage: Story = {
72+
args: {
73+
error: {
74+
status: 500,
75+
message:
76+
'Internal server error. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tristique ex ac nisi dapibus maximus. Curabitur feugiat lorem eros, sed eleifend purus facilisis at.',
77+
} as NuxtError,
78+
},
79+
}

app/pages/settings.stories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Settings from './settings.vue'
22
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
33
import { userEvent, expect } from 'storybook/test'
44
import { pageDecorator } from '../../.storybook/decorators'
5-
import { i18nStatusHandler } from '../storybook/mocks/handlers'
5+
import { i18nStatusHandler } from '../storybook/mocks/handlers/lunaria-status'
66

77
const meta = {
88
component: Settings,
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import TranslationStatus from './translation-status.vue'
2+
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
3+
import { pageDecorator } from '../../.storybook/decorators'
4+
import { i18nStatusHandler } from '../storybook/mocks/handlers/lunaria-status'
5+
6+
const meta = {
7+
component: TranslationStatus,
8+
parameters: {
9+
layout: 'fullscreen',
10+
msw: {
11+
handlers: [i18nStatusHandler],
12+
},
13+
},
14+
decorators: [pageDecorator],
15+
} satisfies Meta<typeof TranslationStatus>
16+
17+
export default meta
18+
type Story = StoryObj<typeof meta>
19+
20+
/** `/lunaria/status.json` is intercepted by MSW. Showing a variety of completion level translation statuses for a subset of locales. */
21+
export const Default: Story = {}
22+
23+
/** No API response — the fetch never succeeds so `fetchStatus` stays as `'pending'`. Shows skeleton blocks in the locale list and skeleton inlines in body text. */
24+
export const WithoutTranslationData: Story = {
25+
parameters: {
26+
msw: {
27+
handlers: [],
28+
},
29+
},
30+
}

app/storybook/mocks/handlers.ts

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -91,68 +91,3 @@ export const pdsUsersHandler = http.get('/api/atproto/pds-users', () => {
9191
},
9292
])
9393
})
94-
95-
export const i18nStatusHandler = http.get('/lunaria/status.json', () => {
96-
return HttpResponse.json({
97-
generatedAt: '2026-01-22T10:07:07.000Z',
98-
sourceLocale: {
99-
lang: 'en',
100-
label: 'English',
101-
totalKeys: 500,
102-
},
103-
locales: [
104-
{
105-
lang: 'en-GB',
106-
label: 'English (UK)',
107-
dir: 'ltr',
108-
totalKeys: 500,
109-
completedKeys: 423,
110-
percentComplete: 84,
111-
missingKeys: [
112-
'settings.background_themes.label',
113-
'settings.enable_graph_pulse_loop',
114-
'settings.enable_graph_pulse_loop_description',
115-
'settings.data_source.algolia_description',
116-
'settings.data_source.npm_description',
117-
'i18n.contribute_hint',
118-
'i18n.copy_keys',
119-
],
120-
githubEditUrl: 'https://github.com/npmx-dev/npmx.dev/edit/main/i18n/locales/en-GB.json',
121-
githubHistoryUrl:
122-
'https://github.com/npmx-dev/npmx.dev/commits/main/i18n/locales/en-GB.json',
123-
},
124-
{
125-
lang: 'fr-FR',
126-
label: 'Français',
127-
dir: 'ltr',
128-
totalKeys: 500,
129-
completedKeys: 423,
130-
percentComplete: 84,
131-
missingKeys: [
132-
'settings.background_themes.label',
133-
'settings.enable_graph_pulse_loop',
134-
'settings.enable_graph_pulse_loop_description',
135-
'settings.data_source.algolia_description',
136-
'settings.data_source.npm_description',
137-
'i18n.contribute_hint',
138-
'i18n.copy_keys',
139-
],
140-
githubEditUrl: 'https://github.com/npmx-dev/npmx.dev/edit/main/i18n/locales/fr-FR.json',
141-
githubHistoryUrl:
142-
'https://github.com/npmx-dev/npmx.dev/commits/main/i18n/locales/fr-FR.json',
143-
},
144-
{
145-
lang: 'de-DE',
146-
label: 'Deutsch',
147-
dir: 'ltr',
148-
totalKeys: 500,
149-
completedKeys: 500,
150-
percentComplete: 100,
151-
missingKeys: [],
152-
githubEditUrl: 'https://github.com/npmx-dev/npmx.dev/edit/main/i18n/locales/de-DE.json',
153-
githubHistoryUrl:
154-
'https://github.com/npmx-dev/npmx.dev/commits/main/i18n/locales/de-DE.json',
155-
},
156-
],
157-
})
158-
})

0 commit comments

Comments
 (0)