A React application that helps users read Matt Levine's "Money Stuff" emails by providing main content with pop-over footnotes.
- Paste Email HTML: Open the application. You will see a text area where you can paste the raw HTML content of a Matt Levine "Money Stuff" email.
- Parse Email: Click the "Parse Email" button. The application will process the HTML.
- Read with Pop-over Footnotes: The application will display the email content.
- Interactive Footnotes: Click on a footnote reference (e.g.,
[1]) in the main content. The corresponding footnote will appear in a pop-over.
- Pop-over Footnotes: Displays footnotes in a pop-over when the corresponding reference in the main text is clicked.
- Interactive Footnote System: Clickable footnote references in the main text trigger a pop-over displaying the corresponding footnote content.
- HTML Parsing: Parses raw HTML from Matt Levine's "Money Stuff" emails to extract main content and footnotes.
- Responsive Design: Adapts to different screen sizes for optimal viewing.
- MUI Components: Utilizes Material-UI for a clean and modern user interface.
- Frontend: Vite + React 18 + TypeScript
- UI Library: Material-UI (MUI) v5
- Build Tool: Vite
- Package Manager: npm
The project follows a standard Vite + React application structure:
mattreader/
├── public/ # Static assets
├── src/ # Application source code
│ ├── components/ # React components
│ ├── utils/ # Utility functions (e.g., emailParser.ts)
│ ├── hooks/ # Custom React hooks
│ ├── App.tsx # Main application component
│ ├── main.tsx # Entry point of the application
│ └── index.css # Global styles
├── .github/ # GitHub Actions Workflows
│ └── workflows/
│ └── deploy-gh-pages.yml # Workflow for GitHub Pages deployment
├── dist/ # Production build output (static files)
├── tests/ # Test files
├── .gitignore # Files ignored by Git
├── ARCHITECTURE_PLAN.md # Detailed architecture document
├── index.html # Main HTML file for development
├── package.json # Project metadata and dependencies
├── tsconfig.json # TypeScript compiler options
└── vite.config.ts # Vite configuration
For a more detailed component architecture, see the ARCHITECTURE_PLAN.md file.
To get a local copy up and running, follow these simple steps.
- Node.js and npm (Node Package Manager) must be installed on your system.
-
Clone the repository:
git clone https://github.com/your-username/money_reader
(Replace
your-usernamewith the actual username or organization if this is a remote repository. If it's local, you might skip this or adjust.) -
Navigate to the project directory:
cd money_reader -
Install NPM packages:
npm install
To start the development server and view the application in your browser:
npm run devThis will typically open the application at http://localhost:5173 (Vite's default) or another port if specified. Check your terminal output for the exact address.
To create a production build of the application:
npm run buildThis command bundles the application and outputs the static files to the dist directory. This directory contains everything needed to deploy the application.
The dist directory generated by the build process is a self-contained static website. You can host these files on any static file server or platform.
Here are a couple of ways to serve the dist directory locally for testing:
-
Using
npx serve(requires Node.js): If you have Node.js installed, you can use theservepackage to quickly start a local server.npx serve dist
This will typically make the application available at
http://localhost:3000or another port. Check your terminal output for the exact address. -
Opening
dist/index.htmldirectly in a browser: You can also open thedist/index.htmlfile directly in your web browser.file:///path/to/your/project/money_reader/dist/index.htmlNote: While this works for simple cases, some browser features or routing configurations might not work as expected when opened via the
file://protocol. Using a local HTTP server (likenpx serve) is generally recommended for a more accurate testing environment.
The dist directory can be uploaded to services like GitHub Pages, Netlify, Vercel, AWS S3, or any other static hosting provider.
Note for GitHub Pages Deployment: The vite.config.ts is configured with base: '/money_reader/' to ensure correct asset loading when deployed to GitHub Pages under a repository named money_reader. If deploying to a different path or platform, this configuration might need adjustment.
Deployment to GitHub Pages is automated using GitHub Actions. The workflow is defined in .github/workflows/deploy-gh-pages.yml and triggers on pushes to the main branch. This means that any changes merged into the main branch will automatically be built and deployed to the live GitHub Pages site.
This project includes tests for the email parsing functionality.
The primary automated test validates the email parsing logic. It checks if footnotes are correctly identified and extracted.
To run this test:
npm run test:parserThis command executes the tests/test_parser.js script.
For manual testing of the user interface and overall application flow:
- Start the development server:
npm run dev
- Open the application in your browser.
- Use sample email HTML (e.g., from
tests/test_email.htmlor the examples intests/test_parser.js) to paste into the input field. - Verify that the email parses correctly and that clicking on footnote references opens a pop-over with the correct footnote content.
For more detailed testing information, including specific checks and how to use the browser console for tests, please refer to the tests/README.md file.