import React, { useEffect, useState } from "react"; import PropTypes from "prop-types"; import { useSelector, useDispatch } from "react-redux"; import IconButton from "../../components/IconButton/IconButton"; import { setCategoriesReq } from "../../store/actions/categories/categoriesAction"; import { selectCategories, selectChildParentRelations, } from "../../store/selectors/categoriesSelector"; import table from "../../assets/images/table.png"; import { FILES_PAGE } from "../../constants/pages"; import FileTable from "./FileTable"; import { useParams } from "react-router-dom"; const FilesPage = ({ history }) => { const categories = useSelector(selectCategories); const childParentRelations = useSelector(selectChildParentRelations); const dispatch = useDispatch(); const [trigger, setTrigger] = useState(0); let { id } = useParams(); useEffect(() => { if (id === undefined) { dispatch(setCategoriesReq(undefined)); } else { dispatch(setCategoriesReq({ parentCategoryId: id })); } }, [id]); const getNameHandler = (name) => { if (name.length > 15) return name.substr(0, 15) + "..."; return name; }; return ( <>
Root
{relation.name}