feat: add button to the rows, use new ConflictsWithWarning component
This commit is contained in:
@@ -3,9 +3,9 @@ import { UserSchedule } from '@shared/types/UserSchedule';
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Button } from '../../common/Button/Button';
|
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 styles from './TableRow.module.scss';
|
||||||
|
import ConflictsWithWarning from '../../common/ConflictsWithWarning/ConflictsWithWarning';
|
||||||
|
import AddIcon from '~icons/material-symbols/add-circle';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
@@ -54,7 +54,7 @@ export default function TableRow({ row, isSelected, activeSchedule, onClick }: P
|
|||||||
return () => {
|
return () => {
|
||||||
element.classList.remove(styles.inActiveSchedule);
|
element.classList.remove(styles.inActiveSchedule);
|
||||||
};
|
};
|
||||||
}, [activeSchedule, element.classList]);
|
}, [activeSchedule, course, element.classList]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!activeSchedule || !course) {
|
if (!activeSchedule || !course) {
|
||||||
@@ -84,20 +84,14 @@ export default function TableRow({ row, isSelected, activeSchedule, onClick }: P
|
|||||||
|
|
||||||
return ReactDOM.createPortal(
|
return ReactDOM.createPortal(
|
||||||
<>
|
<>
|
||||||
<Button className={styles.rowButton} onClick={onClick} variant='secondary'>
|
<Button
|
||||||
<Icon name='bar_chart' color='white' size='medium' />
|
icon={AddIcon}
|
||||||
</Button>
|
className={styles.rowButton}
|
||||||
{conflicts.length > 0 && (
|
color='ut-burntorange'
|
||||||
<div className={styles.conflictTooltip}>
|
onClick={onClick}
|
||||||
<div className={styles.body}>
|
variant='single'
|
||||||
{conflicts.map(c => (
|
/>
|
||||||
<Text /* size='small' */ key={c.uniqueId}>
|
{conflicts.length > 0 && <ConflictsWithWarning className={styles.conflictTooltip} conflicts={conflicts} />}
|
||||||
{c.department} {c.number} ({c.uniqueId})
|
|
||||||
</Text>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>,
|
</>,
|
||||||
container
|
container
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user