Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

978, Part 1, Creating onboarding modal component #1003

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/app/pages/users/me.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Page from '@devlaunchers/website/src/pages/users/me';
import IdeaApp from '@devlaunchers/website/src/pages/_app';
export { getStaticProps } from '@devlaunchers/website/src/pages/index';
// export { getStaticProps, getStaticPaths } from '@devlaunchers/website/src/pages/users/me';

/////////////////////////////////////////

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@











export default function DiscordOnboarding() {
return(<></>);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./DiscordOnboarding";
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@







export default function PlatformOnboarding() {
return(<></>);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./PlatformOnboarding";
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import styled from "styled-components";

export const ModalContainer = styled.div`
width: 100%;
height: 100%;
font-family: "Abel", sans-serif;
`;

export const ModalHeader = styled.div`
width: 100%;
${'' /* Enter styling */}
`;

export const ModalBody = styled.div`
padding: 0 120px;
${'' /* Enter styling */}
`;

// Modal set up
export const userUnboardingModalStyle = {
content: {
position: "absolute",
width: "50%",
padding: "0px",
height: "80%",
top: "50%",
left: "50%",
overflow: "hidden",
right: "auto",
bottom: "auto",
marginRight: "-50%",
transform: "translate(-50%, -50%)",
zIndex: 1001
},
overlay: { zIndex: 1000, backgroundColor: "rgba(0,0,0,.75)" }
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

export default function ThirdPartyOnboarding() {
return(<></>);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./ThirdPartyOnboarding";
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {useState, useEffect} from "react";
import Modal from "react-modal";

import PlatformOnboarding from "./PlatformOnboarding/PlatformOnboarding";
import Typography from "@devlaunchers/components/components/atoms/Typography";
import { ModalContainer, userUnboardingModalStyle, ModalHeader, ModalBody } from "./StyledUserOnboardingModal";

Modal.setAppElement("#__next");

/**
* @description This is custom modal for the user onboarding.
*/
export default function UserOnboardingModal({isOpen}) {
const [modalIsOpen, setModalIsOpen] = useState(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, Jude!


const openModal = () => {
setModalIsOpen(true);
}
// const afterOpenModal = () => {
// // references are now sync'd and can be accessed.
// }
const closeModal = () => {
setModalIsOpen(false);
}
return (
<>
{/* "modalIsOpen ? true : false" set this way until we start adding typescript for
boolean type */}
<Modal
isOpen={modalIsOpen ? true : false}
onRequestOpen={openModal}
onRequestClose={closeModal}
style={userUnboardingModalStyle}
contentLabel="User Onboarding"
>
<ModalContainer>
<ModalHeader><Typography type="h4"> Modal Title</Typography></ModalHeader>
<ModalBody>
<Typography type="p"> body</Typography>
{/* Onboarding Card Component */}
</ModalBody>
</ModalContainer>
</Modal>
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./UserOnboardingModal";
32 changes: 27 additions & 5 deletions apps/website/src/pages/users/me.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
import React from "react";

import Header from "../../components/common/Header";
import { useUserDataContext } from '../../context/UserDataContext';

import Head from 'next/head';
import UserProfile from "../../components/modules/UserProfile";
import Footer from "../../components/common/Footer";
import UserOnboardingModal from "../../components/modules/UserOnboardingModal"

/**
* @drescription This component renders the User Profile Component.
* A Modal is opened when user has not fully completed their onboarding.
*/
export default function UserProfilePage() {
const { userData } = useUserDataContext();

/**
* @description Open modal when user has no username.
* More conditions will be applied when modal should be opened in the future.
*/
const openUserOnboardingModal = () => {
return !(userData && userData.username)
}

return (
<div>
<UserProfile />
</div>
<>
<Head>
<title>User Profile</title>
</Head>
<div>
{openUserOnboardingModal() && <UserOnboardingModal/>}
<UserProfile />
</div>
</>
);
}