diff --git a/apps/dashboard/src/components/group-card.tsx b/apps/dashboard/src/components/group-card.tsx index ed8b3860..45fd1305 100644 --- a/apps/dashboard/src/components/group-card.tsx +++ b/apps/dashboard/src/components/group-card.tsx @@ -86,16 +86,16 @@ export default function GroupCard({ mt="12px" color={!name ? "balticSea.400" : "inherit"} > - {name || "[untitled]"} + {name || (type === "off-chain" ? "[untitled]" : "")} - - {type !== "on-chain" && - (description || "[no description yet]")} + {type === "off-chain" + ? description || "[no description yet]" + : null} diff --git a/apps/dashboard/src/components/new-group-stepper/general-info-step.tsx b/apps/dashboard/src/components/new-group-stepper/general-info-step.tsx index 99567349..8c5eccfb 100644 --- a/apps/dashboard/src/components/new-group-stepper/general-info-step.tsx +++ b/apps/dashboard/src/components/new-group-stepper/general-info-step.tsx @@ -50,6 +50,24 @@ export default function GeneralInfoStep({ group.fingerprintDuration ) + const validateGroup = () => { + if (group.type === "off-chain") { + const isNameInvalid = !_groupName + const isDescriptionInvalid = + !_groupDescription || _groupDescription.length < 10 + const isFingerprintDurationInvalid = + _fingerprintDuration === undefined || _fingerprintDuration < 0 + + return ( + isNameInvalid || + isDescriptionInvalid || + isFingerprintDurationInvalid + ) + } + + return false + } + return ( <> What type of group is this? @@ -122,31 +140,33 @@ export default function GeneralInfoStep({ {groupType === "on-chain" ? "The group will be fully decentralized and will live on the Ethereum blockchain." - : "The group will be stored in the Bandada servers but the fingerprint will still be stored on-chain."} + : "The group will be stored in the Bandada servers."} ))} - - Name - - setGroupName(event.target.value)} - onBlur={() => - onSubmit({ ...group, name: _groupName }, false) - } - /> - - Give it a cool name you can recognize. - - - {group.type === "off-chain" && ( <> + + Name + + + setGroupName(event.target.value) + } + onBlur={() => + onSubmit({ ...group, name: _groupName }, false) + } + /> + + Give it a cool name you can recognize. + + + Description @@ -242,18 +262,10 @@ export default function GeneralInfoStep({ Cancel diff --git a/apps/dashboard/src/pages/new-group.tsx b/apps/dashboard/src/pages/new-group.tsx index d7d0d3bb..9f279bb0 100644 --- a/apps/dashboard/src/pages/new-group.tsx +++ b/apps/dashboard/src/pages/new-group.tsx @@ -8,7 +8,8 @@ import GroupSizeStep from "../components/new-group-stepper/group-size-step" import StepperNav from "../components/new-group-stepper/stepper-nav" import StepperPreview from "../components/new-group-stepper/stepper-preview" -const steps = ["General info", "Group size", "Access mode", "Summary"] +const offchainSteps = ["General info", "Group size", "Access mode", "Summary"] +const onchainSteps = ["General info", "Summary"] export default function NewGroupPage(): JSX.Element { const [_currentStep, setCurrentStep] = useState(0) @@ -26,6 +27,10 @@ export default function NewGroupPage(): JSX.Element { if (next) { setCurrentStep((v) => v + 1) } + + if (group.type === "on-chain" && !next) { + setGroup({ type: "on-chain", fingerprintDuration: 3600 }) + } }, []) const finalPreviewBack = useCallback(() => { @@ -49,13 +54,16 @@ export default function NewGroupPage(): JSX.Element { _group.type !== "on-chain" || i !== 2 - )} + steps={ + _group.type === "off-chain" + ? offchainSteps + : onchainSteps + } /> - {_group.type === "off-chain" && _currentStep !== 3 ? ( + {(_group.type === "off-chain" && _currentStep !== 3) || + (_group.type === "on-chain" && _currentStep !== 1) ? ( <> @@ -67,27 +75,35 @@ export default function NewGroupPage(): JSX.Element { flex="1" align="left" > - {_currentStep === 0 ? ( + {_group.type === "off-chain" && + (_currentStep === 0 ? ( + navigate("/groups")} + /> + ) : _currentStep === 1 ? ( + setCurrentStep(0)} + /> + ) : ( + _currentStep === 2 && ( + setCurrentStep(1)} + /> + ) + ))} + + {_group.type === "on-chain" && ( navigate("/groups")} /> - ) : _currentStep === 1 ? ( - setCurrentStep(0)} - /> - ) : ( - _group.type !== "on-chain" && - _currentStep === 2 && ( - setCurrentStep(1)} - /> - ) )} diff --git a/apps/docs/docs/tutorials/dashboard/on-chain/onchain.md b/apps/docs/docs/tutorials/dashboard/on-chain/onchain.md index 3495a328..ecfc10cd 100644 --- a/apps/docs/docs/tutorials/dashboard/on-chain/onchain.md +++ b/apps/docs/docs/tutorials/dashboard/on-chain/onchain.md @@ -9,11 +9,12 @@ title: Create group 1. To create an on-chain group, select the `On-chain` group type. -![Create on-chain group](../../../../static/img/tutorial/create.png) +![Create on-chain group](../../../../static/img/tutorial/onchain.png) -2. You will be redirected to the `Group Preview` page upon selecting the `On-chain` type in the group type selection. -3. Unlike an off-chain group, you do not have to input any group details to create an on-chain group. -4. Click `Create Group` to finalize the group creation. +2. Unlike an off-chain group, you do not have to input any group details to create an on-chain group. +3. Click on `Continue` to proceed. +4. You will be redirected to the `Group Preview` page to reivew the group details. +5. Click `Create Group` to finalize the group creation. ![Create on-chain group preview](../../../../static/img/tutorial/onchain-preview.png) diff --git a/apps/docs/static/img/tutorial/onchain-preview.png b/apps/docs/static/img/tutorial/onchain-preview.png index d200d5b7..3c036e68 100644 Binary files a/apps/docs/static/img/tutorial/onchain-preview.png and b/apps/docs/static/img/tutorial/onchain-preview.png differ diff --git a/apps/docs/static/img/tutorial/onchain.png b/apps/docs/static/img/tutorial/onchain.png new file mode 100644 index 00000000..3abe6a34 Binary files /dev/null and b/apps/docs/static/img/tutorial/onchain.png differ