Skip to content

Commit 5952507

Browse files
authored
142 remove url encoding when creating dataset and files (#189)
* when upload the file decode filename to exclude special characters * utilize <mark> tag to highlight correctly
1 parent 95d4ed4 commit 5952507

File tree

5 files changed

+253
-11
lines changed

5 files changed

+253
-11
lines changed

frontend/package-lock.json

Lines changed: 236 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"babel-polyfill": "^6.26.0",
4747
"classnames": "^2.2.6",
4848
"date-fns": "^2.28.0",
49+
"html-react-parser": "^3.0.4",
4950
"jquery": "^3.6.0",
5051
"jwt-decode": "^3.0.0",
5152
"prop-types": "^15.7.2",

frontend/src/components/search/SearchResult.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import ArticleIcon from "@mui/icons-material/Article";
66
import {parseDate} from "../../utils/common";
77
import {theme} from "../../theme";
88

9+
import parse from "html-react-parser";
10+
911
export function SearchResult(props) {
1012

1113
const {data} = props;
@@ -23,13 +25,13 @@ export function SearchResult(props) {
2325
{
2426
item._index === "dataset" ?
2527
<MuiLink component={Link} to={`/datasets/${item._id}`}
26-
sx={{ fontWeight: 600, fontSize: "18px"}}>
27-
{item.name}
28+
sx={{ fontWeight: "bold", fontSize: "18px"}}>
29+
{parse(item.name)}
2830
</MuiLink>
2931
:
3032
<MuiLink component={Link} to={`/files/${item._id}?dataset=${item.dataset_id}`}
31-
sx={{ fontWeight: 600, fontSize: "18px"}}>
32-
{item.name}
33+
sx={{ fontWeight: "bold", fontSize: "18px"}}>
34+
{parse(item.name)}
3335
</MuiLink>
3436
}
3537
</React.Fragment>
@@ -39,13 +41,13 @@ export function SearchResult(props) {
3941
<Typography variant="body2" color={theme.palette.secondary.light}>
4042
{
4143
item._index === "dataset" ?
42-
`Created by ${item.author} at ${parseDate(item.created)}`
44+
`Created by ${parse(item.author)} at ${parseDate(item.created)}`
4345
:
44-
`Created by ${item.creator} at ${parseDate(item.created)}`
46+
`Created by ${parse(item.creator)} at ${parseDate(item.created)}`
4547
}
4648
</Typography>
4749
<Typography variant="body2" color={theme.palette.secondary.dark}>
48-
{ item._index === "dataset" ? item.description : `${item.content_type} | ${item.bytes} bytes`}
50+
{ item._index === "dataset" ? parse(item.description) : `${item.content_type} | ${item.bytes} bytes`}
4951
</Typography>
5052
</React.Fragment>
5153
}

frontend/src/styles/main.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,9 @@ body {
104104
border-bottom: 1px solid #868E96!important;
105105
font-weight: bold;
106106
}
107+
108+
mark{
109+
font-weight: bold;
110+
background: inherit;
111+
color: inherit;
112+
}

0 commit comments

Comments
 (0)