Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : add studio tour for first time user #1120

Merged
merged 25 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4772679
feat : add tour for first time user
aialok Jun 27, 2024
10bb4a5
Fix lint error
aialok Jul 20, 2024
98c7475
Add tour for studio-next
aialok Jul 20, 2024
f4b55f9
minor changes
aialok Jul 20, 2024
272141d
Add ADR for studio tour
aialok Jul 20, 2024
34be20f
chore(docs): improved tour docs : studio
aialok Jul 23, 2024
eac87a5
chore(docs): improved tour docs : studio-next
aialok Jul 23, 2024
a243d5b
chore(tour-docs) : improved tour docs
aialok Jul 23, 2024
a7cfb85
chore(tour-docs): improved tour docs - studio
aialok Jul 23, 2024
99da710
feat(studio): Add ability to resume tour from last position
aialok Jul 28, 2024
e920309
feat(studio-next): Add ability to resume tour from last position
aialok Jul 28, 2024
6b51763
Merge branch 'master' into master
aialok Jul 30, 2024
ee94522
chore(eslint): Fix eslint error
aialok Aug 9, 2024
d5a9534
Merge branch 'master' into master
asyncapi-bot Aug 10, 2024
910909e
Merge branch 'master' into master
asyncapi-bot Aug 10, 2024
9d89a4b
Merge branch 'master' into master
aialok Aug 17, 2024
88fdfcf
Merge branch 'master' into master
asyncapi-bot Aug 28, 2024
4be0b0e
Merge branch 'master' into master
asyncapi-bot Sep 17, 2024
4e2ceb0
chore(sonal-cloud): added driver.ts in sonar.cpd.exclusions
aialok Sep 17, 2024
5ff67a9
Merge branch 'master' into master
aialok Sep 20, 2024
4755566
fix(pnpm-lock): fixes pnpm lock file for failing workflow
aialok Sep 21, 2024
fba81c6
Merge branch 'master' into master
aialok Sep 21, 2024
0bfb31a
fixes(pnpm-lock): conflict
aialok Sep 21, 2024
fe2d884
fixes(build-failed): fixes build failed due to eslint
aialok Sep 21, 2024
c1f37c7
fix(sonar-cloud): fixes sonar cloud warning
aialok Sep 21, 2024
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
5 changes: 3 additions & 2 deletions apps/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@monaco-editor/react": "^4.4.6",
"@stoplight/yaml": "^4.3.0",
"@tippyjs/react": "^4.2.6",
"driver.js": "^1.3.1",
"js-base64": "^3.7.3",
"js-file-download": "^0.4.12",
"js-yaml": "^4.1.0",
Expand Down Expand Up @@ -108,6 +109,7 @@
"conventional-changelog-conventionalcommits": "^5.0.0",
"cross-env": "^7.0.3",
"esbuild": "0.18.20",
"eslint-config-custom": "workspace:*",
"https-browserify": "^1.0.0",
"markdown-toc": "^1.2.0",
"path-browserify": "^1.0.1",
Expand All @@ -123,8 +125,7 @@
"url": "^0.11.0",
"util": "^0.12.5",
"web-vitals": "^3.1.0",
"webpack": "^5.75.0",
"eslint-config-custom": "workspace:*"
"webpack": "^5.75.0"
},
"jest": {
"transformIgnorePatterns": [
Expand Down
18 changes: 14 additions & 4 deletions apps/studio/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { AsyncAPIStudio } from './studio';

import type { FunctionComponent } from 'react';
import type { FunctionComponent } from "react";

Check failure on line 3 in apps/studio/src/App.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Strings must use singlequote
import { useEffect } from "react";

Check failure on line 4 in apps/studio/src/App.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Strings must use singlequote
import { driverObj } from "./helpers/driver";

Check failure on line 5 in apps/studio/src/App.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Strings must use singlequote

export const App: FunctionComponent = () => {
return (
<AsyncAPIStudio />
);
useEffect(() => {
const alreadyVisitedSession = sessionStorage.getItem("alreadyVisited");

Check failure on line 9 in apps/studio/src/App.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Strings must use singlequote
const alreadyVisitedLocal = localStorage.getItem("alreadyVisited");

Check failure on line 10 in apps/studio/src/App.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Strings must use singlequote
if (!alreadyVisitedSession && !alreadyVisitedLocal) {
sessionStorage.setItem("alreadyVisited", "true");

Check failure on line 12 in apps/studio/src/App.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Strings must use singlequote

Check failure on line 12 in apps/studio/src/App.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Strings must use singlequote
localStorage.setItem("alreadyVisited", "true");

Check failure on line 13 in apps/studio/src/App.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Strings must use singlequote

Check failure on line 13 in apps/studio/src/App.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Strings must use singlequote
driverObj.drive();
}
}, []);

return <AsyncAPIStudio />;
};
2 changes: 1 addition & 1 deletion apps/studio/src/components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Editor: React.FunctionComponent<EditorProps> = () => {
size={editorHeight}
defaultSize={editorHeight}
>
<div className="flex flex-1 flex-col h-full overflow-hidden">
<div className="flex flex-1 flex-col h-full overflow-hidden" id="editor">
<EditorSidebar />
<MonacoWrapper />
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/src/components/Editor/EditorSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const EditorSidebar: React.FunctionComponent<
className="flex flex-row items-center"
style={{ height: '30px', lineHeight: '30px' }}
>
<div>
<div id="editor-dropdown">
<ul className="flex">
<li>
<ShareButton />
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/src/components/Navigationv3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export const Navigationv3: React.FunctionComponent<NavigationProps> = ({

const components = document.components();
return (
<div className={`flex flex-none flex-col overflow-y-auto overflow-x-hidden bg-gray-800 h-full ${className}`}>
<div className={`flex flex-none flex-col overflow-y-auto overflow-x-hidden bg-gray-800 h-full ${className}`} id="information">
<ul>
<li className="mb-4">
<div
Expand Down
16 changes: 14 additions & 2 deletions apps/studio/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VscListSelection, VscCode, VscOpenPreview, VscGraph, VscNewFile, VscSettingsGear } from 'react-icons/vsc';
import { VscListSelection, VscCode, VscOpenPreview, VscGraph, VscNewFile, VscSettingsGear,VscPlayCircle } from 'react-icons/vsc';
import { show as showModal } from '@ebay/nice-modal-react';

import { Tooltip } from './common';
Expand All @@ -8,6 +8,7 @@

import type { FunctionComponent, ReactNode } from 'react';
import type { PanelsState } from '../state/panels.state';
import { driverObj } from '../helpers/driver';

function updateState(panelName: keyof PanelsState['show'], type?: PanelsState['secondaryPanelType']) {
const settingsState = panelsState.getState();
Expand Down Expand Up @@ -115,7 +116,7 @@
navigation = navigation.filter(item => item.enabled);

return (
<div className="flex flex-col bg-gray-800 shadow-lg border-r border-gray-700 justify-between">
<div className="flex flex-col bg-gray-800 shadow-lg border-r border-gray-700 justify-between" id="navbar">
<div className="flex flex-col">
{navigation.map(item => (
<Tooltip content={item.tooltip} placement='right' hideOnClick={true} key={item.name}>
Expand All @@ -133,12 +134,23 @@
))}
</div>
<div className="flex flex-col">
<Tooltip content='Start Tour' placement='right' hideOnClick={true}>

Check failure on line 137 in apps/studio/src/components/Sidebar.tsx

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Expected indentation of 8 spaces but found 6
<button
title="Start Tour"
className='flex text-gray-500 hover:text-white focus:outline-none border-box p-4'
type="button"
onClick={() => (driverObj.drive())}
aialok marked this conversation as resolved.
Show resolved Hide resolved
>
<VscPlayCircle className="w-6 h-6" />
</button>
</Tooltip>
<Tooltip content='Studio settings' placement='right' hideOnClick={true}>
<button
title="Studio settings"
className='flex text-gray-500 hover:text-white focus:outline-none border-box p-4'
type="button"
onClick={() => showModal(SettingsModal)}
id="studio-setting"
>
<VscSettingsGear className="w-5 h-5" />
</button>
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/src/components/Template/HTMLWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const HTMLWrapper: React.FunctionComponent<HTMLWrapperProps> = () => {
return (
parsedSpec && (
<div className="flex flex-1 flex-col h-full overflow-hidden">
<div className="overflow-auto">
<div className="overflow-auto" id="html-preview">
<AsyncApiComponentWP
schema={parsedSpec}
config={{
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/src/components/Terminal/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const Terminal: React.FunctionComponent<TerminalProps> = () => {
];

return (
<div className="bg-gray-800 border-t border-gray-700 flex-grow relative h-full overflow-hidden">
<div className="bg-gray-800 border-t border-gray-700 flex-grow relative h-full overflow-hidden" id="terminal">
<TerminalTabs tabs={tabs} active="problems" />
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion apps/studio/src/components/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const Toolbar: React.FunctionComponent<ToolbarProps> = () => {
<div className="px-2 border-b border-gray-700 bg-gray-800">
<div className="flex items-center justify-between h-16">
<div className="flex items-center">
<div className="flex-shrink-0 ml-1.5">
<div className="flex-shrink-0 ml-1.5" id="tour-example">
<img
className="inline-block h-16"
src={`${process.env.PUBLIC_URL}/img/logo-studio.svg`}
Expand All @@ -20,6 +20,7 @@ export const Toolbar: React.FunctionComponent<ToolbarProps> = () => {
</span>
</div>
</div>
<div id='communicate'>
<ul className="flex items-center text-pink-500 mr-2">
<li className="text-xl opacity-75 hover:opacity-100">
<a href='https://asyncapi.com' title='AsyncAPI Website' target='_blank' rel="noreferrer">
Expand All @@ -37,6 +38,7 @@ export const Toolbar: React.FunctionComponent<ToolbarProps> = () => {
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
Expand Down
114 changes: 114 additions & 0 deletions apps/studio/src/helpers/driver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import { driver } from "driver.js";
import "driver.js/dist/driver.css";

export const driverObj = driver({
popoverClass: "driverjs-theme",
showProgress: true,
showButtons: ["next", "previous", "close"],
nextBtnText: "Next",
prevBtnText: "Back",

steps: [
{
element: "#tour-example",
popover: {
title: "Welcome to AsyncAPI Studio",
description:
"Discover a powerful tool for designing, documenting, and managing AsyncAPI-based applications. This tour will guide you through key features to enhance your API development workflow.",
side: "left",
align: "start",
},
},
{
element: "#navbar",
popover: {
title: "Control Center",
description:
"This controle center allows you to toggle the editor, information panel, and HTML preview on or off. It's also your gateway to creating new API templates for various protocols like Apache Kafka, WebSocket, HTTP, and more. Customize your workspace and jumpstart your API design process from here.",
side: "left",
align: "start",
},
},
{
element: "#information",
popover: {
title: "Information Panel",
description:
"Explore your API structure using this information panel. Quickly access Servers, Channels, Operations, Messages, and Schemas - the building blocks of your AsyncAPI specification.",
side: "left",
align: "start",
},
},
{
element: "#editor",
popover: {
title: "The Powerful Editor",
description:
"Create and edit your AsyncAPI documents with ease. Enjoy features like syntax highlighting, auto-completion, and real-time validation to streamline your API design process.",
side: "bottom",
align: "start",
},
},
{
element: "#editor-dropdown",
popover: {
title: "Share and Editor Options",
description:
"Collaborate on your work and access document management tools. Import, export, and convert your API specifications with just a few clicks.",
side: "top",
align: "start",
},
},
{
element: "#terminal",
popover: {
title: "Terminal",
description:
"Quickly identify and resolve issues in your specification. View errors, warnings, and helpful messages to ensure your API documentation is error-free.",
side: "bottom",
align: "start",
},
},
{
element: "#html-preview",
popover: {
title: "Instant HTML Preview",
description:
"See your API documentation come to life in real-time. This panel renders a human-readable version of your specification as you make changes.",
side: "top",
align: "start",
},
},
{
element: "#studio-setting",
popover: {
title: "Studio Settings",
description:
"Customize your AsyncAPI Studio experience. Adjust preferences and settings to tailor the tool to your workflow.",
side: "top",
align: "start",
},
},
{
element: "#communicate",
popover: {
title: "Join AsyncAPI Community",
description:
"Connect with fellow AsyncAPI developers. Join our Slack community to share ideas, get help, and stay updated on AsyncAPI news and events.",
side: "top",
align: "start",
},
},
{
element: "#Thank-you",
popover: {
title: "Thank You",
description:
"Thanks for exploring AsyncAPI Studio. We hope you find it valuable for your API projects. Feel free to reach out with any questions or feedback. Happy coding!",
side: "top",
align: "start",
},
},
],
});

62 changes: 62 additions & 0 deletions apps/studio/src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,66 @@

.tippy-box[data-placement^="right"] > .tippy-arrow:before {
border-right-color: rgba(17, 24, 39) !important;
}

.driver-popover.driverjs-theme {
background-color: #1a1a1a;
border: 1px solid #333333;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.driver-popover.driverjs-theme .driver-popover-title {
font-size: 18px;
font-weight: bold;
color: #db2777;
}

.driver-popover.driverjs-theme .driver-popover-description {
font-size: 14px;
color: #cccccc;
font-family: sans-serif;
}

.driver-popover.driverjs-theme button {
background-color: #db2777 ;
color: #ffffff !important;
border: none !important;
font-size: 14px;
padding: 8px 20px;
border-radius: 4px;
margin-left: 10px;
text-shadow: none;
font-weight: bold;
text-align: center;
}

.driver-popover.driverjs-theme .driver-popover-close-btn {
color: #999999;
font-size: 20px;
background-color: transparent;
top: 13px;
right: 5px;
padding: 0%;
}

.driver-popover.driverjs-theme .driver-popover-close-btn:hover {
background-color: transparent;
cursor: pointer;
}

.driver-popover.driverjs-theme .driver-popover-arrow-side-left.driver-popover-arrow {
border-left-color: #1a1a1a;
}

.driver-popover.driverjs-theme .driver-popover-arrow-side-right.driver-popover-arrow {
border-right-color: #1a1a1a;
}

.driver-popover.driverjs-theme .driver-popover-arrow-side-top.driver-popover-arrow {
border-top-color: #1a1a1a;
}

.driver-popover.driverjs-theme .driver-popover-arrow-side-bottom.driver-popover-arrow {
border-bottom-color: #1a1a1a;
}
2 changes: 1 addition & 1 deletion apps/studio/src/state/other.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type OtherState = {
}

export const otherState = create<OtherState>(() => ({
editorHeight: 'calc(100% - 36px)',
editorHeight: 'calc(100% - 161px)',
templateRerender: false,
}));

Expand Down
Loading
Loading