React + TypeScript app that analyzes pasted text for biased framing: a bias score (0–100), short explanatory notes, and a neutral rewrite for comparison. Built with Vite, React Router, React Bootstrap, and a Netlify Function (or optional local Express) calling OpenAI—no secrets in the frontend.
- Text Analysis (home): hero, textarea, “Analyze Text” flow, and CTAs after a successful run.
- Bias Score: animated gauge, score, and “why this may be biased” notes.
- Neutral Position: displays the generated neutral rewrite when available.
Shared UI state persists across routes until the user edits the source text again.
- React 18 + TypeScript
- React Router (HashRouter for GitHub Pages)
- React Bootstrap + Bootstrap 5
- Vite
npm install
npm run dev # start dev server (e.g. http://localhost:5173)
npm run build # production build to dist/
npm run preview # preview production build locally
npm run deploy # build and push dist/ to gh-pages branch (see below)Your app uses HashRouter, so routes work on GitHub Pages without any server config. Choose one of the two methods below.
-
Push your code to GitHub
Create a repo (e.g.Web-Projectorbias-detector) and push this project. -
Turn on GitHub Pages
- Open the repo on GitHub → Settings → Pages.
- Under Build and deployment, set Source to GitHub Actions.
-
Deploy
- Push to the
mainbranch (or run the workflow manually: Actions → Deploy to GitHub Pages → Run workflow). - The workflow builds the app with the correct base path and deploys to Pages.
- Push to the
-
Open your site
After the workflow finishes:
https://<your-username>.github.io/<repo-name>/
(e.g.https://jane.github.io/Web-Project/)
Routes use the hash: https://.../Web-Project/#/bias-score, etc.
-
Create the repo on GitHub
Note the repo name (e.g.Web-Project). -
Set the base path for production
- Copy the example env file:
cp .env.production.example .env.production
- Edit
.env.productionand setVITE_PUBLIC_PATHto your repo path:Use your actual repo name. (No trailing slash after the repo name is required; the build adds it.)VITE_PUBLIC_PATH=/Web-Project/
- Copy the example env file:
-
Install dependencies and deploy
npm install npm run deploy
This runs
npm run build(using.env.productionfor the base path) and then pushes thedist/folder to thegh-pagesbranch with thegh-pagespackage. -
Enable Pages from the branch
- On GitHub: Settings → Pages.
- Set Source to Deploy from a branch.
- Branch: gh-pages (or main if you use that for the built site).
- Folder: / (root).
- Save.
-
Open your site
https://<your-username>.github.io/<repo-name>/
The app must be built with the correct base path.
- With Option A, the workflow sets
VITE_PUBLIC_PATH=/<repo-name>/automatically. - With Option B, make sure
.env.productionhasVITE_PUBLIC_PATH=/YourRepoName/and you runnpm run build(ornpm run deploy) after changing it.
src/
components/
pages/
App.tsx
main.tsx
index.css
MIT (or your choice).