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

Feature/onboarding tutorial #41

Merged
merged 47 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7bd27bb
removed unnused imports
Rodriguespn Jan 9, 2024
0fd1139
resolve merge conflicty
Rodriguespn Jan 11, 2024
e2be491
resolve merge conflict
Rodriguespn Jan 11, 2024
1d65048
fixed spell errors on README
Rodriguespn Jan 11, 2024
01d4474
searchbar with logo and footer v1.0
Rodriguespn Jan 11, 2024
2d8b999
aligned logo with search buttons and minor styling fixes
Rodriguespn Jan 11, 2024
c8e59ba
changed analyze text, added icons to the buttons and text to footer
Rodriguespn Jan 11, 2024
b9643e4
fixed footer margins
Rodriguespn Jan 11, 2024
a1d4e26
solved conflict issues
Rodriguespn Jan 14, 2024
aee2967
removed unused imports and comments unused variables
Rodriguespn Jan 14, 2024
cb2a438
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 14, 2024
6fe29df
removed unused imports and comments unused variables
Rodriguespn Jan 14, 2024
da0d19b
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 15, 2024
82c44ef
resolved merge conflicts and firebase hosting setup
Rodriguespn Jan 15, 2024
c0fbb4d
Feature/landing page (#5)
Rodriguespn Jan 15, 2024
3bee18f
Merge branch 'development' of github.com:WardAnalytics/WardGraph into…
Rodriguespn Jan 15, 2024
63ab775
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 15, 2024
d928bc3
resolved merge conflicts
Rodriguespn Jan 15, 2024
b66255e
Initial deployment graph app (#7)
Rodriguespn Jan 15, 2024
9d365a4
Merge branch 'development' of github.com:WardAnalytics/WardGraph into…
Rodriguespn Jan 15, 2024
50d2740
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 15, 2024
938d8d2
Merge branch 'main' into development
Rodriguespn Jan 15, 2024
8f856e9
Feature/firebase (#9)
Rodriguespn Jan 15, 2024
ecf392f
Merge branch 'development' of github.com:WardAnalytics/WardGraph into…
Rodriguespn Jan 15, 2024
9500da0
ignores .env.development and .env.production
Rodriguespn Jan 15, 2024
f121d1b
Configure github actions to PR and main merge (#13)
Rodriguespn Jan 15, 2024
eafe7a6
merge conflicts resolved
Rodriguespn Jan 15, 2024
920dc76
Feature/firebase (#15)
Rodriguespn Jan 15, 2024
b7bdb8e
Merge branch 'development' of github.com:WardAnalytics/WardGraph into…
Rodriguespn Jan 15, 2024
22a2e9f
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 15, 2024
7d1b958
resolved merge conflicts between main and development
Rodriguespn Jan 15, 2024
cda9e88
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 15, 2024
12172e6
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 16, 2024
fcdac35
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 16, 2024
355f85f
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 16, 2024
57d3b13
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 17, 2024
9d675ff
solved merge conflict issues
Rodriguespn Jan 17, 2024
88e3a01
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 18, 2024
cf6fbf0
Merge branch 'main' into feature/onboarding-tutorial
Rodriguespn Jan 19, 2024
b2f8659
tutorial window
Rodriguespn Jan 19, 2024
5019ac8
tutorial popup
Rodriguespn Jan 19, 2024
1aac37f
Merge branch 'main' of github.com:WardAnalytics/WardGraph
Rodriguespn Jan 19, 2024
f706285
resolve merge conflicts
Rodriguespn Jan 19, 2024
dea56ae
Redesign tutorial completely
tubarao312 Jan 22, 2024
0e011b8
Fix jittery on transition
tubarao312 Jan 22, 2024
2a77af7
Merge branch 'main' into feature/onboarding-tutorial
tubarao312 Jan 22, 2024
48ed2f3
Update Hotbar.tsx
tubarao312 Jan 22, 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
Binary file added src/assets/tutorial/edge-management.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tutorial/exploration.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tutorial/inspection.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tutorial/introduction.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 21 additions & 9 deletions src/components/Graph/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
import analytics from "../../firebase/analytics";
import firestore, { StoreUrlObject } from "../../firebase/firestore";
import generateShortUrl from "../../utils/generateShortUrl";
import TutorialPopup from "../tutorial/TutorialPopup";
import DraggableWindow from "./AnalysisWindow/AnalysisWindow";
import Hotbar from "./Hotbar";
import LandingPage from "./LandingPage/LandingPage";
Expand Down Expand Up @@ -81,6 +82,7 @@ interface GraphContextProps {
doLayout: () => void;
setNodeHighlight: (address: string, highlight: boolean) => void;
getNodeCount: () => number;
setShowTutorial: (show: boolean) => void;
focusedAddressData: AddressAnalysis | null;
}

Expand Down Expand Up @@ -140,14 +142,16 @@ const GraphProvider: FC<GraphProviderProps> = ({

// We make sure to calculate the layouted nodes and edges before rendering
return (
<div style={{ height: "100%" }}>
<ReactFlowProvider>
<GraphProvided
initialNodes={calculateLayoutedElements(initialNodes, initialEdges)}
initialEdges={initialEdges}
/>
</ReactFlowProvider>
</div>
<>
<div style={{ height: "100%" }}>
<ReactFlowProvider>
<GraphProvided
initialNodes={calculateLayoutedElements(initialNodes, initialEdges)}
initialEdges={initialEdges}
/>
</ReactFlowProvider>
</div>
</>
);
};

Expand Down Expand Up @@ -542,6 +546,9 @@ const GraphProvided: FC<GraphProvidedProps> = ({
return nodes.length;
}

// Tutorial
const [showTutorial, setShowTutorial] = useState<boolean>(false);

// Set up the context
const graphContext: GraphContextProps = {
addAddressPaths,
Expand All @@ -556,6 +563,7 @@ const GraphProvided: FC<GraphProvidedProps> = ({
copyLink,
setNodeHighlight,
getNodeCount,
setShowTutorial,
focusedAddressData,
};

Expand Down Expand Up @@ -600,7 +608,11 @@ const GraphProvided: FC<GraphProvidedProps> = ({
aria-hidden="true"
src="https://tailwindui.com/img/[email protected]"
/>
<Controls position="top-right" showInteractive={false} />
{<Controls position="top-right" showInteractive={false} />}
<TutorialPopup
showTutorial={showTutorial}
setShowTutorial={setShowTutorial}
/>
<Background />
<Panel position="top-left">
<Legend />
Expand Down
114 changes: 80 additions & 34 deletions src/components/Graph/Hotbar/Hotbar.tsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,108 @@
import { RectangleGroupIcon, ShareIcon } from "@heroicons/react/24/solid";
import {
RectangleGroupIcon,
ShareIcon,
QuestionMarkCircleIcon,
} from "@heroicons/react/24/outline";
import { FC, useContext, useMemo, useState } from "react";

import clsx from "clsx";
import { GraphContext } from "../Graph";
import ShareDialog from "../LandingPage/ShareDialog";

interface HotbarButton {
onClick?: () => void;
Icon: any;
name: string;
className?: string;
}

const HotbarButton: FC<HotbarButton> = ({ Icon, name, onClick, className }) => {
return (
<button
className={clsx("group flex flex-row items-center", className)}
key={name}
onClick={onClick}
>
<Icon className="h-8 w-8 rounded-lg p-1 text-gray-400 transition-all duration-200 hover:bg-gray-700 hover:text-white" />
<h1 className="pointer-events-none absolute ml-8 mt-0.5 w-max rounded-lg bg-gray-800 px-3 py-2 text-sm font-medium text-white opacity-0 shadow-sm transition-opacity duration-300 group-hover:opacity-100 dark:bg-gray-700">
{name}
</h1>
</button>
);
};

interface HotbarButtonGroupProps {
children: any;
className?: string;
}

const HotbarButtonGroup: FC<HotbarButtonGroupProps> = ({
children,
className,
}) => {
return (
<div
className={clsx(
"flex flex-col items-center justify-center gap-y-0.5",
className,
)}
>
{children}
</div>
);
};

const Hotbar: FC = () => {
const { doLayout, copyLink, getSharingLink } = useContext(GraphContext);
const { doLayout, copyLink, getSharingLink, setShowTutorial } =
useContext(GraphContext);

const [isShareDialogOpen, setIsShareDialogOpen] = useState(false);

const shareUrl = useMemo(() => getSharingLink(), []);

const onShareUrl = () => {
copyLink(shareUrl);
}
};

const openShareDialog = () => {
setIsShareDialogOpen(true);
}

const Buttons: HotbarButton[] = [
{
Icon: RectangleGroupIcon,
name: "Organize Layout",
onClick: doLayout,
},
{
Icon: ShareIcon,
name: "Share",
onClick: openShareDialog
}
]
};

return (
<>
<div className="flex h-fit w-fit flex-col gap-y-1 rounded-lg bg-gray-800 p-2">
{Buttons.map((button) => {
return (
<button
className="group flex flex-row items-center"
key={button.name}
onClick={button.onClick}
>
<button.Icon className="h-10 w-10 rounded-lg p-1 text-blue-100 transition-all duration-200 hover:bg-gray-700 hover:text-blue-300" />
<h1 className="absolute ml-[3.25rem] mt-0.5 w-max rounded-lg bg-gray-800 px-3 py-2 text-sm font-medium text-blue-300 opacity-0 shadow-sm transition-opacity duration-300 group-hover:opacity-100 dark:bg-gray-700">
{button.name}
</h1>
</button>
);
})}
<div className="flex h-fit w-fit flex-col gap-y-1 divide-y-2 divide-gray-600 rounded-lg bg-gray-800 p-2">
<HotbarButtonGroup>
{/* <HotbarButton
Icon={MagnifyingGlassPlusIcon}
name="Search Address"
onClick={() => {}}
/> */}
<HotbarButton
Icon={RectangleGroupIcon}
name="Organize Layout"
onClick={doLayout}
/>
</HotbarButtonGroup>
<HotbarButtonGroup className="pt-1">
<HotbarButton
Icon={ShareIcon}
name="Share"
onClick={openShareDialog}
/>
<HotbarButton
Icon={QuestionMarkCircleIcon}
name="Tutorial"
onClick={() => {
setShowTutorial(true);
}}
/>
</HotbarButtonGroup>
</div>
<ShareDialog shareUrl={shareUrl} isOpen={isShareDialogOpen} setIsOpen={setIsShareDialogOpen} onShareUrl={onShareUrl} />
<ShareDialog
shareUrl={shareUrl}
isOpen={isShareDialogOpen}
setIsOpen={setIsShareDialogOpen}
onShareUrl={onShareUrl}
/>
</>
);
};
Expand Down
7 changes: 2 additions & 5 deletions src/components/common/BigButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ const BigButton: FC<ButtonProps> = ({ onClick, text, Icon, className }) => {
type="button"
onClick={onClick}
className={clsx(
"inline-flex items-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",
"flex flex-row items-center justify-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",
className,
)}
>
<Icon
className="h-5 w-5 rounded-full text-gray-400"
aria-hidden="true"
/>
<Icon className="h-5 w-5 text-gray-400" aria-hidden="true" />
{text}
</button>
);
Expand Down
52 changes: 52 additions & 0 deletions src/components/common/Modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Transition } from "@headlessui/react";
import { Fragment } from "react";
import { Dialog } from "@headlessui/react";
import { FC, ReactNode } from "react";

interface ModalProps {
isOpen: boolean;
closeModal: () => void;
children: ReactNode;
}

const Modal: FC<ModalProps> = ({ isOpen, closeModal, children }) => {
return (
<>
<Transition appear show={isOpen} as={Fragment}>
<Dialog as="div" className="relative z-10" onClose={closeModal}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black/25" />
</Transition.Child>

<div className="fixed inset-0 flex items-center justify-center overflow-y-auto">
<div className="flex h-fit w-fit items-center justify-center p-4 text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className="rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all">
{children}
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition>
</>
);
};

export default Modal;
Loading