diff --git a/components/calender/CalenderNav.tsx b/components/calender/CalenderNav.tsx index 1cc36c6..d7c3b73 100644 --- a/components/calender/CalenderNav.tsx +++ b/components/calender/CalenderNav.tsx @@ -33,6 +33,12 @@ const CalenderNav = (): JSX.Element => { } }; + /** + * TODO: Add logic to remove the nav buttons. + * Do not show next button for current month. + * Do not show prev when there is nothing left to see in the past. + */ + return ( { // This handles the modal for this date. const [isOpen, setIsOpen] = useState(false); + /** + * TODO: Add logic to remove the onClick within overflow dates. + * Do not give dates for the next month an onClick. + * Do not give dates in the past an onClick there is nothing before that month. + */ + return ( {isOverflow && ( diff --git a/contexts/CalenderContext.tsx b/contexts/CalenderContext.tsx index a1b1da6..32f6739 100644 --- a/contexts/CalenderContext.tsx +++ b/contexts/CalenderContext.tsx @@ -219,6 +219,17 @@ const CalenderContextProvider = ({ setSelectedMonthInfo(output); }; + // TODO: Add a function that validated if a date has at least one sticker in it. Use that within the nav function. + + // TODO: Add a function that will give the closest date, if available, when the nav func detects an empty month. + // Use the account creation date to aid with this. + + /** + * TODO: Add logic that prevents navigation to the future and too far in the past. + * Update to use a promise and return appropriate errors. Display those errors on the front end. + * Update the use of this function on the front to handle the fails of the promise. + */ + /** * Updated the selectedDate state when given the appropriate object. * @param {UpdateCalendarProps} input An object with year, month, diff --git a/pages/calendar/[...date].tsx b/pages/calendar/[...date].tsx index 2315250..3a5a771 100644 --- a/pages/calendar/[...date].tsx +++ b/pages/calendar/[...date].tsx @@ -62,6 +62,12 @@ const DateRoute: React.FC = () => { return ; } + /** + * TODO: Update to disallow navigation in the future and too far in the past. + * Update so that a date given in the future take the user to /now to today's date. + * Update so that a date given beyond the last valid date will bring the user to the last month that has stickers within it. + */ + return (