beginning course scraping from row, and created assets folder with departments.json

This commit is contained in:
Sriram Hariharan
2023-03-03 23:53:54 -06:00
parent 94e74deb24
commit 2d940493a3
4 changed files with 262 additions and 17 deletions

View File

@@ -3,23 +3,23 @@ import ReactDOM from 'react-dom';
/**
* This adds a new column to the course catalog table header.
* @returns
* @returns a react portal to the new column or null if the column has not been created yet.
*/
export default function TableHead({ children }: PropsWithChildren) {
const [portalContainer, setPortalContainer] = useState<HTMLTableCellElement | null>(null);
const [container, setContainer] = useState<HTMLTableCellElement | null>(null);
useEffect(() => {
const portalContainer = document.createElement('th');
portalContainer.setAttribute('scope', 'col');
portalContainer.setAttribute('id', 'ut-registration-plus-table-head');
const container = document.createElement('th');
container.setAttribute('scope', 'col');
container.setAttribute('id', 'ut-registration-plus-table-head');
const lastTableHeadCell = document.querySelector('table thead th:last-child');
lastTableHeadCell!.after(portalContainer);
setPortalContainer(portalContainer);
lastTableHeadCell!.after(container);
setContainer(container);
}, []);
if (!portalContainer) {
if (!container) {
return null;
}
return ReactDOM.createPortal(<span>{children}</span>, portalContainer);
return ReactDOM.createPortal(<span>{children}</span>, container);
}