File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed
Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Colors } from "./theme" ;
2+ import { Box , Typography , Button } from "@mui/material" ;
3+ import React , { useState } from "react" ;
4+
5+ const ReadMoreText : React . FC < { text : string } > = ( { text } ) => {
6+ const [ expanded , setExpanded ] = useState ( false ) ;
7+
8+ return (
9+ < Box sx = { { position : "relative" } } >
10+ < Typography
11+ variant = "body1"
12+ sx = { {
13+ display : "-webkit-box" ,
14+ WebkitLineClamp : expanded ? "unset" : 3 , // show only 3 lines
15+ WebkitBoxOrient : "vertical" ,
16+ overflow : "hidden" ,
17+ textOverflow : "ellipsis" ,
18+ } }
19+ >
20+ { text }
21+ </ Typography >
22+
23+ < Button
24+ size = "small"
25+ sx = { {
26+ mt : 1 ,
27+ fontWeight : 600 ,
28+ textTransform : "uppercase" ,
29+ fontSize : "0.8rem" ,
30+ color : Colors . purple ,
31+ "&:hover" : {
32+ color : Colors . secondaryPurple ,
33+ transform : "scale(1.05)" ,
34+ } ,
35+ } }
36+ onClick = { ( ) => setExpanded ( ! expanded ) }
37+ >
38+ { expanded ? "Read Less" : "Read More" }
39+ </ Button >
40+ </ Box >
41+ ) ;
42+ } ;
43+
44+ export default ReadMoreText ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
1717} from "@mui/material" ;
1818import { TextField } from "@mui/material" ;
1919import LoadDatasetTabs from "components/DatasetDetailPage/LoadDatasetTabs" ;
20+ import ReadMoreText from "design/ReadMoreText" ;
2021import theme , { Colors } from "design/theme" ;
2122import { useAppDispatch } from "hooks/useAppDispatch" ;
2223import { useAppSelector } from "hooks/useAppSelector" ;
@@ -156,6 +157,7 @@ const DatasetDetailPage: React.FC = () => {
156157 const [ jsonSize , setJsonSize ] = useState < number > ( 0 ) ;
157158 const [ transformedDataset , setTransformedDataset ] = useState < any > ( null ) ;
158159 const [ previewIndex , setPreviewIndex ] = useState < number > ( 0 ) ;
160+ const aiSummary = datasetDocument ?. [ ".datainfo" ] ?. AISummary ?? "" ;
159161
160162 // add spinner
161163 const [ isPreviewLoading , setIsPreviewLoading ] = useState ( false ) ;
@@ -952,6 +954,24 @@ const DatasetDetailPage: React.FC = () => {
952954 </ Typography >
953955 </ Box >
954956
957+ { /* ai summary */ }
958+ { /* {aiSummary && (
959+ <Box
960+ sx={{
961+ mb: 2,
962+ p: 2,
963+ borderRadius: "8px",
964+ border: "1px solid #ddd",
965+ }}
966+ >
967+ <Typography variant="subtitle2" sx={{ fontWeight: 700, mb: 1 }}>
968+ AI Summary
969+ </Typography>
970+ <Typography variant="body1">{aiSummary}</Typography>
971+ </Box>
972+ )} */ }
973+ { aiSummary && < ReadMoreText text = { aiSummary } /> }
974+
955975 < Box
956976 sx = { {
957977 display : "flex" ,
You can’t perform that action at this time.
0 commit comments