import React from 'react';
import {
Box,
Typography,
List,
ListItem,
ListItemButton,
ListItemText,
ListItemIcon,
Chip,
Divider
} from '@mui/material';
import ThumbUpIcon from '@mui/icons-material/ThumbUp';
import ThumbDownIcon from '@mui/icons-material/ThumbDown';
import RemoveIcon from '@mui/icons-material/Remove';
import HistoryIcon from '@mui/icons-material/History';
function PreviousAnalyses({ analyses, onViewAnalysis }) {
if (!analyses.length) {
return (
Previous analyses will appear here
Analyze your first review to get started
);
}
return (
{analyses.map((analysis, index) => {
const getSentimentIcon = (sentiment) => {
switch (sentiment) {
case 'positive': return ;
case 'negative': return ;
default: return ;
}
};
const truncateText = (text, maxLength = 50) => {
return text.length > maxLength
? `${text.substring(0, maxLength)}...`
: text;
};
console.log(analysis)
return (
{getSentimentIcon(analysis.sentiment)}
{analysis.createdAt ? new Date(analysis.createdAt).toLocaleTimeString() : 'Just now'}
}
/>
{index < analyses.length - 1 && }
);
})}
);
}
export default PreviousAnalyses;