-
Notifications
You must be signed in to change notification settings - Fork 4
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
[FEATURE] "What's New" Pop-Up #757
Merged
Merged
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e5fc641
Created Modal with multiple pages to describe each feature
ShireenKumar 66a7584
Update FullPageModal.tsx
ShireenKumar 2e2504e
update cookies code + removing unused comments
KobeZ123 f5ece2d
adding pagination layout
KobeZ123 5d4f2ea
working on modal part 1
KobeZ123 d56750c
update entry point for whats new modal
KobeZ123 47e229e
adding images to pages and updating context issue
KobeZ123 a43a443
update pages to align with design
KobeZ123 672224a
Merge branch 'main' into whats-new-modal
KobeZ123 30da862
update header icons
KobeZ123 c2cfdd6
update copy and designs of modal pages
KobeZ123 ddbb298
fix linting
KobeZ123 c1aab5b
remove unused icon
KobeZ123 8faae11
Merge branch 'main' into whats-new-modal
KobeZ123 f8c67bf
abstract new feature page data
KobeZ123 efba0c1
linting fix
KobeZ123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
packages/frontend/components/FullPageModal/FullPageModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import React, { useState } from "react"; | ||
import { | ||
Button, | ||
Modal, | ||
ModalBody, | ||
ModalContent, | ||
ModalFooter, | ||
ModalHeader, | ||
ModalOverlay, | ||
Text, | ||
} from "@chakra-ui/react"; | ||
|
||
interface WhatsNewPopUpProps { | ||
// is model open or not? | ||
isOpen: boolean; | ||
// Closes the modal | ||
onClose: () => void; | ||
} | ||
|
||
export const WhatsNewPopUp: React.FC<WhatsNewPopUpProps> = ({ | ||
isOpen, | ||
onClose, | ||
}) => { | ||
const [pageNum, setPageNum] = useState(1); | ||
const nextPage = () => setPageNum((prev) => prev + 1); | ||
const prevPage = () => setPageNum((prev) => prev - 1); | ||
const renderPage = () => { | ||
switch (pageNum) { | ||
case 1: | ||
return ( | ||
<> | ||
<Text color="tomato" as="b"> | ||
NEW PAGE 1 | ||
</Text> | ||
<Text>these are the new features</Text> | ||
</> | ||
); | ||
case 2: | ||
return ( | ||
<> | ||
<Text color="tomato" as="b"> | ||
NEW PAGE 2 | ||
</Text> | ||
<Text>these are the new features</Text> | ||
</> | ||
); | ||
case 3: | ||
return ( | ||
<> | ||
<Text color="tomato" as="b"> | ||
NEW PAGE 3 | ||
</Text> | ||
<Text>these are the new features</Text> | ||
</> | ||
); | ||
} | ||
}; | ||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose} size="4xl" isCentered> | ||
<ModalOverlay /> | ||
<ModalContent> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new component for new releases can be a ModalContent |
||
<ModalHeader | ||
color="primary.blue.dark.main" | ||
borderBottom="1px" | ||
borderColor="neutral.200" | ||
> | ||
<Text>Latest Release v26.09.24</Text> | ||
</ModalHeader> | ||
<ModalBody>{renderPage()}</ModalBody> | ||
<ModalFooter justifyContent="space-between"> | ||
{pageNum > 1 && ( | ||
<Button variant="outline" onClick={prevPage}> | ||
Previous | ||
</Button> | ||
)} | ||
{pageNum < 3 ? ( | ||
<Button colorScheme="blue" onClick={nextPage}> | ||
Next | ||
</Button> | ||
) : ( | ||
<Button colorScheme="red" onClick={onClose}> | ||
Looks Good! | ||
</Button> | ||
)} | ||
</ModalFooter> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,8 @@ | |
getPreReqWarnings, | ||
} from "../utils/plan/preAndCoReqCheck"; | ||
import { IsGuestContext } from "./_app"; | ||
import { WhatsNewPopUp } from "../components/FullPageModal/FullPageModal"; | ||
import Cookies from "universal-cookie"; | ||
|
||
// Algorithm to decide which droppable the course is currently over (if any). | ||
// See https://docs.dndkit.com/api-documentation/context-provider/collision-detection-algorithms for more info. | ||
|
@@ -66,6 +68,43 @@ | |
const HomePage: NextPage = () => { | ||
const { error, student, mutateStudent } = useStudentWithPlans(); | ||
const router = useRouter(); | ||
// How we keep track if the modal is open or closed | ||
const [isOpen, setIsOpen] = useState(false); | ||
const cookies = new Cookies(); | ||
// useEffect(() => { | ||
// setIsOpen(true); // Show the modal when the component renders | ||
// }, []); | ||
|
||
// when the modal closes | ||
// useEffect(() => { | ||
// const cookies = new Cookies(); | ||
// const existingToken = cookies.get('FeedbackModal JWT'); | ||
// if (existingToken) { | ||
// setIsOpen(false); // Don't show the modal | ||
// } else { | ||
// setIsOpen(true); | ||
// const newtoken = 'alreadyShowedModal'; | ||
// cookies.set('FeedbackModal JWT', newtoken, { path: '/' }); | ||
// // Show the modal | ||
// } | ||
// }, []); | ||
|
||
useEffect(() => { | ||
const existingToken = cookies.get("FeedbackModal JWT"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's change the cookies token name to something more closely associated |
||
|
||
if (!existingToken) { | ||
setIsOpen(true); // Open modal only if token doesn't exist | ||
} | ||
}, []); | ||
|
||
const handleClose = () => { | ||
setIsOpen(false); // Close the modal when user dismisses it | ||
const cookies = new Cookies(); | ||
const newToken = "alreadyShowedModal"; | ||
cookies.set("FeedbackModal JWT", newToken, { path: "/" }); // Set the token when user closes the modal | ||
}; | ||
|
||
// const onClose = () => setIsOpen(false); | ||
|
||
/* | ||
* Keep track of the plan being displayed, initially undef and later either the plan id or null. | ||
|
@@ -325,6 +364,13 @@ | |
/> | ||
) : null} | ||
</DragOverlay> | ||
|
||
<WhatsNewPopUp | ||
isOpen={isOpen} | ||
onClose={handleClose} | ||
// handleCancel | ||
//() => setIsOpen(false) | ||
/> | ||
</DndContext> | ||
); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make this a new component based on what release we want to display.