import { useState } from 'react'; import { Box, Typography, Paper, Grid, Tooltip, Card, CardContent, Chip, Dialog, DialogTitle, DialogContent, Divider } from '@mui/material'; import { SocialClass, Character } from '../types/timeline'; const socialClasses: SocialClass[] = [ { name: 'Upper Class', description: 'The landed gentry and aristocracy of Regency England', incomeRange: '£4,000-10,000 per annum', modernEquivalent: '$200,000-500,000 per year', characteristics: [ 'Inherited estates and land', 'No need to work for income', 'Expected to maintain country estates', 'Social obligations to tenants and community' ], examples: [ { character: 'Mr. Darcy', novel: 'Pride and Prejudice', context: 'Owner of Pemberley estate with £10,000 per year' }, { character: 'Sir Thomas Bertram', novel: 'Mansfield Park', context: 'Owner of Mansfield Park and plantations in Antigua' } ] }, { name: 'Middle Class', description: 'Professional class including clergy, military officers, and successful merchants', incomeRange: '£200-1,000 per annum', modernEquivalent: '$30,000-150,000 per year', characteristics: [ 'Professional occupations', 'Education but no inherited wealth', 'Aspiring to climb social ladder', 'Emphasis on manners and propriety' ], examples: [ { character: 'Mr. Bennet', novel: 'Pride and Prejudice', context: 'Country gentleman with £2,000 per year' }, { character: 'Henry Tilney', novel: 'Northanger Abbey', context: 'Clergyman with independent means' } ] }, { name: 'Working Class', description: 'Servants, laborers, and small traders', incomeRange: '£20-100 per annum', modernEquivalent: '$5,000-20,000 per year', characteristics: [ 'Manual labor or service positions', 'Limited education and opportunities', 'Dependent on employers', 'Focus on survival and basic needs' ], examples: [ { character: 'The Hill Family', novel: 'Longbourn', context: 'Servants at the Bennet household' }, { character: 'Hannah', novel: 'Northanger Abbey', context: 'Servant at the Tilney household' } ] } ]; const characters: Character[] = [ { id: 'darcy', name: 'Mr. Darcy', novel: 'Pride and Prejudice', socialClass: 'upper', occupation: 'Landowner', annualIncome: '£10,000', modernEquivalent: '$500,000', description: 'Wealthy landowner of Pemberley estate', relationships: ['elizabeth-bennet', 'georgiana-darcy'] }, { id: 'elizabeth', name: 'Elizabeth Bennet', novel: 'Pride and Prejudice', socialClass: 'middle', occupation: 'Gentleman\'s daughter', annualIncome: 'Share of £2,000', modernEquivalent: '$10,000', description: 'Intelligent and witty second daughter of the Bennet family', relationships: ['darcy', 'jane-bennet'] }, { id: 'sarah', name: 'Sarah', novel: 'Longbourn', socialClass: 'working', occupation: 'Housemaid', annualIncome: '£8', modernEquivalent: '$2,000', description: 'Hardworking housemaid at Longbourn', relationships: ['mrs-hill', 'james-smith'] } ]; export default function SocialClassView() { const [selectedCharacter, setSelectedCharacter] = useState(null); const [comparisonCharacter, setComparisonCharacter] = useState(null); const [dialogOpen, setDialogOpen] = useState(false); const handleCharacterClick = (character: Character) => { if (!selectedCharacter) { setSelectedCharacter(character); } else if (selectedCharacter.id !== character.id) { setComparisonCharacter(character); setDialogOpen(true); } else { // Deselect if clicking the same character setSelectedCharacter(null); } }; const handleCloseDialog = () => { setDialogOpen(false); setSelectedCharacter(null); setComparisonCharacter(null); }; // Color constants for the gradient const pyramidColors = { upper: { start: '#4A5D52', // darker sage end: '#6B7F75' // lighter sage }, middle: { start: '#5B6E65', end: '#7C8F86' }, lower: { start: '#6B7F75', end: '#8C9F96' } }; return (
{/* Social Pyramid */} Social Hierarchy {socialClasses.map((socialClass, index) => { const colors = index === 0 ? pyramidColors.upper : index === 1 ? pyramidColors.middle : pyramidColors.lower; return ( {socialClass.name} {socialClass.description}
Income Range: {socialClass.incomeRange} Modern Equivalent: {socialClass.modernEquivalent}
Key Characteristics:
    {socialClass.characteristics.map((char, idx) => (
  • {char}
  • ))}
} arrow placement="right" classes={{ tooltip: "bg-white shadow-lg", arrow: "text-white" }} sx={{ "& .MuiTooltip-tooltip": { backgroundColor: "white", color: "inherit", boxShadow: "0px 4px 20px rgba(0, 0, 0, 0.1)", opacity: 1, maxWidth: "none" }, "& .MuiTooltip-arrow": { color: "white", "&::before": { backgroundColor: "white", boxShadow: "0px 4px 20px rgba(0, 0, 0, 0.1)" } } }} > {socialClass.name} ); })}
{/* Character Examples */} Notable Characters {selectedCharacter && (
{selectedCharacter.name} selected. Click another character to compare, or click again to deselect.
)}
{characters.map((character) => ( handleCharacterClick(character)} className={` border transition-all cursor-pointer ${selectedCharacter?.id === character.id ? 'border-sage-500 bg-sage-50 shadow-md transform scale-[1.02]' : 'border-sage-200 bg-white hover:border-sage-300 hover:shadow-sm hover:bg-sage-50/30' } `} sx={{ position: 'relative', '&:after': selectedCharacter?.id === character.id ? { content: '""', position: 'absolute', left: -2, top: '50%', transform: 'translateY(-50%)', width: 4, height: '70%', backgroundColor: '#4A5D52', borderRadius: '0 2px 2px 0' } : {} }} >
{character.name} {character.novel}
Annual Income: {character.annualIncome}
Modern Equivalent: {character.modernEquivalent}
))}
{/* Comparison Dialog */} Character Comparison {selectedCharacter && comparisonCharacter && ( {[selectedCharacter, comparisonCharacter].map((char, index) => ( {char.name}
Novel {char.novel}
Annual Income {char.annualIncome}
Modern Equivalent {char.modernEquivalent}
Description {char.description}
{index === 0 && ( )}
))}
)}
); }