Skip to content

Commit

Permalink
frontend bug fixes + colored dot next to course items in map view
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdoh0109 committed Nov 19, 2024
1 parent f0e2a3b commit a4b8ff1
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 53 deletions.
20 changes: 14 additions & 6 deletions frontend/plan/components/map/MapCourseItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const CourseCartItem = styled.div<{ $isMobile: boolean }>`
transition: 250ms ease background;
cursor: pointer;
user-select: none;
flex-direction: row;
display: flex;
align-items: center;
padding: 0.8rem;
border-bottom: 1px solid #e5e8eb;
grid-template-columns: 20% 50% 15% 15%;
Expand All @@ -28,6 +28,15 @@ const CourseCartItem = styled.div<{ $isMobile: boolean }>`

const CourseDetailsContainer = styled.div``;

const Dot = styled.span<{ $color: string }>`
height: 5px;
width: 5px;
border-radius: 50%;
display: inline-block;
margin-right: 10px;
background-color: ${({ $color }) => $color};
`;

interface CourseDetailsProps {
id: string;
start: number;
Expand Down Expand Up @@ -91,8 +100,7 @@ const CourseDetails = ({

interface CartSectionProps {
id: string;
lat?: number;
lng?: number;
color: string;
start: number;
end: number;
room: string;
Expand All @@ -102,8 +110,7 @@ interface CartSectionProps {

function MapCourseItem({
id,
lat,
lng,
color,
start,
end,
room,
Expand All @@ -121,6 +128,7 @@ function MapCourseItem({
focusSection(`${split[0]}-${split[1]}`);
}}
>
<Dot $color={color} />
<CourseDetails
id={id}
start={start}
Expand Down
61 changes: 33 additions & 28 deletions frontend/plan/components/map/MapTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const MapContainer = styled.div`
margin-top: 5px;
`;

const MapCourseItemcontainer = styled.div`
height: 60%;
overflow-y: auto;
`;

interface MabTapProps {
meetingsByDay: Record<Day, Meeting[]>;
focusSection: (id: string) => void;
Expand Down Expand Up @@ -120,34 +125,34 @@ function MapTab({ meetingsByDay, focusSection }: MabTapProps) {
zoom={15}
/>
</MapContainer>
{meeetingsForDay.map(
(
{
id,
latitude,
longitude,
start,
end,
room,
overlap,
}: Meeting,
i: number
) => {
return (
<MapCourseItem
key={id + i} // handle same class more than once/day (e.g. PHYS)
id={id}
lat={latitude}
lng={longitude}
start={start}
end={end}
room={room}
overlap={overlap!}
focusSection={focusSection}
/>
);
}
)}
<MapCourseItemcontainer>
{meeetingsForDay.map(
(
{
id,
color,
start,
end,
room,
overlap,
}: Meeting,
i: number
) => {
return (
<MapCourseItem
key={id + i} // handle same class more than once/day (e.g. PHYS)
id={id}
color={color}
start={start}
end={end}
room={room}
overlap={overlap!}
focusSection={focusSection}
/>
);
}
)}
</MapCourseItemcontainer>
</>
)}
</Box>
Expand Down
40 changes: 21 additions & 19 deletions frontend/plan/components/schedule/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,26 +120,28 @@ export default function Block(props: BlockProps) {
};
return (
<GridBlock style={{ ...pos }}>
<VisibleBlock
color={color}
role="button"
style={style}
onClick={focusSection}
>
<InnerBlock>
{!isMobile && !readOnly && (
<RemoveButton
onClick={(e) => {
remove();
e.stopPropagation();
}}
/>
)}
{false && !coreqFulfilled && <CoreqWarning />}
{color && (
<VisibleBlock
color={color}
role="button"
style={style}
onClick={focusSection}
>
<InnerBlock>
{!isMobile && !readOnly && (
<RemoveButton
onClick={(e) => {
remove();
e.stopPropagation();
}}
/>
)}
{false && !coreqFulfilled && <CoreqWarning />}

<span>{id.replace(/-/g, " ")}</span>
</InnerBlock>
</VisibleBlock>
<span>{id.replace(/-/g, " ")}</span>
</InnerBlock>
</VisibleBlock>
)}
</GridBlock>
);
}

0 comments on commit a4b8ff1

Please sign in to comment.