DreamTalk React
This is the React version of DreamTalk, migrated from Angular with feature parity for role-based dashboards, DreamChat, and DreamWishes.
What changed in this update
- Resolved merge conflicts and fixed invalid
package.jsonto valid CRA config. - Moved OpenAI key to environment variable:
REACT_APP_OPENAI_API_KEY. - Normalized API paths (use
app/getAppState). - Removed/ignored leftover Angular files from the React project (excluded
src/app/**from TS build). - Fixed SCSS conflicts and partial imports; replaced
darken()on CSS variables with safe equivalents. - Removed Angular bootstrap code; React app builds cleanly.
Prerequisites
- Node.js 16+
- npm 8+
Setup
npm install
Create a .env.local (or set in CI/CD):
REACT_APP_OPENAI_API_KEY=your-dev-key
REACT_APP_API_URL=https://swaayamadminprod.dreambiginnovations.com:8011
Notes:
REACT_APP_API_URLis optional; defaults to the value insrc/config/environment.ts.
Development
npm start
Opens at http://localhost:3000.
Build
npm run build
Outputs to build/.
Architecture
- Routing:
src/components/AppRouter.tsxwith role-guarded routes viasrc/components/AuthGuard.tsxandsrc/contexts/AppStateContext.tsx. - API:
src/services/api.service.ts(axios, CSRF, interceptors). - App State:
src/services/appstate.service.ts(loadsapp/getAppState). - AI:
src/services/ai.service.ts(chat completion, history, retries; usesREACT_APP_OPENAI_API_KEY). - Styles:
src/styles/*.scsswith CSS variables incolors.scss.
Onboarding and parity
- Role-based dashboards and DreamChat/DreamWishes are wired.
- Super-admin/organization onboarding flows should be implemented as React pages (Angular leftovers were removed from build and need React equivalents if required for go-live).
Deployment
- The app is built for root
/. Configurehomepageinpackage.jsonif deploying under a subpath. - Serve with any static server, e.g.
npx serve -s build.
Troubleshooting
- Ensure
.env.localincludesREACT_APP_OPENAI_API_KEY. - If API 401: verify cookies/CSRF and
apiUrl. - For SCSS import errors: use partial names with leading underscore (e.g.
_typography.scss) or update imports insrc/index.scss.
Description
Languages
TypeScript
54.2%
SCSS
32.5%
CSS
6.9%
JavaScript
5.8%
PowerShell
0.3%
Other
0.1%