Skip to content

Commit

Permalink
feat: add navigation to sign in page after click in dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Prajwalism committed Jul 2, 2024
1 parent e99517f commit 4af7417
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
20 changes: 18 additions & 2 deletions src/frontend/src/components/LandingPage/SignInOverlay/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useTypedDispatch } from '@Store/hooks';
import { useNavigate } from 'react-router-dom';
import { FlexColumn, FlexRow } from '@Components/common/Layouts';
import { Button } from '@Components/RadixComponents/Button';
import Image from '@Components/RadixComponents/Image';
Expand All @@ -12,6 +13,7 @@ import { slideVariants } from '@Constants/animations';

export default function SignInOverlay() {
const dispatch = useTypedDispatch();
const navigate = useNavigate();

return (
<motion.section
Expand All @@ -38,7 +40,14 @@ export default function SignInOverlay() {
>
<h5>Project Creator</h5>
<Image src={projectCreator} />
<Button className="!naxatw-bg-landing-red" rightIcon="east">
<Button
className="!naxatw-bg-landing-red"
rightIcon="east"
onClick={() => {
dispatch(setCommonState({ signInAs: 'Project Creator' }));
navigate('/login');
}}
>
I&apos;m a Project Creator
</Button>
</FlexColumn>
Expand All @@ -48,7 +57,14 @@ export default function SignInOverlay() {
>
<h5>Drone Operator</h5>
<Image src={droneOperator} />
<Button className="!naxatw-bg-landing-red" rightIcon="east">
<Button
className="!naxatw-bg-landing-red"
rightIcon="east"
onClick={() => {
dispatch(setCommonState({ signInAs: 'Drone Operator' }));
navigate('/login');
}}
>
I&apos;m a Drone Operator
</Button>
</FlexColumn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Button } from '@Components/RadixComponents/Button';
import Icon from '@Components/common/Icon';
import { Flex, FlexRow } from '@Components/common/Layouts';
import Person from '@Assets/images/person.svg';
import { useTypedDispatch } from '@Store/hooks';
import { useTypedDispatch, useTypedSelector } from '@Store/hooks';
import { signInGoogle, signInUser } from '@Services/common';
import { setUserState } from '@UserModule/store/actions/user';
import googleIcon from '@Assets/images/google-icon.svg';
Expand All @@ -32,6 +32,7 @@ export default function Login() {
const handleShow = () => {
return setShowPassword(prev => !prev);
};
const signInAs = useTypedSelector(state => state.common.signInAs);

const { mutate, isLoading } = useMutation<any, any, any, unknown>({
mutationFn: signInUser,
Expand Down Expand Up @@ -72,7 +73,7 @@ export default function Login() {
"
>
<Image src={Person} />
<h3>Sign In</h3>
<h3>Sign In - {signInAs}</h3>

{/* google login button */}
<div
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/src/store/slices/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface CommonState {
promptDialogContent: PromptDialogContentsType;
showMap: boolean;
openSignInMenu: boolean;
signInAs: 'Project Creator' | 'Drone Operator';
userProfileActiveTab: number;
}

Expand All @@ -23,6 +24,7 @@ const initialState: CommonState = {
promptDialogContent: null,
showMap: false,
openSignInMenu: false,
signInAs: 'Project Creator',
userProfileActiveTab: 1,
};

Expand Down

0 comments on commit 4af7417

Please sign in to comment.