foamking/CLAUDE.md
mikl0s 7d2bbae1c6 Initial implementation of Foam King Gulve price calculator
Features:
- Complete Next.js 16 app with TypeScript and Tailwind CSS
- Customer-facing price calculator form with validation
- Admin mode showing detailed price breakdowns
- Accurate price calculations matching business requirements
- Responsive design with custom shadcn/ui theme
- API endpoint for quote requests
- Danish postal code distance calculations
- Complete test coverage against documentation examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-10 14:27:28 +00:00

143 lines
No EOL
4.2 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
**FoamKing** is a Danish flooring price calculator web application for Foam King Gulve. The calculator will be hosted at `beregner.foamking.dk` and provides instant price estimates for floor solutions including insulation, floor heating, synthetic mesh, and self-leveling compound.
## Technology Stack
**Planned stack:** Next.js + shadcn/ui + Tailwind CSS
- **Next.js**: For server-side rendering and API routes
- **shadcn/ui**: For accessible, customizable components
- **Tailwind CSS**: For styling
- **Custom theme**: Already defined in `docs/shadcn theme.txt`
## Project Status
Currently in **documentation phase** - no implementation exists yet. Key documentation files:
- `docs/projektplan.md` - Complete project plan and requirements
- `docs/prisbeskrivelse.md` - Detailed pricing logic and formulas
- `docs/shadcn theme.txt` - Custom shadcn theme (blue/orange color scheme)
- `docs/foam king logo.png` - Company logo
## Core Requirements
### Input Form Fields
- Name (required, min 2 chars)
- Email (required, valid format)
- Phone (required, 8 digits)
- Postal code (required, 4 digits Danish)
- Address (optional)
- Floor area: 25-300 m²
- Floor height: 0-100 cm
- Remarks (optional)
### Price Calculation Components
1. **Insulation**: 3,730 kr/m³ (subtract 5cm from height for concrete)
2. **Floor heating**: 205 kr/m² (always included)
3. **Synthetic mesh**: 49 kr/m² (always included)
4. **Self-leveling compound**: 450 kr/m² (90 kg/m²)
5. **Pump truck fee**: Based on compound weight (0-8,100 kr)
6. **Start fee**: 3,500 kr fixed
7. **Transport**: 18.75 kr/km round-trip from 4550 Asnæs
8. **Percentage fees**: 0.95% for covering/waste
9. **VAT**: 25%
### Output
- Price estimate with ±10,000 kr variation
- Option to request binding quote (sends email to `info@foamking.dk`)
## Implementation Guidelines
### Distance Calculation
Three options for calculating transport distance:
1. **Postal code table** (recommended for MVP)
2. **OpenRouteService API** (free up to 2,000 requests/day)
3. **Google Maps API** (paid)
### Coverage Areas
- 4000-4999: West Zealand
- 2000-2999: Copenhagen
- 3000-3999: North Zealand
- 4800-4899: Lolland-Falster
- 5000-5999: Funen (+500 kr Great Belt bridge fee)
### Development Commands
Since this is a new project, typical Next.js commands will apply once initialized:
```bash
# Initialize project
npx create-next-app@latest . --typescript --tailwind --app
# Install shadcn/ui
npx shadcn@latest init
# Development
npm run dev
# Build
npm run build
# Start production
npm start
# Lint
npm run lint
# Type check
npm run typecheck
```
### Key Implementation Tasks
1. Create responsive form with validation
2. Implement price calculation logic from `prisbeskrivelse.md`
3. Apply custom shadcn theme from `shadcn theme.txt`
4. Add distance calculation (start with postal code table)
5. Create email functionality for quote requests
6. Add error handling and loading states
7. Ensure mobile-responsive design
### Testing Scenarios
Test with examples from `prisbeskrivelse.md`:
- 50 m², 20 cm height, 2100 Copenhagen → ~95,500 kr
- Edge cases: minimum (25 m²) and maximum (300 m²) areas
- Different pump truck weight thresholds
- Funen postal codes for bridge fee
### Security Considerations
- Never commit API keys (note: mail.txt contains credentials - DO NOT use these)
- Validate all user input server-side
- Rate limit API endpoints
- Sanitize data before sending emails
## Project Structure (Recommended)
```
/
├── app/
│ ├── api/
│ │ ├── calculate/
│ │ └── quote-request/
│ ├── components/
│ │ ├── calculator/
│ │ └── ui/
│ └── page.tsx
├── lib/
│ ├── calculations.ts
│ ├── constants.ts
│ └── distance.ts
└── public/
└── foam-king-logo.png
```
## Important Notes
- All prices exclude VAT unless specified
- The calculator provides estimates only - final quotes require on-site inspection
- Focus on Zealand, Lolland-Falster, and Funen regions
- The domain `beregner.foamking.dk` points to `185.158.133.1`