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

Fix similar and perturbed long utterances #330

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ Released changes are shown in the
### Removed

### Fixed
- Showing long utterances fully on hover in similar and perturbed utterances tables.

### Security
14 changes: 14 additions & 0 deletions webapp/src/components/Utterance/PerturbedUtterances.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, Tooltip, Typography } from "@mui/material";
import { GridCellParams } from "@mui/x-data-grid";
import HoverableDataCell from "components/Analysis/HoverableDataCell";
import CheckIcon from "components/Icons/Check";
import XIcon from "components/Icons/X";
import { Column, Table } from "components/Table";
Expand Down Expand Up @@ -89,6 +90,14 @@ export const perturbedUtterancesColumns: Column<Row>[] = [
flex: 1,
minWidth: 408,
sortable: false,
cellClassName: "hoverableDataCell",
renderCell: ({ value }: GridCellParams<string>) => (
<HoverableDataCell>
<Typography variant="inherit" whiteSpace="pre-wrap">
{value}
</Typography>
</HoverableDataCell>
),
},
{
field: "prediction",
Expand Down Expand Up @@ -171,6 +180,11 @@ const PerturbedUtterances: React.FC<Props> = (props) => {
error={error}
loading={isFetching}
rows={rows}
sx={{
"& .hoverableDataCell": {
position: "relative",
},
}}
/>
);
};
Expand Down
14 changes: 13 additions & 1 deletion webapp/src/components/Utterance/SimilarUtterances.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Warning } from "@mui/icons-material";
import { Tooltip } from "@mui/material";
import { Tooltip, Typography } from "@mui/material";
import makeStyles from "@mui/styles/makeStyles";
import { GridCellParams, GridRow } from "@mui/x-data-grid";
import HoverableDataCell from "components/Analysis/HoverableDataCell";
import CopyButton from "components/CopyButton";
import { Column, RowProps, Table } from "components/Table";
import VisualBar from "components/VisualBar";
Expand All @@ -19,6 +20,9 @@ const useStyles = makeStyles(() => ({
visibility: "hidden",
},
},
hoverableDataCell: {
position: "relative",
},
}));

type Row = SimilarUtterance & { id: number };
Expand Down Expand Up @@ -59,6 +63,14 @@ const SimilarUtterances: React.FC<Props> = ({
headerName: "Similar Utterance",
flex: 1,
sortable: false,
cellClassName: classes.hoverableDataCell,
renderCell: ({ value }: GridCellParams<string>) => (
<HoverableDataCell>
<Typography variant="inherit" whiteSpace="pre-wrap">
{value}
</Typography>
</HoverableDataCell>
),
},
{
field: "utteranceCopyButton",
Expand Down