From 3ee5b16917c369ee21049a532d442898c3133ba4 Mon Sep 17 00:00:00 2001 From: Ochieng Paul Date: Fri, 28 Feb 2025 09:52:07 +0300 Subject: [PATCH] update organization step --- .../src/pages/account/creation/index.jsx | 93 ++++++++++--------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/src/platform/src/pages/account/creation/index.jsx b/src/platform/src/pages/account/creation/index.jsx index 94a428bfc2..51c184a39e 100644 --- a/src/platform/src/pages/account/creation/index.jsx +++ b/src/platform/src/pages/account/creation/index.jsx @@ -4,18 +4,26 @@ import GoogleLogo from '@/icons/Common/google_logo.svg'; import { getGoogleAuthDetails } from '@/core/apis/Account'; import CheckComponent from '@/components/Account/CheckComponent'; +const FORM_URL = 'https://forms.gle/VX5p2s65n8U51iBc8'; + const userRoles = [ { title: 'Individual', subText: 'Empower yourself with real-time Air Pollution Location Data for research and personal use. Stay informed, stay healthy. Join the clean air revolution today.', disabled: false, + // Internal route for individuals. + route: (router) => router.push(`/account/creation/individual/register`), }, { title: 'Organisation', subText: 'Beyond data, gain access to network management tools. Drive meaningful change, one location at a time. Shape a cleaner future for all.', - disabled: true, + disabled: false, + // External route for organisations. + route: () => { + window.location.href = FORM_URL; + }, }, ]; @@ -23,24 +31,27 @@ const UserDesignation = () => { const [clickedRole, setClickedRole] = useState(''); const router = useRouter(); - const routeToCreation = () => { - if (clickedRole) { - router.push(`/account/creation/${clickedRole.toLowerCase()}/register`); - } + const handleRoleClick = (roleTitle, disabled) => { + if (disabled) return; + setClickedRole((prevRole) => (prevRole === roleTitle ? '' : roleTitle)); }; - const handleRoleClick = (roleTitle) => { - setClickedRole((prevRole) => (prevRole === roleTitle ? '' : roleTitle)); + const routeToCreation = () => { + if (!clickedRole) return; + const selectedRole = userRoles.find((role) => role.title === clickedRole); + if (selectedRole && selectedRole.route) { + selectedRole.route(router); + } }; return (
-
+

How are you planning to use AirQo Analytics?

- We'll streamline your setup experience accordingly + We'll streamline your setup experience accordingly

@@ -48,24 +59,18 @@ const UserDesignation = () => {
{ - if (role.disabled) { - return; - } - handleRoleClick(role.title); - }} + role="button" + tabIndex={0} + onClick={() => handleRoleClick(role.title, role.disabled)} onKeyUp={(e) => { if (e.key === 'Enter' || e.key === ' ') { - if (role.disabled) { - return; - } - handleRoleClick(role.title); + handleRoleClick(role.title, role.disabled); } }} > { onClick={routeToCreation} className="mt-6 w-[262px] flex justify-center items-center px-4 py-2 bg-blue-600 text-white rounded-[12px]" > - Continue + {clickedRole === 'Organisation' ? 'Get started' : 'Continue'} )}
@@ -87,31 +92,27 @@ const UserDesignation = () => { ); }; -const GoogleAccountCreation = () => { - return ( -
-
- - Or - -
-
- -
+const GoogleAccountCreation = () => ( +
+
+ + Or +
- ); -}; +
+ +
+
+); export default UserDesignation;