2
0

Adds DisplayName component (#35985)

This commit is contained in:
Echo
2025-09-04 12:09:27 +02:00
committed by GitHub
parent d7d83d44e6
commit 42be0ca0eb
7 changed files with 259 additions and 33 deletions

View File

@@ -12,13 +12,14 @@ import { initialize, mswLoader } from 'msw-storybook-addon';
import { action } from 'storybook/actions';
import type { LocaleData } from '@/mastodon/locales';
import { reducerWithInitialState, rootReducer } from '@/mastodon/reducers';
import { reducerWithInitialState } from '@/mastodon/reducers';
import { defaultMiddleware } from '@/mastodon/store/store';
import { mockHandlers, unhandledRequestHandler } from '@/testing/api';
// If you want to run the dark theme during development,
// you can change the below to `/application.scss`
import '../app/javascript/styles/mastodon-light.scss';
import './styles.css';
const localeFiles = import.meta.glob('@/mastodon/locales/*.json', {
query: { as: 'json' },
@@ -49,12 +50,17 @@ const preview: Preview = {
locale: 'en',
},
decorators: [
(Story, { parameters }) => {
(Story, { parameters, globals }) => {
const { locale } = globals as { locale: string };
const { state = {} } = parameters;
let reducer = rootReducer;
if (typeof state === 'object' && state) {
reducer = reducerWithInitialState(state as Record<string, unknown>);
}
const reducer = reducerWithInitialState(
{
meta: {
locale,
},
},
state as Record<string, unknown>,
);
const store = configureStore({
reducer,
middleware(getDefaultMiddleware) {