-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4d9955
commit 4d74786
Showing
24 changed files
with
431 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React, { ReactElement } from "react"; | ||
|
||
interface IGuideContainer { | ||
title: string; | ||
text: string; | ||
} | ||
|
||
export default function GuideContainer({ | ||
title, | ||
text, | ||
}: IGuideContainer): ReactElement { | ||
return ( | ||
<div className="flex flex-col gap-2"> | ||
<span className="text-lg font-medium">{title}</span> | ||
<p className="text-sm">{text}</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import React, { Fragment, ReactElement, useState } from "react"; | ||
import { | ||
setIsShowedFleetGuide, | ||
setIsShowedInstanceGuide, | ||
setIsShowedMainGuide, | ||
setIsShowedOrganizationGuide, | ||
setIsShowedRoboticsCloudGuide, | ||
} from "../../toolkit/GuideSlice"; | ||
import Button from "../Button/Button"; | ||
import { disableBodyScroll, enableBodyScroll } from "body-scroll-lock"; | ||
import { useAppDispatch, useAppSelector } from "../../hooks/redux"; | ||
import Tour from "reactour"; | ||
|
||
interface ITourGuide { | ||
type: "main" | "organization" | "roboticscloud" | "instance" | "fleet"; | ||
tourConfig: any[]; | ||
} | ||
|
||
export default function TourGuide({ | ||
type, | ||
tourConfig, | ||
}: ITourGuide): ReactElement { | ||
const [isTourOpen, setIsTourOpen] = useState<boolean>(false); | ||
|
||
const dispatch = useAppDispatch(); | ||
const { | ||
isShowedMainGuide, | ||
isShowedOrganizationGuide, | ||
isShowedRoboticsCloudGuide, | ||
isShowedInstanceGuide, | ||
isShowedFleetGuide, | ||
} = useAppSelector((state) => state.guide); | ||
|
||
const handleIsOpen = () => { | ||
switch (type) { | ||
case "main": | ||
return !isShowedMainGuide || isTourOpen; | ||
case "organization": | ||
return !isShowedOrganizationGuide || isTourOpen; | ||
case "roboticscloud": | ||
return !isShowedRoboticsCloudGuide || isTourOpen; | ||
case "instance": | ||
return !isShowedInstanceGuide || isTourOpen; | ||
case "fleet": | ||
return !isShowedFleetGuide || isTourOpen; | ||
default: | ||
return isTourOpen; | ||
} | ||
}; | ||
|
||
function handleCloseGuide() { | ||
setIsTourOpen(false); | ||
|
||
switch (type) { | ||
case "main": | ||
return dispatch(setIsShowedMainGuide()); | ||
case "organization": | ||
return dispatch(setIsShowedOrganizationGuide()); | ||
case "roboticscloud": | ||
return dispatch(setIsShowedRoboticsCloudGuide()); | ||
case "instance": | ||
return dispatch(setIsShowedInstanceGuide()); | ||
case "fleet": | ||
return dispatch(setIsShowedFleetGuide()); | ||
} | ||
} | ||
|
||
return ( | ||
<Fragment> | ||
<Button | ||
text="Show Guide" | ||
className="!w-48 !h-10 !text-xs" | ||
onClick={() => { | ||
setIsTourOpen(true); | ||
}} | ||
/> | ||
<Tour | ||
onRequestClose={handleCloseGuide} | ||
steps={tourConfig} | ||
isOpen={handleIsOpen()} | ||
maskClassName="opacity-50" | ||
className="!p-10 text-sm" | ||
rounded={5} | ||
accentColor={"#ac2dfe"} | ||
onAfterOpen={(target: any) => disableBodyScroll(target)} | ||
onBeforeClose={(target: any) => enableBodyScroll(target)} | ||
/> | ||
</Fragment> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.