Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: All entries page + Navbar #43

Merged
merged 9 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import MuiLink from "@mui/material/Link";
import SettingsIcon from '@mui/icons-material/Settings';
import logo from "../assets/logosmall.jpg";
import { Link } from "react-router-dom";

import { useTranslation } from "react-i18next";

const displayedPages = [
Expand Down Expand Up @@ -138,8 +137,8 @@ const ResponsiveAppBar = () => {
<Typography
variant="h6"
noWrap
component="a"
href="/"
component={Link}
to="/"
sx={{
mr: 2,
fontFamily: "Plus Jakarta Sans",
Expand Down
72 changes: 0 additions & 72 deletions taxonomy-editor-frontend/src/pages/allentries/EntriesList.jsx

This file was deleted.

69 changes: 66 additions & 3 deletions taxonomy-editor-frontend/src/pages/allentries/index.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,83 @@
import { Typography, Button, Box } from "@mui/material";
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import Paper from '@mui/material/Paper';
import EditIcon from '@mui/icons-material/Edit';
import { Link } from "react-router-dom";
import useFetch from "../../components/useFetch";
import { API_URL } from "../../constants";
import EntriesList from "./EntriesList";

const Entry = () => {
const { data: nodes, isPending, isError, isSuccess, errorMessage } = useFetch(API_URL+'nodes');
const title = "Test";
if (isError) {
aadarsh-ram marked this conversation as resolved.
Show resolved Hide resolved
return (
<div className="all-entries">
{isError && <div>{errorMessage}</div>}
</div>
)
}
if (isPending) {
return (
<div className="all-entries">
{isPending && <div>Loading...</div>}
</div>
)
}
return (
<div className="all-entries">
{isPending && <div>Loading...</div>}
{isSuccess && <EntriesList nodes={nodes} title={"Test"}/>}
{ isSuccess &&
aadarsh-ram marked this conversation as resolved.
Show resolved Hide resolved
<Box className="entry">
<Typography sx={{mb: 1, mt:2, ml: 2}} variant="h4">
List of nodes in {title} Taxonomy:
</Typography>
<Typography variant="h6" sx={{mt: 2, ml: 2, mb: 1}}>
Number of nodes in taxonomy: {nodes.length}
</Typography>
{/* Table for listing all nodes in taxonomy */}
<Box className="entry-preview">
<TableContainer sx={{ml: 2}} component={Paper}>
<Table sx={{ width: 400 }}>
<TableHead>
<TableRow>
<TableCell align="left">
<Typography variant="h6">
Nodes
</Typography>
</TableCell>
<TableCell align="left">
<Typography variant="h6">
Action
</Typography>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{nodes.map((node) => (
<TableRow
key={node[0].id}
>
<TableCell align="left" component="td" scope="row">
<Typography variant="subtitle1">
{node[0].id}
</Typography>
</TableCell>
<TableCell align="left" component="td" scope="row">
<Button component={Link} to={`/${node[0].id}`}>
<EditIcon color="primary"/>
</Button>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Box>
</Box>}
</div>
);
}
Expand Down