mirror of
https://github.com/langgenius/dify.git
synced 2026-01-14 06:07:33 +08:00
Some checks failed
autofix.ci / autofix (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Has been cancelled
Main CI Pipeline / Check Changed Files (push) Has been cancelled
Main CI Pipeline / Style Check (push) Has been cancelled
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Has been cancelled
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Has been cancelled
Main CI Pipeline / API Tests (push) Has been cancelled
Main CI Pipeline / Web Tests (push) Has been cancelled
Main CI Pipeline / VDB Tests (push) Has been cancelled
Main CI Pipeline / DB Migration Test (push) Has been cancelled
67 lines
1.6 KiB
TypeScript
67 lines
1.6 KiB
TypeScript
import type { Preview } from '@storybook/react'
|
|
import type { Resource } from 'i18next'
|
|
import { withThemeByDataAttribute } from '@storybook/addon-themes'
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
import { ToastProvider } from '../app/components/base/toast'
|
|
import { I18nClientProvider as I18N } from '../app/components/provider/i18n'
|
|
import commonEnUS from '../i18n/en-US/common.json'
|
|
|
|
import '../app/styles/globals.css'
|
|
import '../app/styles/markdown.scss'
|
|
import './storybook.css'
|
|
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
refetchOnWindowFocus: false,
|
|
},
|
|
},
|
|
})
|
|
|
|
const storyResources: Resource = {
|
|
'en-US': {
|
|
// Preload the most common namespace to avoid missing keys during initial render;
|
|
// other namespaces will be loaded on demand via resourcesToBackend.
|
|
common: commonEnUS as unknown as Record<string, unknown>,
|
|
},
|
|
}
|
|
|
|
export const decorators = [
|
|
withThemeByDataAttribute({
|
|
themes: {
|
|
light: 'light',
|
|
dark: 'dark',
|
|
},
|
|
defaultTheme: 'light',
|
|
attributeName: 'data-theme',
|
|
}),
|
|
(Story) => {
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<I18N locale="en-US" resource={storyResources}>
|
|
<ToastProvider>
|
|
<Story />
|
|
</ToastProvider>
|
|
</I18N>
|
|
</QueryClientProvider>
|
|
)
|
|
},
|
|
]
|
|
|
|
const preview: Preview = {
|
|
parameters: {
|
|
controls: {
|
|
matchers: {
|
|
color: /(background|color)$/i,
|
|
date: /Date$/i,
|
|
},
|
|
},
|
|
docs: {
|
|
toc: true,
|
|
},
|
|
},
|
|
tags: ['autodocs'],
|
|
}
|
|
|
|
export default preview
|