diff --git a/frontend/degree-plan/components/FourYearPlan/DegreeModal.tsx b/frontend/degree-plan/components/FourYearPlan/DegreeModal.tsx index 8c10a05c..7a748267 100644 --- a/frontend/degree-plan/components/FourYearPlan/DegreeModal.tsx +++ b/frontend/degree-plan/components/FourYearPlan/DegreeModal.tsx @@ -27,6 +27,7 @@ export type ModalKey = | "degree-add" | "degree-remove" | "semester-remove" + | "semester-add" | null; // null is closed const getModalTitle = (modalState: ModalKey) => { @@ -50,7 +51,7 @@ const getModalTitle = (modalState: ModalKey) => { } }; -const ModalInteriorWrapper = styled.div<{ $row?: boolean }>` +export const ModalInteriorWrapper = styled.div<{ $row?: boolean }>` display: flex; flex-direction: ${(props) => (props.$row ? "row" : "column")}; align-items: center; @@ -74,7 +75,7 @@ const ModalText = styled.div` font-size: 0.87rem; `; -const ModalButton = styled.button` +export const ModalButton = styled.button` margin: 0px 0px 0px 0px; height: 32px; width: 5rem; @@ -85,7 +86,7 @@ const ModalButton = styled.button` border: none; `; -const ButtonRow = styled.div<{ $center?: boolean }>` +export const ButtonRow = styled.div<{ $center?: boolean }>` display: flex; width: 100%; flex-direction: row; @@ -93,7 +94,7 @@ const ButtonRow = styled.div<{ $center?: boolean }>` gap: 0.5rem; `; -const CancelButton = styled.button` +export const CancelButton = styled.button` margin: 0px 0px 0px 0px; height: 29px; width: 4rem; @@ -140,12 +141,12 @@ interface RemoveSemesterProps { interface ModalInteriorProps { modalKey: ModalKey; - modalObject: DegreePlan | null | RemoveSemesterProps | RemoveDegreeProps | Degree; + modalObject: DegreePlan | null | RemoveSemesterProps | RemoveDegreeProps | Degree | HTMLElement; setActiveDegreeplan: (arg0: DegreePlan | null) => void; close: () => void; modalRef: React.RefObject; } -const ModalInterior = ({ +export const ModalInterior = ({ modalObject, modalKey, setActiveDegreeplan, @@ -390,3 +391,4 @@ const DegreeModal = ({ ); export default DegreeModal; + diff --git a/frontend/degree-plan/components/FourYearPlan/PlanPanel.tsx b/frontend/degree-plan/components/FourYearPlan/PlanPanel.tsx index 826c2171..ae2b81eb 100644 --- a/frontend/degree-plan/components/FourYearPlan/PlanPanel.tsx +++ b/frontend/degree-plan/components/FourYearPlan/PlanPanel.tsx @@ -13,6 +13,10 @@ const ShowStatsText = styled.div` min-width: 6rem; ` +const AddSemText = styled.div` + min-width: 8rem; +` + const ShowStatsButton = ({ showStats, setShowStats }: { showStats: boolean, setShowStats: (arg0: boolean) => void }) => ( setShowStats(!showStats)}> @@ -24,6 +28,22 @@ const ShowStatsButton = ({ showStats, setShowStats }: { showStats: boolean, setS ); +interface AddSemesterButtonProp { + editMode: boolean, + setShowAddSemModal: (arg0: boolean) => void +} + +const AddSemesterButton = ({editMode, setShowAddSemModal} : AddSemesterButtonProp) => editMode && ( + setShowAddSemModal(true)}> + + + + + Add Semester + + +) + interface PlanPanelProps { setModalKey: (arg0: ModalKey) => void; modalKey: string | null; @@ -50,6 +70,7 @@ const PlanPanel = ({ const { copy: copyDegreeplan } = useSWRCrud('/api/degree/degreeplans'); const [showStats, setShowStats] = useState(true); const [editMode, setEditMode] = useState(false); + const [showAddSemModal, setShowAddSemModal] = useState(false); return ( @@ -80,17 +101,20 @@ const PlanPanel = ({ isLoading={isLoading} /> + - + {/** map to semesters */} - { const year = parseInt(semester.slice(0, 4)); @@ -68,9 +70,10 @@ const AddButton = styled.div` const YearInput = styled.input` width: 9rem; + height: 2.6rem; background-color: transparent; border-color: #9FB5EF; - color: #C1C1C1; + color: #FF; box-shadow: none; &:hover { borderColor: "#9FB5EF"; @@ -87,10 +90,20 @@ const YearInput = styled.input` font-size: 1rem; ` -const selectStyles = (topOrBottom: boolean) => ({ +export const InputColumn = styled.div` + display: flex; + flex-direction: column; + flex: 1; + gap: 1rem; + padding-right: 2%; + margin-bottom: 1rem; +`; + +const selectStyles = { control: (provided: any) => ({ ...provided, - width: "9rem", + width: "100%", + height: '2.5rem', backgroundColor: "transparent", borderColor: "#9FB5EF", color: "#C1C1C1", @@ -98,28 +111,22 @@ const selectStyles = (topOrBottom: boolean) => ({ "&:hover": { borderColor: "#9FB5EF", }, - borderBottomLeftRadius: 0, - borderBottomRightRadius: 0, - borderBottom: 0 - }), - singleValue: (provided: any) => ({ - ...provided, - color: "#C1C1C1", }), -}); + +}; // TODO: get a consistent color palette across PCx -interface ModifySemestersProps { +interface ModifySemestersModalProps { addSemester: (semester: Course["semester"]) => void; className?: string; semesters: { [semester: string]: Fulfillment[] }; } -const ModifySemesters = ({ +const ModifySemestersModal = ({ addSemester, semesters, className, -}: ModifySemestersProps) => { +}: ModifySemestersModalProps) => { const latestSemester = Object.keys(semesters).sort((a, b) => a.localeCompare(b)).pop() || "2026A"; // TODO: Change fallback value to start semester (based on onboarding?) @@ -146,30 +153,31 @@ const ModifySemesters = ({ ]; return ( - // TODO: add a modal for this - - - - - - -
Add Semester
-
-
- - option.value === selectedSeason)} + onChange={(option) => setSelectedSeason(option ? option.value : selectedSeason)} + /> + setSelectedYear(e.target.value)} + /> + + + Cancel + + Add + + + ); }; @@ -192,6 +200,8 @@ interface SemestersProps { setEditMode: (arg0: boolean) => void; isLoading: boolean; currentSemester?: string; + showAddSemModal: boolean; + setShowAddSemModal: (arg0: boolean) => void; } const Semesters = ({ @@ -202,6 +212,8 @@ const Semesters = ({ setModalKey, setModalObject, setEditMode, + showAddSemModal, + setShowAddSemModal, currentSemester, isLoading, }: SemestersProps) => { @@ -224,6 +236,7 @@ const Semesters = ({ }>({}); const addSemester = (semester: string) => { if (!semesters[semester]) setSemesters({ ...semesters, [semester]: [] }); + setShowAddSemModal(false); }; const removeSemester = (semester: string) => { @@ -307,8 +320,16 @@ const Semesters = ({ currentSemester={currentSemester} /> ))} - {editMode && ( - + {showAddSemModal && ( + {setModalKey(null); setShowAddSemModal(false);}} + modalKey={'semester-add'} + > + {/* + // @ts-ignore */} + + )} );