Skip to content

Commit

Permalink
Add coachmark (Welcome Wagon) (#732)
Browse files Browse the repository at this point in the history
* Add coachmark when no plan is selected

* Remove unneeded comment

* Transfer courses only render when a plan is selected
  • Loading branch information
BrandonLim8890 authored Apr 10, 2024
1 parent ba03edc commit 1e31164
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
31 changes: 23 additions & 8 deletions packages/frontend/components/Plan/AddPlanModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
ModalOverlay,
VStack,
useDisclosure,
Tooltip,
} from "@chakra-ui/react";
import { API } from "@graduate/api-client";
import {
Expand Down Expand Up @@ -48,10 +49,12 @@ import { getLocalPlansLength } from "../../utils/plan/getLocalPlansLength";

interface AddPlanModalProps {
setSelectedPlanId: Dispatch<SetStateAction<number | undefined | null>>;
selectedPlanId: number | undefined | null;
}

export const AddPlanModal: React.FC<AddPlanModalProps> = ({
setSelectedPlanId,
selectedPlanId,
}) => {
const router = useRouter();
const { onOpen, onClose: onCloseDisplay, isOpen } = useDisclosure();
Expand Down Expand Up @@ -178,6 +181,7 @@ export const AddPlanModal: React.FC<AddPlanModalProps> = ({
);

const disableButton = isGuest && getLocalPlansLength() > 4;
const showCoachMark = !selectedPlanId && !isOpen;

return (
<>
Expand All @@ -186,15 +190,26 @@ export const AddPlanModal: React.FC<AddPlanModalProps> = ({
shouldWrapChildren
isDisabled={!disableButton}
>
<BlueButton
leftIcon={<AddIcon />}
onClick={onOpen}
ml="xs"
size="md"
disabled={disableButton}
<Tooltip
shouldWrapChildren
label="Click here to start!"
hasArrow
fontSize="md"
borderRadius="sm"
shadow="lg"
isDisabled
isOpen={showCoachMark}
>
New Plan
</BlueButton>
<BlueButton
leftIcon={<AddIcon />}
onClick={onOpen}
ml="xs"
size="md"
disabled={disableButton}
>
New Plan
</BlueButton>
</Tooltip>
</GraduateToolTip>
<Modal isOpen={isOpen} onClose={() => onCloseAddPlanModal()} size="md">
<ModalOverlay />
Expand Down
17 changes: 10 additions & 7 deletions packages/frontend/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@ const HomePage: NextPage = () => {
setSelectedPlanId={setSelectedPlanId}
plans={student.plans}
/>
<AddPlanModal setSelectedPlanId={setSelectedPlanId} />
<AddPlanModal
setSelectedPlanId={setSelectedPlanId}
selectedPlanId={selectedPlanId}
/>
{selectedPlan && <EditPlanModal plan={selectedPlan} />}
{selectedPlan && (
<DuplicatePlanButton
Expand All @@ -303,14 +306,14 @@ const HomePage: NextPage = () => {
setIsRemove={setIsRemove}
/>
<Divider borderColor="neutral.200" borderWidth={1} />
<TransferCourses
isExpanded={isTransferCoursesExpanded}
toggleExpanded={() =>
setIsTransferCoursesExpanded(!isTransferCoursesExpanded)
}
/>
</>
)}
<TransferCourses
isExpanded={isTransferCoursesExpanded}
toggleExpanded={() =>
setIsTransferCoursesExpanded(!isTransferCoursesExpanded)
}
/>
</Flex>
</Box>
</PageLayout>
Expand Down

0 comments on commit 1e31164

Please sign in to comment.