A modern, responsive React application designed specifically for cannabis dispensary employees to calculate and track tip distributions between Front of House and Back of House staff.
- Features
- Technology Stack
- Installation
- Usage
- Project Structure
- Business Logic
- Keyboard Shortcuts
- Contact
- Beautiful, responsive number pad with tactile button feedback
- Decimal point validation (prevents multiple decimals)
- Backspace and clear functionality
- Large, readable display
- Keyboard support for enhanced productivity
- Employee count input (full-time and part-time)
- Automatic hour calculation (8 hours for full-time, 5.5 for part-time)
- Back of House inclusion toggle
- Individual hours worked tracking
- Real-time tip distribution calculation
- Dedicated 15% tip allocation when included
- Employee count and hours tracking
- Proportional distribution based on hours worked
- Independent tip management
- Persistent tip history using localStorage
- Individual tip deletion with trash icon
- Bulk deletion option
- Real-time running totals
- Cross-session data retention
- Fully responsive design (mobile, tablet, desktop)
- Touch-friendly button sizes (44px minimum)
- Smooth animations and hover effects
- Error validation with user-friendly messages
- Accessibility considerations
- Number keys (0-9) for input
- Decimal point key
- Backspace for deletion
- Escape/Delete for clearing
- Enter for tip collection (Front of House)
- Frontend Framework: React 18+ with Hooks
- Styling: Pure CSS with CSS Grid & Flexbox
- Icons: Lucide React
- Build Tool: Vite
- State Management: React useState, useEffect & useRef
- Data Persistence: Browser localStorage
- Responsive Design: CSS Media Queries
- Node.js (version 16.0 or higher)
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/yourusername/tip-calculator.git cd tip-calculator
-
Install dependencies
npm install # or yarn install
-
Start the development server
npm run dev # or yarn dev
-
Open your browser
Navigate to http://localhost:5173
npm run build
# or
yarn build
The built files will be in the dist
directory.
- Enter Tip Amount: Use the calculator or keyboard to input the total tip amount
- Configure Front of House:
- Select whether Back of House is included
- Enter number of full-time employees (8 hours each)
- Enter number of part-time employees (5.5 hours each)
- Enter your individual hours worked
- Click "Collect Tips"
- Configure Back of House (if applicable):
- Enter total number of Back of House employees
- Enter your individual hours worked
- Click "Collect Tips"
- View Results: See individual tip amounts and running totals
- Manage Tips: Delete individual entries or clear all tips
- Total tips: $100
- 2 full-time employees (16 total hours)
- You worked 8 hours
- Your share: $50.00
- Total tips: $100
- Front of House: 2 full-time employees (16 hours)
- Back of House: 3 employees (24 hours)
- You're Front of House, worked 8 hours
- Front of House gets: $85 (85% of total)
- Your share: $42.50
- Total tips: $100
- 4 Back of House employees (32 total hours)
- You worked 8 hours
- Back of House gets: $15 (15% of total)
- Your share: $3.75
tip-calculator/
โโโ public/
โ โโโ index.html
โโโ src/
โ โโโ Components/
โ โ โโโ Frontofhouse.jsx # Front of House calculator
โ โ โโโ Frontofhouse.css # Front of House styles
โ โ โโโ Backofhouse.jsx # Back of House calculator
โ โ โโโ Backofhouse.css # Back of House styles
โ โโโ App.jsx # Main app component
โ โโโ App.css # Calculator and layout styles
โ โโโ index.css # Global styles
โ โโโ main.jsx # React entry point
โโโ package.json
โโโ README.md
Individual Tip = (Total Tips ร 0.85) รท Total Team Hours ร Individual Hours
Individual Tip = Total Tips รท Total Team Hours ร Individual Hours
Individual Tip = (Total Tips ร 0.15) รท Total Team Hours ร Individual Hours
- Full-time employees: Count ร 8 hours
- Part-time employees: Count ร 5.5 hours
- Total team hours: Full-time hours + Part-time hours
- Tip amount must be positive number
- Employee counts must be valid integers
- Individual hours must be positive
- At least one employee type must have hours
- Back of House inclusion must be selected
Key | Action |
---|---|
0-9 |
Enter numbers |
. |
Add decimal point |
Backspace |
Delete last character |
Escape / Delete |
Clear display |
Enter |
Collect Front of House tips |
Note: Keyboard shortcuts are disabled when form inputs are focused to prevent interference.
Developer: Alexander Robaczewski
- GitHub: @Arobaczewski
- LinkedIn: Alexander Robaczewski
- Email: alexander.robaczewski@gmail.com
โญ Star this repo if you found it helpful! โญ
Built with โค๏ธ for the cannabis industry