diff --git a/src/backend/src/utils/teams.utils.ts b/src/backend/src/utils/teams.utils.ts index 01b1653af2..bd1a887c1e 100644 --- a/src/backend/src/utils/teams.utils.ts +++ b/src/backend/src/utils/teams.utils.ts @@ -88,7 +88,3 @@ export const removeUsersFromList = (currentUsers: UserWithId[], usersToRemove: U const userIdsToRemove = usersToRemove.map((user) => user.userId); return currentUsers.filter((user) => !userIdsToRemove.includes(user.userId)); }; - -export type submitText = 'Submit' | 'Save' | 'Create' | 'Yes' | 'Delete' | 'Schedule' | 'Send To Advisor' | 'Submit to SABO'; - -export type cancelText = 'Cancel' | 'Delete' | 'Exit' | 'No'; diff --git a/src/frontend/src/components/NERDraggableForm.tsx b/src/frontend/src/components/NERDraggableForm.tsx index ae5b36f480..a6a3df4ea5 100644 --- a/src/frontend/src/components/NERDraggableForm.tsx +++ b/src/frontend/src/components/NERDraggableForm.tsx @@ -4,14 +4,14 @@ import NERSuccessButton from './NERSuccessButton'; import Draggable from 'react-draggable'; import CloseIcon from '@mui/icons-material/Close'; import { ReactNode } from 'react'; -import { cancelText, submitText } from '../../../backend/src/utils/teams.utils'; +import { CancelText, SubmitText } from '../utils/teams.utils'; interface NERDraggableFormProps { open: boolean; title: string; children?: ReactNode; - cancelText?: cancelText; - submitText?: submitText; + cancelText?: CancelText; + submitText?: SubmitText; formId?: string; disableSuccessButton?: boolean; showCloseButton?: boolean; @@ -27,9 +27,9 @@ export const NERDraggableForm = ({ cancelText, submitText, formId, - disableSuccessButton, - showCloseButton, - hideFormButtons, + disableSuccessButton = false, + showCloseButton = false, + hideFormButtons = false, handleSubmit, onHide }: NERDraggableFormProps) => { diff --git a/src/frontend/src/components/NERModal.tsx b/src/frontend/src/components/NERModal.tsx index 0a76702f93..5217bbc261 100644 --- a/src/frontend/src/components/NERModal.tsx +++ b/src/frontend/src/components/NERModal.tsx @@ -3,7 +3,7 @@ import NERFailButton from './NERFailButton'; import NERSuccessButton from './NERSuccessButton'; import { ReactNode } from 'react'; import CloseIcon from '@mui/icons-material/Close'; -import { cancelText, submitText } from '../../../backend/src/utils/teams.utils'; +import { CancelText, SubmitText } from '../utils/teams.utils'; const background = '#ef4345'; @@ -14,8 +14,8 @@ export interface NERModalProps { onSubmit?: () => void; onHide: () => void; children?: ReactNode; - cancelText?: cancelText; - submitText?: submitText; + cancelText?: CancelText; + submitText?: SubmitText; disabled?: boolean; showCloseButton?: boolean; hideFormButtons?: boolean; diff --git a/src/frontend/src/pages/GanttPage/GanttChartComponents/GanttRequestChangeForm.tsx b/src/frontend/src/pages/GanttPage/GanttChartComponents/GanttRequestChangeModal.tsx similarity index 96% rename from src/frontend/src/pages/GanttPage/GanttChartComponents/GanttRequestChangeForm.tsx rename to src/frontend/src/pages/GanttPage/GanttChartComponents/GanttRequestChangeModal.tsx index 1d61d4b97a..526ad8b457 100644 --- a/src/frontend/src/pages/GanttPage/GanttChartComponents/GanttRequestChangeForm.tsx +++ b/src/frontend/src/pages/GanttPage/GanttChartComponents/GanttRequestChangeModal.tsx @@ -10,13 +10,13 @@ import { useSingleWorkPackage } from '../../../hooks/work-packages.hooks'; import { useToast } from '../../../hooks/toasts.hooks'; import { NERDraggableForm } from '../../../components/NERDraggableForm'; -interface GanttRequestChangeFormProps { +interface GanttRequestChangeModalProps { change: RequestEventChange; handleClose: () => void; open: boolean; } -export const GanttRequestChangeForm = ({ change, handleClose, open }: GanttRequestChangeFormProps) => { +export const GanttRequestChangeModal = ({ change, handleClose, open }: GanttRequestChangeModalProps) => { const toast = useToast(); const [reasonForChange, setReasonForChange] = useState(ChangeRequestReason.Estimation); const [explanationForChange, setExplanationForChange] = useState(''); diff --git a/src/frontend/src/pages/GanttPage/GanttChartPage.tsx b/src/frontend/src/pages/GanttPage/GanttChartPage.tsx index 8015021b45..02907fcafa 100644 --- a/src/frontend/src/pages/GanttPage/GanttChartPage.tsx +++ b/src/frontend/src/pages/GanttPage/GanttChartPage.tsx @@ -33,7 +33,7 @@ import GanttChart from './GanttChart'; import { useAllTeamTypes } from '../../hooks/design-reviews.hooks'; import { Team, TeamType } from 'shared'; import { useAllTeams } from '../../hooks/teams.hooks'; -import { GanttRequestChangeForm } from './GanttChartComponents/GanttRequestChangeForm'; +import { GanttRequestChangeModal } from './GanttChartComponents/GanttRequestChangeModal'; const GanttChartPage: FC = () => { const query = useQuery(); @@ -277,7 +277,7 @@ const GanttChartPage: FC = () => { highlightedChange={ganttTaskChanges[ganttTaskChanges.length - 1]} /> {ganttTaskChanges.map((change) => ( - removeActiveModal(change.eventId)} /> + removeActiveModal(change.eventId)} /> ))} diff --git a/src/frontend/src/utils/teams.utils.ts b/src/frontend/src/utils/teams.utils.ts index 89116b7166..65b2184b88 100644 --- a/src/frontend/src/utils/teams.utils.ts +++ b/src/frontend/src/utils/teams.utils.ts @@ -32,3 +32,7 @@ export const userToAutocompleteOption = (user?: User): { label: string; id: stri export const userComparator = (user1: User, user2: User) => { return user1.firstName > user2.firstName ? 1 : -1; }; + +export type SubmitText = 'Submit' | 'Save' | 'Create' | 'Yes' | 'Delete' | 'Schedule' | 'Send To Advisor' | 'Submit to SABO'; + +export type CancelText = 'Cancel' | 'Delete' | 'Exit' | 'No';