import React, { useState, useEffect } from 'react';
import {
Box,
Container,
Typography,
CardContent,
Chip,
Tooltip,
Paper
} from '@mui/material';
import { motion, AnimatePresence } from 'framer-motion';
import GeneratePillarChips from './components/GeneratePillarChips';
import PublishPillarChips from './components/PublishPillarChips';
import AnalyzePillarChips from './components/AnalyzePillarChips';
import EngagePillarChips from './components/EngagePillarChips';
import EnhancedTodayChip from './components/EnhancedTodayChip';
import OnboardingModal from './components/OnboardingModal';
import WorkflowHeroSection from './components/WorkflowHeroSection';
import { pillarData } from './components/PillarData';
import { useWorkflowStore } from '../../stores/workflowStore';
// Enhanced Glassomorphic Chip Component with Popping Effects
const ChipWithTooltip: React.FC<{
chip: any;
delay?: number;
onOnboardingClick?: () => void;
}> = ({ chip, delay = 0, onOnboardingClick }) => {
const [currentIndex, setCurrentIndex] = useState(0);
useEffect(() => {
const interval = setInterval(() => {
setCurrentIndex((prev) => (prev + 1) % chip.bubbles.length);
}, 2000 + delay * 300);
return () => clearInterval(interval);
}, [chip.bubbles.length, delay]);
const IconComponent = chip.icon;
const handleClick = () => {
if (chip.label === 'On-Boarding' && onOnboardingClick) {
onOnboardingClick();
}
};
return (
{chip.label}
{chip.bubbles[currentIndex]}
}
arrow
placement="top"
>
{/* Glow Effect */}
{/* Shadow Effect */}
{/* Main Chip */}
}
label={
{chip.label}
{chip.value && (
{chip.value}
)}
}
size="small"
sx={{
background: `linear-gradient(135deg,
rgba(255,255,255,0.25) 0%,
rgba(255,255,255,0.1) 50%,
rgba(255,255,255,0.05) 100%)`,
backdropFilter: 'blur(20px)',
border: '1px solid rgba(255,255,255,0.3)',
color: 'white',
fontSize: '0.7rem',
fontWeight: 600,
height: 28,
minWidth: 100,
position: 'relative',
overflow: 'hidden',
'&::before': {
content: '""',
position: 'absolute',
top: 0,
left: '-100%',
width: '100%',
height: '100%',
background: 'linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent)',
transition: 'left 0.6s ease',
zIndex: 1
},
'&:hover::before': {
left: '100%'
},
'& .MuiChip-label': {
px: 1,
zIndex: 2,
position: 'relative'
},
'& .MuiChip-icon': {
zIndex: 2,
position: 'relative'
},
'&:hover': {
background: `linear-gradient(135deg,
rgba(255,255,255,0.35) 0%,
rgba(255,255,255,0.2) 50%,
rgba(255,255,255,0.1) 100%)`,
border: '1px solid rgba(255,255,255,0.5)',
boxShadow: `0 8px 32px ${chip.color}40,
0 4px 16px rgba(0,0,0,0.1),
inset 0 1px 0 rgba(255,255,255,0.3)`
}
}}
/>
);
};
// Enhanced Pillar Component with Progressive Disclosure
const PillarCard: React.FC<{
pillar: typeof pillarData[0];
index: number;
onOnboardingClick?: () => void;
}> = ({ pillar, index, onOnboardingClick }) => {
const IconComponent = pillar.icon;
const [isHovered, setIsHovered] = useState(false);
const { currentWorkflow } = useWorkflowStore();
// Use live workflow tasks if available
const liveTasksForPillar = (currentWorkflow?.tasks && currentWorkflow.tasks.length > 0
? currentWorkflow.tasks
: pillar.todayTasks || []).filter((t: any) => t.pillarId === pillar.id);
const totalForPillar = liveTasksForPillar.length;
const doneForPillar = liveTasksForPillar.filter((t: any) => t.status === 'completed' || t.status === 'skipped').length;
return (
0 && doneForPillar === totalForPillar ? '"✓"' : '""',
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
fontSize: '64px',
color: 'rgba(255,255,255,0.9)',
textShadow: '0 4px 12px rgba(0,0,0,0.5)',
pointerEvents: 'none',
zIndex: 10, // Ensure tick is above all content
fontWeight: 'bold'
},
'&::before': {
content: '""',
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
background: 'linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%)',
opacity: isHovered ? 1 : 0,
transition: 'opacity 0.3s ease'
},
'&:hover': {
boxShadow: `0 12px 24px ${pillar.color}40`
}
}}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
{/* Shooting star border animation */}
{/* Header */}
{pillar.title}
{/* Pillar task count badge */}
{totalForPillar}
{/* More Options Indicator */}
{!isHovered && (
⋯
)}
{/* Chips Layout with Progressive Disclosure */}
{pillar.id === 'generate' ? (
) : pillar.id === 'publish' ? (
) : pillar.id === 'analyze' ? (
) : pillar.id === 'engage' ? (
) : (
{/* Today Chip - Always Visible */}
{/* Additional Chips - Progressive Disclosure */}
{isHovered && (
{pillar.id === 'plan' ? (
<>
>
) : pillar.id === 'remarket' ? (
<>
>
) : null}
)}
)}
);
};
// Main Content Lifecycle Pillars Component
const ContentLifecyclePillars: React.FC = () => {
const [onboardingModalOpen, setOnboardingModalOpen] = useState(false);
// Workflow store hooks
const {
currentWorkflow,
isLoading: workflowLoading,
startWorkflow,
} = useWorkflowStore();
const handleOnboardingClick = () => {
setOnboardingModalOpen(true);
};
const handleCloseModal = () => {
setOnboardingModalOpen(false);
};
const handleStartWorkflow = async () => {
try {
if (currentWorkflow) {
await startWorkflow(currentWorkflow.id);
}
} catch (error) {
console.error('Failed to start workflow:', error);
}
};
// Check if workflow is active (in progress or completed)
const isWorkflowActive = currentWorkflow?.workflowStatus === 'in_progress' ||
currentWorkflow?.workflowStatus === 'completed';
return (
<>
{/* Pillars Grid */}
{pillarData.map((pillar, index) => (
))}
{/* Hero Section Overlay */}
{/* Onboarding Modal */}
>
);
};
export default ContentLifecyclePillars;