How dogukandogru/birthdayparadox works
Main Components
• Frontend UI: Built with Next.js. The “src/app” directory contains key UI components (pages, layouts, global styles).
• Interactive Components: These include the Simulation (src/app/components/Simulation.tsx), Chart (src/app/components/Chart.tsx), and LanguageSwitch (src/app/components/LanguageSwitch.tsx), which together decompose the interactive simulation and visualization aspects.
• State/Context Management: The LanguageContext (src/app/context/LanguageContext.tsx) that manages multilingual support.
• Styling & Animations: Tailwind CSS for styling (tailwind.config.ts and globals.css) and Framer Motion for smooth animations.
• External Libraries: Recharts for charting, alongside toolchain configurations (e.g., ESLint, TypeScript configs, Next config files).
Relationships and Interactions
• The User Interface Houses a Main Layout (src/app/layout.tsx) that wraps around the Home Page (src/app/page.tsx) where components are rendered.
• The Simulation component drives the core functionality by performing real-time probability computations and then interfacing with the Chart component to display results graphically.
• The LanguageContext provides state management for language switching across the UI (used by LanguageSwitch and potentially other components).
• The interactive parts (simulation input, real-time data updates) may be animated through Framer Motion, and the chart is rendered by Recharts.
• Configuration files (Next.js and Tailwind) reside separately but define how the app runs and is styled globally.
Architectural Patterns & Design Principles
• Component-Based Architecture: Emphasize how UI and logic are split into reusable, well-defined components.
• State Management via Context: LanguageContext centralizes multilingual state and can be represented as a service used by other UI components.
• Declarative UI and Styling: Next.js pages, React components, and Tailwind CSS work together for a dynamic, responsive UX.
• Clear Separation of Concerns: UI (layout, page components), simulation logic (Simulation.tsx), visualization (Chart.tsx), and context (LanguageContext.tsx).