-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#933): guided tour interface for playground
- Loading branch information
Showing
9 changed files
with
604 additions
and
66 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
34 changes: 34 additions & 0 deletions
34
playground/src/_assets/less/components/_tour_ant_override.less
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,34 @@ | ||
.ant-tour-title{ | ||
font-size: 20px !important; | ||
font-weight: bolder !important; | ||
text-align: center !important; | ||
margin-top: 20px !important; | ||
} | ||
|
||
.ant-tour{ | ||
background-color: var(--background-base) !important; | ||
} | ||
|
||
.ant-tour-inner{ | ||
background-color: var(--background-base) !important; | ||
} | ||
|
||
.ant-tour-footer{ | ||
padding: 26px 26px 26px 26px !important; | ||
} | ||
|
||
.ant-tour-indicator{ | ||
width: 8px !important; | ||
height: 8px !important; | ||
} | ||
|
||
.ant-tour-arrow { | ||
width: 0; | ||
height: 0; | ||
border-left: 10px solid transparent; | ||
border-right: 10px solid transparent; | ||
border-bottom: 10px solid var(--background-base) !important; /* Change color as needed */ | ||
position: absolute; | ||
transform: translateX(-50%); | ||
} | ||
|
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 was deleted.
Oops, something went wrong.
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,88 @@ | ||
import React, {useState} from "react"; | ||
import {Tour} from "antd"; | ||
import {toAbsoluteUrl} from "../../utility/helpers/asset"; | ||
|
||
const Link = ({href, text}) => ( | ||
<a href={href} target="_blank" rel="noreferrer noopener" className="text-primary"> | ||
{text} | ||
</a> | ||
); | ||
|
||
export default function GuidedTour({refSchemaEditor, refRelationshipsAndAttributes, refEnforcement}) { | ||
const [open, setOpen] = useState(!(localStorage.getItem("hasSeenGuidedTour") === "true")); | ||
|
||
const onTourClose = () => { | ||
localStorage.setItem("hasSeenGuidedTour", "true"); | ||
setOpen(false); | ||
}; | ||
|
||
const steps = [ | ||
{ | ||
title: "Welcome to the Permify Playground!", | ||
placement: "center", | ||
description: ( | ||
<div className="p-10"> | ||
<div className="p-10 text-center"> | ||
<img alt="welcome" src={toAbsoluteUrl("/media/svg/welcome.svg")}/> | ||
</div> | ||
<p className="text-center"> | ||
This environment enables you to create and test your authorization schema within a browser. The | ||
Permify playground comprises three main sections: <b>Schema (Authorization Model)</b>, <b>Authorization | ||
Data</b> and <b>Enforcement</b>. While we cover these | ||
sections in this tour, you can find the complete documentation at <Link | ||
href="https://docs.permify.co/" text="docs.permify.co"/>. | ||
</p> | ||
</div> | ||
), | ||
}, | ||
{ | ||
title: "Schema (Authorization Model)", | ||
target: refSchemaEditor.current, | ||
description: ( | ||
<div className="p-10"> | ||
<p className="text-center"> | ||
You can create your authorization model in this section with using our domain specific language. | ||
We already have a couple of use cases and example that you can choose from the dropdown above. | ||
Also, you can check our{" "} | ||
<Link href="https://docs.permify.co/docs/getting-started/modeling/" text="docs"/> to learn more | ||
about how to model authorization in Permify. | ||
</p> | ||
</div> | ||
), | ||
}, | ||
{ | ||
title: "Authorization Data", | ||
target: refRelationshipsAndAttributes.current, | ||
description: ( | ||
<div className="p-10"> | ||
<p className="text-center"> | ||
You can create sample authorization data to test your authorization logic. For instance, to | ||
create a | ||
relationship between your defined entities, simply click the 'Add Relationship' button. For | ||
further | ||
information on data creation, please | ||
refer to <Link href="https://docs.permify.co/docs/getting-started/sync-data/" text="docs"/>. | ||
</p> | ||
</div> | ||
), | ||
}, | ||
{ | ||
title: "Enforcement", | ||
target: refEnforcement.current, | ||
description: ( | ||
<div className="p-10"> | ||
<p className="text-center"> | ||
Now that we have sample data and a defined schema, let's perform an access check! The YAML in | ||
the | ||
Enforcement section represents a test scenario for conducting access checks. To learn more about | ||
the | ||
capabilities of this YAML, refer to:{" "} | ||
<Link href="https://docs.permify.co/docs/playground/#enforcement-access-check-scenarios" | ||
text="docs"/>. | ||
</p> | ||
</div> | ||
), | ||
}, | ||
]; | ||
return <Tour open={open} steps={steps} onClose={onTourClose} scrollIntoViewOptions={false}/>; | ||
} |
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