Skip to content

Commit

Permalink
fix: bad tables dom on errors and search results (#556)
Browse files Browse the repository at this point in the history
Fix a warning in the console because our tables are not well formed on
search results page and errors page.
  • Loading branch information
alexgarel authored Dec 20, 2024
1 parent 4036188 commit 31243c7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Tooltip,
Typography,
} from "@mui/material";
import { Link } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import ISO6391 from "iso-639-1";
import { useEffect, useState } from "react";
import { SHOWN_LANGUAGES_KEY } from "@/pages/project/editentry/ListTranslations";
Expand Down Expand Up @@ -59,6 +59,8 @@ export const EntryNodesTableBody = ({
}: Props) => {
const [shownLanguageCodes, setShownLanguageCodes] = useState<string[]>([]);

const navigate = useNavigate();

useEffect(() => {
// get shown languages from local storage if it exists else use main language
try {
Expand Down Expand Up @@ -95,8 +97,9 @@ export const EntryNodesTableBody = ({
<TableRow
key={id}
hover
component={Link}
to={`/${taxonomyName}/${branchName}/entry/${id}`}
onClick={() => {
navigate(`/${taxonomyName}/${branchName}/entry/${id}`);
}}
sx={{ textDecoration: "none" }}
>
<TableCell align="left" component="td" scope="row">
Expand Down
33 changes: 19 additions & 14 deletions taxonomy-editor-frontend/src/pages/project/errors/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
TableBody,
TableHead,
TableContainer,
TableRow,
Stack,
} from "@mui/material";
import MaterialTable from "@material-table/core";
Expand Down Expand Up @@ -69,22 +70,26 @@ export const Errors = () => {
<TableContainer sx={{ mb: 2 }}>
<Table style={{ border: "solid", borderWidth: 1.5 }}>
<TableHead>
<TableCell align="left">
<Typography variant="h6">Taxonomy Name</Typography>
</TableCell>
<TableCell align="left">
<Typography variant="h6">Branch Name</Typography>
</TableCell>
<TableRow>
<TableCell align="left">
<Typography variant="h6">Taxonomy Name</Typography>
</TableCell>
<TableCell align="left">
<Typography variant="h6">Branch Name</Typography>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableCell align="left" component="td" scope="row">
<Typography variant="body1">
{toTitleCase(taxonomyName || "")}
</Typography>
</TableCell>
<TableCell align="left" component="td" scope="row">
<Typography variant="body1">{branchName}</Typography>
</TableCell>
<TableRow>
<TableCell align="left" component="td" scope="row">
<Typography variant="body1">
{toTitleCase(taxonomyName || "")}
</Typography>
</TableCell>
<TableCell align="left" component="td" scope="row">
<Typography variant="body1">{branchName}</Typography>
</TableCell>
</TableRow>
</TableBody>
</Table>
</TableContainer>
Expand Down

0 comments on commit 31243c7

Please sign in to comment.