From a7440094d80e326c5ecaccce6083fa80eb4e3229 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 10 Sep 2021 18:26:47 +0530 Subject: [PATCH] change(ui) - assist docs --- .../Integrations/AssistDoc/AssistDoc.js | 74 +++++++++---------- .../Integrations/AssistDoc/AssistNpm.tsx | 53 +++++++++++++ .../Integrations/AssistDoc/AssistScript.tsx | 33 +++++++++ .../OnboardingTabs/OnboardingTabs.js | 1 - 4 files changed, 119 insertions(+), 42 deletions(-) create mode 100644 frontend/app/components/Client/Integrations/AssistDoc/AssistNpm.tsx create mode 100644 frontend/app/components/Client/Integrations/AssistDoc/AssistScript.tsx diff --git a/frontend/app/components/Client/Integrations/AssistDoc/AssistDoc.js b/frontend/app/components/Client/Integrations/AssistDoc/AssistDoc.js index 828051f57..a0aef3cad 100644 --- a/frontend/app/components/Client/Integrations/AssistDoc/AssistDoc.js +++ b/frontend/app/components/Client/Integrations/AssistDoc/AssistDoc.js @@ -1,61 +1,53 @@ import Highlight from 'react-highlight' import ToggleContent from 'Shared/ToggleContent' import DocLink from 'Shared/DocLink/DocLink'; +import AssistScript from './AssistScript' +import AssistNpm from './AssistNpm' +import { Tabs } from 'UI'; +import { useState } from 'react'; + +const NPM = 'NPM' +const SCRIPT = 'SCRIPT' +const TABS = [ + { key: SCRIPT, text: SCRIPT }, + { key: NPM, text: NPM }, +] const AssistDoc = (props) => { const { projectKey } = props; + const [activeTab, setActiveTab] = useState(SCRIPT) + + + const renderActiveTab = () => { + switch (activeTab) { + case SCRIPT: + return + case NPM: + return + } + return null; + } + + return (
OpenReplay Assist allows you to support your users by seeing their live screen and instantly hopping on call (WebRTC) with them without requiring any 3rd-party screen sharing software.
- +
Installation
{`npm i @openreplay/tracker-assist`} - -
Usage
-

Initialize the tracker then load the @openreplay/tracker-assist plugin.

-
+
Usage
- - {`import Tracker from '@openreplay/tracker'; -import trackerAssist from '@openreplay/tracker-assist'; -const tracker = new Tracker({ - projectKey: '${projectKey}', -}); -tracker.start(); -tracker.use(trackerAssist(options)); // check the list of available options below`} - - } - second={ - - {`import OpenReplay from '@openreplay/tracker/cjs'; -import trackerFetch from '@openreplay/tracker-assist/cjs'; -const tracker = new OpenReplay({ - projectKey: '${projectKey}' -}); -const trackerAssist = tracker.use(trackerAssist(options)); // check the list of available options below -//... -function MyApp() { - useEffect(() => { // use componentDidMount in case of React Class Component - tracker.start(); - }, []) -//... -}`} - - } + setActiveTab(tab) } /> -
Options
- - {`trackerAssist({ - confirmText: string; -})`} - +
+ { renderActiveTab() } +
diff --git a/frontend/app/components/Client/Integrations/AssistDoc/AssistNpm.tsx b/frontend/app/components/Client/Integrations/AssistDoc/AssistNpm.tsx new file mode 100644 index 000000000..28c12bd30 --- /dev/null +++ b/frontend/app/components/Client/Integrations/AssistDoc/AssistNpm.tsx @@ -0,0 +1,53 @@ +import React from 'react'; +import Highlight from 'react-highlight' +import ToggleContent from 'Shared/ToggleContent' + +function AssistNpm(props) { + return ( +
+

Initialize the tracker then load the @openreplay/tracker-assist plugin.

+ +
Usage
+ + {`import Tracker from '@openreplay/tracker'; +import trackerAssist from '@openreplay/tracker-assist'; +const tracker = new Tracker({ + projectKey: '${props.projectKey}', +}); +tracker.start(); +tracker.use(trackerAssist(options)); // check the list of available options below`} + + } + second={ + + {`import OpenReplay from '@openreplay/tracker/cjs'; +import trackerFetch from '@openreplay/tracker-assist/cjs'; +const tracker = new OpenReplay({ + projectKey: '${props.projectKey}' +}); +const trackerAssist = tracker.use(trackerAssist(options)); // check the list of available options below +//... +function MyApp() { + useEffect(() => { // use componentDidMount in case of React Class Component + tracker.start(); + }, []) +//... +}`} + + } + /> + +
Options
+ + {`trackerAssist({ + confirmText: string; +})`} + +
+ ); +} + +export default AssistNpm; \ No newline at end of file diff --git a/frontend/app/components/Client/Integrations/AssistDoc/AssistScript.tsx b/frontend/app/components/Client/Integrations/AssistDoc/AssistScript.tsx new file mode 100644 index 000000000..932926a1a --- /dev/null +++ b/frontend/app/components/Client/Integrations/AssistDoc/AssistScript.tsx @@ -0,0 +1,33 @@ +import React from 'react'; +import Highlight from 'react-highlight' + +function AssistScript(props) { + return ( +
+

If your OpenReplay tracker is set up using the JS snippet, then simply replace the .../openreplay.js occurrence with .../openreplay-assist.js. Below is an example of how the script should like after the change:

+
+ + + {` +`} + +
+ ); +} + +export default AssistScript; \ No newline at end of file diff --git a/frontend/app/components/Onboarding/components/OnboardingTabs/OnboardingTabs.js b/frontend/app/components/Onboarding/components/OnboardingTabs/OnboardingTabs.js index 6ec2db234..fd05da5b6 100644 --- a/frontend/app/components/Onboarding/components/OnboardingTabs/OnboardingTabs.js +++ b/frontend/app/components/Onboarding/components/OnboardingTabs/OnboardingTabs.js @@ -22,7 +22,6 @@ class TrackingCodeModal extends React.PureComponent { } renderActiveTab = () => { - console.log('rendering...') switch (this.state.activeTab) { case PROJECT: return