Skip to content

Commit 0087459

Browse files
committed
Remove unneeded tooltip + more efficient description truncation
Signed-off-by: Trung Nguyen <[email protected]>
1 parent 3639d83 commit 0087459

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

src/extension/ui/src/Constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ export const DOCKER_MCP_IMAGE = 'alpine/socat'
1010
export const DOCKER_MCP_CONTAINER_ARGS = 'STDIO TCP:host.docker.internal:8811'
1111
export const DOCKER_MCP_COMMAND = `docker run -i --rm ${DOCKER_MCP_IMAGE} ${DOCKER_MCP_CONTAINER_ARGS}`
1212

13-
export const TILE_DESCRIPTION_MAX_LENGTH = 120;
14-
1513
export const CATALOG_LAYOUT_SX = {
1614
width: '90vw',
1715
maxWidth: '1200px',
Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
import { Tooltip, Typography } from "@mui/material";
2-
import { CatalogItemRichened } from "../../types"
3-
import { TILE_DESCRIPTION_MAX_LENGTH } from "../../Constants";
1+
import { Typography } from '@mui/material';
42

5-
type CenterProps = {
6-
item: CatalogItemRichened;
7-
}
3+
import type { CatalogItemRichened } from '../../types';
84

9-
export default function Center({ item }: CenterProps) {
10-
return (
11-
<Tooltip title={item.description} sx={{ height: '100%' }}>
12-
<Typography variant="body2" sx={{ color: 'text.secondary', height: 50 }}>
13-
{item.description?.slice(0, TILE_DESCRIPTION_MAX_LENGTH)}
14-
{item.description?.length && item.description.length > TILE_DESCRIPTION_MAX_LENGTH && '...'}
15-
</Typography>
16-
</Tooltip>
17-
)
18-
}
5+
/*
6+
`Center` displays the description of the item in a truncated format.
7+
This should have been renamed to `Description`.
8+
*/
9+
export default function Center({ item }: { item: CatalogItemRichened }) {
10+
return (
11+
<Typography
12+
variant="body2"
13+
sx={{
14+
color: 'text.secondary',
15+
// These CSS properties are used to create a multiline ellipsis effect: 3 lines maximum for the description
16+
display: '-webkit-box',
17+
textOverflow: 'ellipsis',
18+
overflow: 'hidden',
19+
WebkitBoxOrient: 'vertical',
20+
WebkitLineClamp: '3',
21+
height: 48,
22+
}}
23+
>
24+
{item.description ?? ''}
25+
</Typography>
26+
);
27+
}

0 commit comments

Comments
 (0)