overleaf-cep/services/web/frontend/stories/loading/loading.stories.tsx
Tim Down 28468e134c Merge pull request #24660 from overleaf/td-bs5-remove-react-bootstrap-0
Remove react-bootstrap 0.33.1

GitOrigin-RevId: c320a6b18c576afdc0fd49559915d3d2f3a7a1ef
2025-04-10 08:04:50 +00:00

45 lines
1.2 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/react'
import { LoadingUI } from '@/features/ide-react/components/loading'
import { EditorProviders } from '../../../test/frontend/helpers/editor-providers'
import { PartialMeta } from '@/utils/meta'
const meta: Meta<typeof LoadingUI> = {
title: 'Loading Page / Loading',
component: LoadingUI,
argTypes: {
errorCode: {
control: 'select',
options: [
'',
'io-not-loaded',
'unable-to-join',
'i18n-error',
'unhandled-error-code',
],
},
progress: { control: { type: 'range', min: 0, max: 100 } },
},
}
export default meta
type Story = StoryObj<typeof LoadingUI>
const errorMessages = {
translationIoNotLoaded: 'Could not connect to the WebSocket server',
translationLoadErrorMessage: 'Could not load translations',
translationUnableToJoin: 'Could not connect to collaboration server',
}
export const LoadingPage: Story = {
render: args => {
for (const [key, value] of Object.entries(errorMessages)) {
window.metaAttributesCache.set(`ol-${key}` as keyof PartialMeta, value)
}
return (
<EditorProviders>
<LoadingUI {...args} />
</EditorProviders>
)
},
}