Repository navigation
Typescript v6 lint fixes #2103
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
base: typescript-v6
Are you sure you want to change the base?
Typescript v6 lint fixes #2103
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,10 +26,11 @@ const AddYearPopup: FC<AddYearProps> = ({ buttonSize }) => { | |
| const currentPlan = useAppSelector(selectCurrentPlan); | ||
| const plannerYears = currentPlan.content.yearPlans; | ||
| const dispatch = useAppDispatch(); | ||
| const [currentDate] = useState(() => new Date()); | ||
|
Contributor
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. P2: Prompt for AI agents |
||
|
|
||
| const placeholderName = 'Year ' + (plannerYears.length + 1); | ||
| const placeholderYear = | ||
| plannerYears.length === 0 ? new Date().getFullYear() : plannerYears[plannerYears.length - 1].startYear + 1; | ||
| plannerYears.length === 0 ? currentDate.getFullYear() : plannerYears[plannerYears.length - 1].startYear + 1; | ||
|
|
||
| const saveHandler = (yearData: PlannerYearData) => { | ||
| const { startYear, name, quarters } = yearData; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,8 @@ const Quarter: FC<QuarterProps> = ({ yearIndex, quarterIndex, data }) => { | |
| const startYear = currentPlan.content.yearPlans[yearIndex].startYear; | ||
| const courses = data.courses; | ||
|
|
||
| const [currentDate] = useState(() => new Date()); | ||
|
Contributor
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. P2: This freezes the planner's academic-year calculation for the lifetime of each mounted Prompt for AI agents |
||
|
|
||
| // Calculate Quarter Stats | ||
| const unitCount = useMemo(() => { | ||
| const courses = data.courses; | ||
|
|
@@ -212,7 +214,6 @@ const Quarter: FC<QuarterProps> = ({ yearIndex, quarterIndex, data }) => { | |
| }); | ||
|
|
||
| const searchPrevYears = 2; | ||
| const currentDate = new Date(); | ||
| const currentStartYear = | ||
| currentDate.getMonth() >= 8 ? currentDate.getFullYear() : currentDate.getFullYear() - 1; | ||
| const useYear = Math.min(currentStartYear, startYear); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import './RecentOfferingsTooltip.scss'; | ||
| import { Tooltip } from '@mui/material'; | ||
| import { FC } from 'react'; | ||
| import { FC, useState } from 'react'; | ||
|
|
||
| import RecentOfferingsTable from '../RecentOfferingsTable/RecentOfferingsTable'; | ||
|
|
||
|
|
@@ -9,9 +9,11 @@ interface RecentOfferingsTooltipProps { | |
| } | ||
|
|
||
| const RecentOfferingsTooltip: FC<RecentOfferingsTooltipProps> = ({ terms }) => { | ||
| const [currentDate] = useState(() => new Date()); | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
Contributor
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. P2: Do not snapshot Prompt for AI agents |
||
|
|
||
| if (terms.length === 0) return null; | ||
|
|
||
| const prevYear = new Date().getMonth() > 9 ? new Date().getFullYear() : new Date().getFullYear() - 1; | ||
| const prevYear = currentDate.getMonth() > 9 ? currentDate.getFullYear() : currentDate.getFullYear() - 1; | ||
| const prevOfferings = []; | ||
|
|
||
| // if the course was offered in the previous academic year, add the corresponding emoji to prevOfferings | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,17 +12,19 @@ interface RecruitmentBannerProps { | |
|
|
||
| export function RecruitmentBanner({ deptValue }: RecruitmentBannerProps) { | ||
| const [bannerVisibility, setBannerVisibility] = useState(true); | ||
| const [now, setNow] = useState(() => Date.now()); | ||
|
Contributor
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. P2: This mount-time Prompt for AI agents |
||
|
|
||
| const theme = useTheme(); | ||
|
|
||
| const recruitmentDismissalTime = getLocalStorageRecruitmentDismissalTime(); | ||
| const dismissedRecently = | ||
| recruitmentDismissalTime !== null && | ||
| Date.now() - parseInt(recruitmentDismissalTime) < 11 * 7 * 24 * 3600 * 1000; | ||
| recruitmentDismissalTime !== null && now - parseInt(recruitmentDismissalTime) < 11 * 7 * 24 * 3600 * 1000; | ||
| const isRelevantDept = RELEVANT_DEPARTMENTS.includes(deptValue.toUpperCase()); | ||
| const displayRecruitmentBanner = bannerVisibility && !dismissedRecently && isRelevantDept; | ||
|
|
||
| const handleClick = () => { | ||
| setLocalStorageRecruitmentDismissalTime(Date.now().toString()); | ||
| setNow(Date.now()); | ||
| setBannerVisibility(false); | ||
| }; | ||
|
|
||
|
|
||
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.
P2: Enabling
react/puritystill leaves the plannerLogocomponent constructing aDateduring render, so the planner lint target will fail. Move this date into a lazy state or otherwise fix the render-time impure call before enabling the rule.Prompt for AI agents