Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions client/components/Editor/Editor.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import React, { useState } from 'react';

import { storiesOf } from '@storybook/react';
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/database';

import Editor from 'components/Editor';
import {
Expand All @@ -17,7 +14,6 @@ import {
removeLocalHighlight,
setLocalHighlight,
} from 'components/Editor/utils';
import { getFirebaseConfig } from 'utils/editor/firebaseConfig';
import initialContent from 'utils/storybook/initialDocs/plainDoc';

const editorWrapperStyle = {
Expand All @@ -39,19 +35,8 @@ const clientData = {
canEdit: true,
};

const initFirebase = (rootKey) => {
const firebaseAppName = `App-${rootKey}`;
/* Check if we've already initialized an Firebase App with the */
/* same name in this local environment */
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
const existingApp = firebase.apps.reduce((prev, curr) => {
return curr.name === firebaseAppName ? curr : prev;
}, undefined);

/* Use the existing Firebase App or initialize a new one */
const firebaseApp = existingApp || firebase.initializeApp(getFirebaseConfig(), firebaseAppName);
const database = firebase.database(firebaseApp);
return database.ref(`${rootKey}`);
const initFirebase = (_rootKey) => {
return null;
};

const cursorCommands = {
Expand All @@ -62,8 +47,7 @@ const cursorCommands = {
};

const rootKey = 'firebase-testing';
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 2.
const draftRef = initFirebase(rootKey, '');
const draftRef = initFirebase(rootKey);
const newDiscussionId = String(Math.floor(Math.random() * 999999));

const CursorOptionsDemoPub = () => {
Expand Down Expand Up @@ -163,10 +147,8 @@ storiesOf('Editor', module)
}}
collaborativeOptions={{
pubId: 'storybook-pub-id',
firebaseRef: draftRef as any,
clientData,
initialDocKey: -1,
// onClientChange: () => {},
onStatusChange: (status) => console.info('collab status is', status),
}}
/>
Expand Down Expand Up @@ -239,10 +221,8 @@ storiesOf('Editor', module)
}}
collaborativeOptions={{
pubId: 'storybook-pub-id',
firebaseRef: draftRef as any,
clientData,
initialDocKey: -1,
// onClientChange: () => {},
onStatusChange: (status) => console.info('collab status is', status),
}}
/>
Expand Down
Loading
Loading