Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
AaDalal committed Mar 8, 2024
1 parent cc466be commit 01c0f86
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
5 changes: 2 additions & 3 deletions frontend/degree-plan/components/Dock/Dock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const Dock = ({ user, login, logout }: DockProps) => {
const [{ isOver, canDrop }, drop] = useDrop(() => ({
accept: ItemTypes.COURSE,
drop: (course: Course) => {
console.log("DROPPED", course.full_code, 'from', course.semester);
console.log("DROPPED", course.full_code, 'from', course.semester);
const repeated = dockedCourses.filter(c => c === course.full_code)
if (!repeated.length) {
/** Preemtively update frontend */
Expand All @@ -118,7 +118,6 @@ const Dock = ({ user, login, logout }: DockProps) => {
createOrUpdate({"full_code": course.full_code}, course.full_code);
}
},
canDrop: () => {return true},
collect: monitor => ({
isOver: !!monitor.isOver(),
canDrop: !!monitor.canDrop()
Expand All @@ -132,7 +131,7 @@ const Dock = ({ user, login, logout }: DockProps) => {
:
!dockedCourses.length ? <CenteringCourseDock>Drop courses in the dock for later.</CenteringCourseDock> :
<DockedCourses>
{dockedCourses.map((full_code, i) =>
{dockedCourses.toReversed().map((full_code, i) =>
<DockedCourse removeDockedCourse={removeDockedCourse} full_code={full_code}/>
)}
</DockedCourses>
Expand Down
2 changes: 0 additions & 2 deletions frontend/degree-plan/components/Dock/DockedCourse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ const DockedCourseContainer = styled(BaseCourseContainer)`


const DockedCourse = ({removeDockedCourse, full_code}: any) => {
const [mouseOver, setMouseOver] = React.useState(false);

/** React dnd */
const [{ isDragging, color }, drag, dragPreview] = useDrag(() => ({
type: ItemTypes.COURSE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const SkeletonCourse = () => (

const CoursePlanned = ({ fulfillment, semester, removeCourse } : CoursePlannedProps) => {
const [{ isDragging }, drag] = useDrag<DnDFulfillment, never, { isDragging: boolean }>(() => ({
type: ItemTypes.COURSE,
type: ItemTypes.FULFILLMENT,
item: fulfillment,
collect: (monitor) => ({
isDragging: !!monitor.isDragging()
Expand Down
2 changes: 2 additions & 0 deletions frontend/degree-plan/components/FourYearPlan/PanelCommon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ export const PanelTopBarString = styled.div`
`

export const PanelTopBarButton = styled.button`
border: none;
display: flex;
flex-direction: row;
justify-content: start;
align-items: center;
padding: .5rem 1rem;
gap: .5rem;
min-height: 1.5rem;
font-family: inherit;
font-size: 1rem;
font-weight: 500;
Expand Down
2 changes: 1 addition & 1 deletion frontend/degree-plan/components/Requirements/ReqPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const ReqPanel = ({setModalKey, setModalObject, activeDegreeplan, isLoading, set
editMode={editMode}
setModalKey={setModalKey}
setModalObject={setModalObject}
isLoading={isLoading}
isLoading={isLoading || isLoadingFulfillments}
/>
))}
{editMode &&
Expand Down
3 changes: 2 additions & 1 deletion frontend/degree-plan/components/Requirements/Rule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const SkeletonRule: React.FC<React.PropsWithChildren> = ({ children }) =>
*/
const RuleComponent = (ruleTree : RuleTree) => {
const { type, activeDegreePlanId, rule, progress } = ruleTree;
const satisfied = progress === 1;

// state for INTERNAL_NODEs
const [collapsed, setCollapsed] = useState(false);
Expand Down Expand Up @@ -134,7 +135,7 @@ const RuleComponent = (ruleTree : RuleTree) => {
const { fulfillments, cus, num } = ruleTree;
return (
<RuleLeafWrapper $isDroppable={canDrop} $isOver={isOver} ref={drop}>
<RuleLeaf q_json={rule.q_json} rule={rule} fulfillmentsForRule={fulfillments} satisfied={progress === 1} />
<RuleLeaf q_json={rule.q_json} rule={rule} fulfillmentsForRule={fulfillments} satisfied={satisfied} />
<div>
{rule.credits && <CusCourses>{cus} / {rule.credits} cus</CusCourses>}
{" "}
Expand Down
3 changes: 2 additions & 1 deletion frontend/degree-plan/components/dnd/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const ItemTypes = {
MAJOR: 'major',
COURSE: 'course'
COURSE: 'course',
FULFILLMENT: 'fulfillment'
}

0 comments on commit 01c0f86

Please sign in to comment.