|
| 1 | +# Development Guide |
| 2 | + |
| 3 | +## Project Structure |
| 4 | + |
| 5 | +``` |
| 6 | +portfolio/ |
| 7 | +├── public/ # Static assets |
| 8 | +│ ├── favicon files # Various favicon formats |
| 9 | +│ ├── manifest.json # PWA manifest |
| 10 | +│ └── robots.txt # SEO robots file |
| 11 | +├── src/ |
| 12 | +│ ├── components/ # React components |
| 13 | +│ │ ├── Terminal.jsx # Main terminal interface |
| 14 | +│ │ └── MatrixRain.jsx # Background animation |
| 15 | +│ ├── styles/ # CSS stylesheets |
| 16 | +│ │ ├── index.css # Global styles |
| 17 | +│ │ └── terminal.css # Terminal-specific styles |
| 18 | +│ ├── utils/ # Utility functions and constants |
| 19 | +│ │ ├── constants.js # Application constants |
| 20 | +│ │ └── typewriter.js # Typewriter effect utility |
| 21 | +│ ├── App.jsx # Root component |
| 22 | +│ └── index.js # Application entry point |
| 23 | +├── package.json # Dependencies and scripts |
| 24 | +├── .gitignore # Git ignore rules |
| 25 | +├── README.md # Project documentation |
| 26 | +├── DEVELOPMENT.md # This file |
| 27 | +└── LICENSE # MIT License |
| 28 | +``` |
| 29 | + |
| 30 | +## Recent Improvements |
| 31 | + |
| 32 | +### Code Organization |
| 33 | +- **Separated Concerns**: Moved components to `src/components/` and styles to `src/styles/` |
| 34 | +- **Extracted Constants**: Created `src/utils/constants.js` for all hardcoded values |
| 35 | +- **Utility Functions**: Isolated typewriter effect into reusable utility |
| 36 | +- **Modular Structure**: Better separation of functionality for maintainability |
| 37 | + |
| 38 | +### Code Quality |
| 39 | +- **Cleaner Components**: Reduced Terminal.jsx from 544 lines to more manageable chunks |
| 40 | +- **Consistent Naming**: Used consistent variable naming conventions |
| 41 | +- **Better State Management**: Improved React hooks usage and effect cleanup |
| 42 | +- **Type Safety**: Better parameter handling and validation |
| 43 | + |
| 44 | +### Performance |
| 45 | +- **Optimized Rendering**: Improved command history rendering logic |
| 46 | +- **Memory Management**: Better cleanup of timers and event listeners |
| 47 | +- **Efficient Updates**: Reduced unnecessary re-renders |
| 48 | + |
| 49 | +### Maintainability |
| 50 | +- **Easy Configuration**: All URLs, quotes, and settings in constants file |
| 51 | +- **Reusable Components**: Modular design for easy extension |
| 52 | +- **Clear Documentation**: Better code comments and structure |
| 53 | +- **Version Control**: Improved .gitignore for React projects |
| 54 | + |
| 55 | +## Development Commands |
| 56 | + |
| 57 | +```bash |
| 58 | +# Install dependencies |
| 59 | +npm install |
| 60 | + |
| 61 | +# Start development server |
| 62 | +npm start |
| 63 | + |
| 64 | +# Build for production |
| 65 | +npm run build |
| 66 | + |
| 67 | +# Run tests |
| 68 | +npm test |
| 69 | + |
| 70 | +# Deploy to GitHub Pages |
| 71 | +npm run deploy |
| 72 | +``` |
| 73 | + |
| 74 | +## Adding New Features |
| 75 | + |
| 76 | +### Adding a New Command |
| 77 | +1. Add command description to `src/utils/constants.js` in `commandDescriptions` |
| 78 | +2. Add command logic to `handleCommand` function in `src/components/Terminal.jsx` |
| 79 | +3. Update help text if needed |
| 80 | + |
| 81 | +### Adding New Quotes |
| 82 | +1. Add quotes to `programmingQuotes` or `matrixQuotes` in `src/utils/constants.js` |
| 83 | + |
| 84 | +### Modifying Animations |
| 85 | +1. Adjust timing constants in `src/utils/constants.js` under `animationTimings` |
| 86 | +2. Modify `src/utils/typewriter.js` for typewriter behavior changes |
| 87 | +3. Update `src/components/MatrixRain.jsx` for background effects |
| 88 | + |
| 89 | +### Styling Changes |
| 90 | +1. Global styles: `src/styles/index.css` |
| 91 | +2. Terminal styles: `src/styles/terminal.css` |
| 92 | +3. Use CSS variables for consistent theming |
| 93 | + |
| 94 | +## Code Style Guidelines |
| 95 | + |
| 96 | +- Use functional components with hooks |
| 97 | +- Keep components under 200 lines when possible |
| 98 | +- Extract constants to the constants file |
| 99 | +- Use descriptive variable names |
| 100 | +- Add comments for complex logic |
| 101 | +- Clean up effects and event listeners properly |
| 102 | + |
| 103 | +## Deployment |
| 104 | + |
| 105 | +The project is configured for GitHub Pages deployment: |
| 106 | +1. Build creates optimized static files |
| 107 | +2. `gh-pages` package handles deployment |
| 108 | +3. GitHub Actions can be added for automatic deployment |
| 109 | + |
| 110 | +## Future Improvements |
| 111 | + |
| 112 | +- Add TypeScript for better type safety |
| 113 | +- Implement React Testing Library tests |
| 114 | +- Add Progressive Web App features |
| 115 | +- Optimize bundle size with code splitting |
| 116 | +- Add accessibility improvements (ARIA labels, keyboard navigation) |
| 117 | +- Implement dark/light theme toggle |
| 118 | +- Add more interactive commands and games |
0 commit comments