A simple web application designed to help users identify their primary learning style (Visual, Auditory, Reading/Writing, or Kinesthetic) through a short quiz.
- A multi-question quiz based on common learning scenarios.
- Calculates and displays the user's dominant learning style(s).
- Provides a percentage breakdown of all learning styles.
- Offers brief tips tailored to the user's primary style.
- Generates a personalized prompt for Large Language Models (LLMs) to help users learn new topics according to their style.
- Includes a dark/light theme switcher.
- React
- TypeScript
- Vite
- Tailwind CSS
- Headless UI / Catalyst Components
- React Router
- React Icons
-
Clone the repository:
git clone https://github.com/mattsilv/silv-learn.git cd silv-learn -
Install dependencies:
pnpm install
-
Run the development server:
pnpm dev
The application will be available at
http://localhost:5173(or the next available port).
pnpm dev: Starts the development server.pnpm build: Builds the application for production.pnpm preview: Serves the production build locally.pnpm lint: Lints the code using ESLint.pnpm format: Formats the code using Prettier.pnpm test: Runs unit tests with Vitest.pnpm e2e: Runs end-to-end tests with Playwright.
Common reasons for build failures, especially on deployment platforms like Netlify:
-
Outdated Lockfile (
ERR_PNPM_OUTDATED_LOCKFILE):- Cause:
package.jsonwas updated (e.g., added/updated dependencies) butpnpm-lock.yamlwas not regenerated and committed. - Solution: Run
pnpm installlocally, then commit and push the updatedpnpm-lock.yamlfile.
- Cause:
-
Missing Type Definitions (e.g.,
Cannot find type definition file for 'node'):- Cause: A required
@types/package (like@types/node) is missing fromdevDependenciesinpackage.json. - Solution: Run
pnpm add -D @types/node(or the relevant types package), then commit and push the updatedpackage.jsonandpnpm-lock.yaml.
- Cause: A required
-
Unused Variables/Imports (TypeScript/ESLint Errors):
- Cause: Code includes imported modules or declared variables that are never used. The TypeScript compiler (
tsc -bin the build script) is configured to treat these as errors. - Solution: Remove the unused imports or variables from the corresponding
.tsxor.tsfile. Runpnpm lintlocally to catch these errors before committing.
- Cause: Code includes imported modules or declared variables that are never used. The TypeScript compiler (
-
Incorrect Netlify Settings (Base Directory, etc.):
- Cause: Netlify build settings (Base directory, Package directory, Build command, Publish directory) don't match the project structure.
- Solution: Ensure the Base directory points to the root of the Git repository (
my-learning-style-appin this case) and the Publish directory is set todist.
-
Dependency Resolution Issues (
[plugin:vite:import-analysis] Failed to resolve import):- Cause: Vite has trouble resolving an import path, sometimes due to how pnpm links packages or complex dependency structures.
- Solution: Try adding the problematic import path to
optimizeDeps.includeinvite.config.ts. For example:optimizeDeps: { include: ['react-icons/fa'] }.
General Tip: Always run pnpm build and pnpm lint locally before pushing changes to catch potential build errors early.
This project uses Vitest for unit and integration testing.
- File Naming: Test files should be named
*.test.tsor*.test.tsx. - Location:
- For utility functions (in
src/utils/), create the corresponding.test.tsfile in the samesrc/utils/directory. - For components (in
src/components/), create the corresponding.test.tsxfile within a__tests__subdirectory inside the specific component's folder (e.g.,src/components/quiz/__tests__/QuestionCard.test.tsx). - For hooks (in
src/hooks/), create the corresponding.test.tsfile in the samesrc/hooks/directory.
- For utility functions (in
- Running Tests: Use
pnpm testorpnpm test:watch.