First off, thank you for considering contributing to CalcuLite! It's people like you that make this project a great tool for the fitness community.
- Getting Started
- How to Contribute
- Development Guidelines
- Pull Request Process
- Issue Reporting
- Feature Requests
- Node.js 18+
- npm or yarn
- Git
- Code editor (VS Code recommended)
-
Fork the repository
# Click the "Fork" button on GitHub -
Clone your fork
git clone https://github.com/yourusername/Smart-Calories-Calculator.git cd Smart-Calories-Calculator -
Add upstream remote
git remote add upstream https://github.com/FatoomRe/Smart-Calories-Calculator.git
-
Install dependencies
npm install
-
Start development server
npm run dev
-
Run tests
npm run test
We welcome several types of contributions:
- Fix calculation errors
- Resolve UI/UX issues
- Improve performance
- Fix accessibility problems
- New calculation methods
- Additional languages
- Workout plan improvements
- Export format options
- API documentation
- Code comments
- User guides
- Translation improvements
- UI improvements
- Color scheme enhancements
- Icon updates
- Responsive design fixes
- Good First Issues: Look for
good-first-issuelabel - Help Wanted: Check
help-wantedlabel - Bugs: Search for
buglabel - Enhancements: Look for
enhancementlabel
We use ESLint and Prettier for code formatting:
# Check linting
npm run lint
# Fix linting issues
npm run lint:fix
# Format code
npm run format- Use strict TypeScript settings
- Define interfaces for all props
- Avoid
anytype - Use proper generic types
// ✅ Good
interface UserData {
age: number;
weight: number;
height: number;
}
// ❌ Bad
interface UserData {
age: any;
weight: any;
height: any;
}- Use functional components with hooks
- Keep components small and focused
- Use proper prop typing
- Include accessibility attributes
// ✅ Good Component Structure
interface ButtonProps {
onClick: () => void;
children: React.ReactNode;
variant?: 'primary' | 'secondary';
disabled?: boolean;
}
export const Button: React.FC<ButtonProps> = ({
onClick,
children,
variant = 'primary',
disabled = false
}) => {
return (
<button
onClick={onClick}
disabled={disabled}
className={`btn btn-${variant}`}
aria-label="Button action"
>
{children}
</button>
);
};- Use Tailwind CSS utility classes
- Follow mobile-first responsive design
- Maintain consistent spacing
- Support dark mode
// ✅ Good Tailwind Usage
<div className="flex flex-col md:flex-row gap-4 p-6 bg-white dark:bg-gray-800">
<button className="px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded-lg transition-colors">
Click me
</button>
</div>- Write unit tests for utilities
- Test component rendering
- Test user interactions
- Maintain test coverage above 80%
// Example test
describe('calculateBMR', () => {
test('should calculate BMR for male correctly', () => {
const result = calculateBMR(70, 175, 25, 'male');
expect(result).toBeCloseTo(1673, 0);
});
test('should calculate BMR for female correctly', () => {
const result = calculateBMR(60, 165, 25, 'female');
expect(result).toBeCloseTo(1379, 0);
});
});- Add translations for both English and Arabic
- Test RTL layout for Arabic
- Use semantic keys for translations
// ✅ Good translation structure
const translations = {
en: {
calculator: {
title: "Calories Calculator",
age: "Age (years)",
submit: "Calculate My Plan"
}
},
ar: {
calculator: {
title: "حاسبة السعرات",
age: "العمر (سنة)",
submit: "احسب خطتي"
}
}
};-
Update from upstream
git fetch upstream git checkout main git merge upstream/main
-
Create feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Follow coding guidelines
- Add tests
- Update documentation
-
Test your changes
npm run test npm run build -
Commit with semantic messages
git commit -m "feat: add new calculation method" git commit -m "fix: resolve mobile layout issue" git commit -m "docs: update API documentation"
Use semantic commit messages:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changesrefactor: Code refactoringtest: Adding testschore: Maintenance tasks
When creating a PR, include:
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
## Testing
- [ ] Unit tests pass
- [ ] Manual testing completed
- [ ] Cross-browser testing
## Screenshots
Include screenshots for UI changes
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Tests added/updated
- [ ] Documentation updatedUse this template for bug reports:
**Bug Description**
Clear description of the bug
**Steps to Reproduce**
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected Behavior**
What should happen
**Screenshots**
Add screenshots if applicable
**Environment**
- OS: [e.g. Windows 10]
- Browser: [e.g. Chrome 91]
- Version: [e.g. 1.0.0]For performance-related issues:
- Include browser DevTools performance screenshots
- Mention device specifications
- Describe the specific slow operation
**Feature Description**
Clear description of the feature
**Problem Statement**
What problem does this solve?
**Proposed Solution**
How should this feature work?
**Alternatives Considered**
Other solutions you've considered
**Additional Context**
Screenshots, mockups, or examplesWe prioritize features based on:
- User Impact: How many users benefit
- Complexity: Development effort required
- Alignment: Fits project goals
- Community Interest: GitHub reactions and comments
- Functionality: Does it work correctly?
- Code Quality: Is it readable and maintainable?
- Performance: Does it impact app performance?
- Security: Are there any security concerns?
- Accessibility: Is it accessible to all users?
- Testing: Are there adequate tests?
- Small PRs: 1-2 days
- Medium PRs: 3-5 days
- Large PRs: 1-2 weeks
Contributors will be recognized in:
- GitHub contributors list
- README.md acknowledgments
- Release notes (for significant contributions)
Join our community:
- GitHub Discussions: Technical discussions
- Issues: Bug reports and feature requests
- Discord: Real-time chat (coming soon)
Don't hesitate to ask questions:
- Create a GitHub Discussion
- Comment on existing issues
- Reach out to maintainers
Thank you for contributing to Calories Calculator! 🍏💚
Together, we're building a tool that helps people achieve their fitness goals.