Thank you for your interest in contributing to EZ Cart! This guide will help you get started with contributing to our project.
EZ Cart is built using Next.js and follows its conventional structure:
src/app
: Main application pages and layoutssrc/components
: Reusable React componentssrc/helpers
: Helper functions and utilitiessrc/styles
: Global styles and CSS modules
The main landing page of the application is located in Home.tsx. It includes several sections:
- Header with logo and navigation
- Hero section with a call-to-action
- Features section
- About section explaining the tax calculation feature
- Installation guide section
- Footer with links
The cart functionality is managed by a custom hook useCart
and the main cart page component.
Located in useCart.ts, this hook manages the cart state and provides various functions for cart operations. It uses utility functions from cartUtils.ts for calculations and data handling.
The cart page component is defined in page.tsx. It includes:
- A list of cart items
- Subtotal, tax, and total calculations
- Form for adding new items
- Buttons for sharing and clearing the cart
EZ Cart uses several reusable UI components located in the ui directory, including Button, Card, Input, and Toast.
The application uses Next.js routing, with the main layout defined in layout.tsx.
Tax rates and country/state information are managed in taxes.ts.
- Fork the repository and clone it locally.
- Install dependencies using
npm install
oryarn install
. - Create a new branch for your feature or bug fix.
- Make your changes, ensuring they follow the existing code style.
- Test your changes thoroughly.
- Commit your changes with a clear and descriptive commit message.
- Push your changes to your fork and submit a pull request.
- Use TypeScript for type safety.
- Follow the existing code structure and naming conventions.
- Write clear and concise comments for complex logic.
- Use functional components and hooks for React components.
- Optimize performance where possible, especially in frequently used components.
- Write unit tests for new functionality.
- Ensure all existing tests pass before submitting a pull request.
- Update the README.md file if you're adding new features or changing existing functionality.
- Include inline documentation for complex functions or components.
- Provide a clear description of the changes in your pull request.
- Reference any related issues in your pull request description.
- Ensure your code passes all tests and linting checks.
The project uses TypeScript for type safety. Key interfaces include:
export interface GroceryItem {
id: number;
name: string;
price: number;
quantity: number;
}
export interface SharedData {
items: GroceryItem[];
countryCode: string | null;
region: string | null;
}
export interface Country {
code: string;
name: string;
regions: TaxRegion[];
}
export interface TaxRegion {
name: string;
rate: number;
}
These interfaces are used throughout the application to ensure type consistency.
EZ Cart is set up as a PWA, with the manifest file located at manifest.ts. The PWA functionality is handled by PWAHandler.tsx, which manages the app's behavior when installed as a standalone application.
Thank you for contributing to EZ Cart! Your efforts help make our project better for everyone.