Skip to content

Commit

Permalink
feat: add button to the rows, use new ConflictsWithWarning component
Browse files Browse the repository at this point in the history
  • Loading branch information
DhruvArora-03 authored and doprz committed Mar 6, 2024
1 parent 1599e48 commit bec2649
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/views/components/injected/TableRow/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { UserSchedule } from '@shared/types/UserSchedule';
import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';
import { Button } from '../../common/Button/Button';
import Icon from '../../common/Icon/Icon';
import Text from '../../common/Text/Text';
import styles from './TableRow.module.scss';
import ConflictsWithWarning from '../../common/ConflictsWithWarning/ConflictsWithWarning';
import AddIcon from '~icons/material-symbols/add-circle';

interface Props {
isSelected: boolean;
Expand Down Expand Up @@ -54,7 +54,7 @@ export default function TableRow({ row, isSelected, activeSchedule, onClick }: P
return () => {
element.classList.remove(styles.inActiveSchedule);
};
}, [activeSchedule, element.classList]);
}, [activeSchedule, course, element.classList]);

useEffect(() => {
if (!activeSchedule || !course) {
Expand Down Expand Up @@ -84,20 +84,14 @@ export default function TableRow({ row, isSelected, activeSchedule, onClick }: P

return ReactDOM.createPortal(
<>
<Button className={styles.rowButton} onClick={onClick} variant='secondary'>
<Icon name='bar_chart' color='white' size='medium' />
</Button>
{conflicts.length > 0 && (
<div className={styles.conflictTooltip}>
<div className={styles.body}>
{conflicts.map(c => (
<Text /* size='small' */ key={c.uniqueId}>
{c.department} {c.number} ({c.uniqueId})
</Text>
))}
</div>
</div>
)}
<Button
icon={AddIcon}
className={styles.rowButton}
color='ut-burntorange'
onClick={onClick}
variant='single'
/>
{conflicts.length > 0 && <ConflictsWithWarning className={styles.conflictTooltip} conflicts={conflicts} />}
</>,
container
);
Expand Down

0 comments on commit bec2649

Please sign in to comment.