cetirizine

An experimental matrix client written in reactjs utilizing tailwind and storybook
git clone git://archive.git.mtrnord.blog/MTRNord/cetirizine.git
Log | Files | Refs | README | LICENSE

MainPage.stories.tsx (2386B)


      1 import { Meta, StoryObj } from '@storybook/react';
      2 import MainPage from './MainPage';
      3 import { withRouter } from 'storybook-addon-react-router-v6';
      4 import { initAsync, start } from '@mtrnord/matrix-sdk-crypto-js';
      5 
      6 const meta: Meta<typeof MainPage> = {
      7     title: 'Pages/MainPage',
      8     component: MainPage,
      9     decorators: [
     10         withRouter,
     11         (Story) => {
     12             initAsync().then(() => {
     13                 // if (Tracing.isAvailable()) {
     14                 //   console.log("Tracing is available, turning on");
     15                 //   let tracing = new Tracing(LoggerLevel.Info);
     16                 //   tracing.turnOn();
     17                 // }
     18                 console.log("Crypto starting")
     19                 start();
     20                 console.log("Crypto started")
     21 
     22 
     23                 import('../app/sdk/client').then(({ defaultMatrixClient }) => {
     24                     import('@mtrnord/matrix-sdk-crypto-js').then(({ UserId, DeviceId }) => {
     25                         // @ts-ignore
     26                         defaultMatrixClient.user.mxid = "@example:example.com";
     27                         // @ts-ignore
     28                         defaultMatrixClient.user.device_id = "test";
     29                         // @ts-ignore
     30                         defaultMatrixClient.user.e2ee.initOlmMachine(new UserId(defaultMatrixClient.user.mxid), new DeviceId(defaultMatrixClient.user.device_id)).then(() => {
     31                             console.log("OlmMachine initialized")
     32                         });
     33                         // @ts-ignore
     34                         defaultMatrixClient.user.hostname = "https://matrix.example.com";
     35                         // @ts-ignore
     36                         defaultMatrixClient.user.slidingSyncHostname = "https://sliding.matrix.example.com";
     37                         // @ts-ignore
     38                         defaultMatrixClient.sync.user.slidingSyncHostname = "https://sliding.matrix.example.com";
     39                         // @ts-ignore
     40                         defaultMatrixClient.user.access_token = "111";
     41                         import('../mocks/browser').then((module) => {
     42                             module.worker.start();
     43                         });
     44                     })
     45                 })
     46             })
     47             // @ts-ignore
     48             return <Story />
     49         }
     50     ],
     51 
     52 };
     53 
     54 export default meta;
     55 type Story = StoryObj<typeof MainPage>;
     56 
     57 export const Default: Story = {};