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 5 commits
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
21 changes: 11 additions & 10 deletions apps/studio-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,32 @@
"@asyncapi/protobuf-schema-parser": "^3.2.8",
"@asyncapi/react-component": "^1.2.2",
"@asyncapi/specs": "^6.5.4",
"@codemirror/view": "^6.26.3",
"@ebay/nice-modal-react": "^1.2.10",
"@headlessui/react": "^1.7.4",
"@hookstate/core": "^4.0.0-rc21",
"@monaco-editor/react": "^4.4.6",
"@tippyjs/react": "^4.2.6",
"js-base64": "^3.7.3",
"js-file-download": "^0.4.12",
"js-yaml": "^4.1.0",
"monaco-editor": "0.34.1",
"monaco-yaml": "4.0.2",
"react-hot-toast": "2.4.0",
"react-icons": "^4.6.0",
"reactflow": "^11.2.0",
"@stoplight/yaml": "^4.3.0",
"@codemirror/view": "^6.26.3",
"@tippyjs/react": "^4.2.6",
"@types/node": "20.4.6",
"@types/react": "18.2.18",
"@types/react-dom": "18.2.7",
"autoprefixer": "10.4.14",
"codemirror": "^6.0.1",
"driver.js": "^1.3.1",
"eslint-config-next": "13.4.12",
"js-base64": "^3.7.3",
"js-file-download": "^0.4.12",
"js-yaml": "^4.1.0",
"monaco-editor": "0.34.1",
"monaco-yaml": "4.0.2",
"next": "14.2.3",
"postcss": "8.4.31",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hot-toast": "2.4.0",
"react-icons": "^4.6.0",
"reactflow": "^11.2.0",
"tailwindcss": "3.3.3",
"tippy.js": "^6.3.7",
"typescript": "5.1.6",
Expand Down
67 changes: 67 additions & 0 deletions apps/studio-next/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,70 @@
.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;
transition: background-color 0.3s ease;
}

.driver-popover.driverjs-theme button:hover {
background-color: #c81c67;
cursor: pointer;
}

.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-next/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-next/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-next/src/components/Navigationv3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,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
18 changes: 15 additions & 3 deletions apps/studio-next/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 { usePanelsState, panelsState, useDocumentsState } from '@/state';

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 @@ export const Sidebar: FunctionComponent<SidebarProps> = () => {
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="sidebar">
<div className="flex flex-col">
{navigation.map(item => (
<Tooltip content={item.tooltip} placement='right' hideOnClick={true} key={item.name}>
Expand All @@ -133,14 +134,25 @@ export const Sidebar: FunctionComponent<SidebarProps> = () => {
))}
</div>
<div className="flex flex-col">
<Tooltip content='Start Tour' placement='right' hideOnClick={true}>
<button
title="Start Tour"
className='flex text-gray-500 hover:text-white focus:outline-none border-box p-4'
type="button"
onClick={() => (driverObj.drive())}
>
<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" />
<VscSettingsGear className="w-5 h-5" />
</button>
</Tooltip>
</div>
Expand Down
10 changes: 9 additions & 1 deletion apps/studio-next/src/components/StudioWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { createServices, Services, ServicesProvider } from '@/services';

import { AsyncAPIStudio } from './CodeEditor';
import Preloader from './Preloader';
import { driverObj } from '@/helpers/driver';

function configureMonacoEnvironment() {
if (typeof window !== 'undefined') {
Expand Down Expand Up @@ -34,8 +35,15 @@ export default function StudioWrapper() {
useEffect(() => {
const fetchData = async () => {
const servicess = await createServices();
setServices(servicess)
setServices(servicess);
configureMonacoEnvironment();
const alreadyVisitedSession = sessionStorage.getItem("alreadyVisited");
const alreadyVisitedLocal = localStorage.getItem("alreadyVisited");
if (!alreadyVisitedSession && !alreadyVisitedLocal) {
sessionStorage.setItem("alreadyVisited", "true");
localStorage.setItem("alreadyVisited", "true");
driverObj.drive();
}
};

fetchData();
Expand Down
2 changes: 1 addition & 1 deletion apps/studio-next/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-next/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
2 changes: 1 addition & 1 deletion apps/studio-next/src/components/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function Toolbar() {
</span>
</div>
</div>
<ul className="flex items-center text-pink-500 mr-2">
<ul className="flex items-center text-pink-500 mr-2" id='communicate'>
<li className="text-xl opacity-75 hover:opacity-100">
<a href='https://asyncapi.com' title='AsyncAPI Website' target='_blank' rel="noreferrer">
<IoGlobeOutline />
Expand Down
111 changes: 111 additions & 0 deletions apps/studio-next/src/helpers/driver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
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-start",
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.",
aialok marked this conversation as resolved.
Show resolved Hide resolved
},
},
{
element: "#sidebar",
popover: {
title: "Control Center",
description:
"This control 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.",
aialok marked this conversation as resolved.
Show resolved Hide resolved
side: "left",
align: "start",
},
},
{
element: "#information",
popover: {
title: "Information Panel",
aialok marked this conversation as resolved.
Show resolved Hide resolved
description:
"Explore your API structure using this information panel. Quickly access Servers, Channels, Operations, Messages, and Schemas - the building blocks of your AsyncAPI specification.",
aialok marked this conversation as resolved.
Show resolved Hide resolved
aialok marked this conversation as resolved.
Show resolved Hide resolved
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",
},
},
],
});
2 changes: 1 addition & 1 deletion apps/studio-next/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
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
Loading
Loading