Skip to content

Commit

Permalink
#2395 renamed files and moved submit and cancel text types
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaryan1203 committed May 22, 2024
1 parent 7f36d5b commit a31f091
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 0 additions & 4 deletions src/backend/src/utils/teams.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
12 changes: 6 additions & 6 deletions src/frontend/src/components/NERDraggableForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,9 +27,9 @@ export const NERDraggableForm = ({
cancelText,
submitText,
formId,
disableSuccessButton,
showCloseButton,
hideFormButtons,
disableSuccessButton = false,
showCloseButton = false,
hideFormButtons = false,
handleSubmit,
onHide
}: NERDraggableFormProps) => {
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/components/NERModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>(ChangeRequestReason.Estimation);
const [explanationForChange, setExplanationForChange] = useState('');
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/pages/GanttPage/GanttChartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -277,7 +277,7 @@ const GanttChartPage: FC = () => {
highlightedChange={ganttTaskChanges[ganttTaskChanges.length - 1]}
/>
{ganttTaskChanges.map((change) => (
<GanttRequestChangeForm change={change} open handleClose={() => removeActiveModal(change.eventId)} />
<GanttRequestChangeModal change={change} open handleClose={() => removeActiveModal(change.eventId)} />
))}
</Box>
</PageLayout>
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/src/utils/teams.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

0 comments on commit a31f091

Please sign in to comment.