|
@@ -1,25 +1,46 @@
|
|
|
import type { Meta, StoryObj } from '@storybook/react'
|
|
import type { Meta, StoryObj } from '@storybook/react'
|
|
|
-import { Loading } from '@/features/ide-react/components/loading'
|
|
|
|
|
|
|
+import { LoadingUI } from '@/features/ide-react/components/loading'
|
|
|
import { EditorProviders } from '../../../test/frontend/helpers/editor-providers'
|
|
import { EditorProviders } from '../../../test/frontend/helpers/editor-providers'
|
|
|
import { bsVersionDecorator } from '../../../.storybook/utils/with-bootstrap-switcher'
|
|
import { bsVersionDecorator } from '../../../.storybook/utils/with-bootstrap-switcher'
|
|
|
|
|
|
|
|
-const meta: Meta<typeof Loading> = {
|
|
|
|
|
|
|
+const meta: Meta<typeof LoadingUI> = {
|
|
|
title: 'Loading Page / Loading',
|
|
title: 'Loading Page / Loading',
|
|
|
- component: Loading,
|
|
|
|
|
|
|
+ component: LoadingUI,
|
|
|
argTypes: {
|
|
argTypes: {
|
|
|
- setLoaded: { action: 'setLoaded' },
|
|
|
|
|
|
|
+ errorCode: {
|
|
|
|
|
+ control: 'select',
|
|
|
|
|
+ options: [
|
|
|
|
|
+ '',
|
|
|
|
|
+ 'io-not-loaded',
|
|
|
|
|
+ 'unable-to-join',
|
|
|
|
|
+ 'i18n-error',
|
|
|
|
|
+ 'unhandled-error-code',
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ progress: { control: { type: 'range', min: 0, max: 100 } },
|
|
|
...bsVersionDecorator.argTypes,
|
|
...bsVersionDecorator.argTypes,
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export default meta
|
|
export default meta
|
|
|
|
|
|
|
|
-type Story = StoryObj<typeof Loading>
|
|
|
|
|
|
|
+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 = {
|
|
export const LoadingPage: Story = {
|
|
|
- render: args => (
|
|
|
|
|
- <EditorProviders>
|
|
|
|
|
- <Loading {...args} />
|
|
|
|
|
- </EditorProviders>
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ render: args => {
|
|
|
|
|
+ for (const [key, value] of Object.entries(errorMessages)) {
|
|
|
|
|
+ window.metaAttributesCache.set(`ol-${key}`, value)
|
|
|
|
|
+ }
|
|
|
|
|
+ return (
|
|
|
|
|
+ <EditorProviders>
|
|
|
|
|
+ <LoadingUI {...args} />
|
|
|
|
|
+ </EditorProviders>
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|