6 Commits

Author SHA1 Message Date
f1fc803b0e style: clarify tempo unit labels to show millisecond durations
Update musical note unit labels to include "(ms)" suffix to make it
clear that values represent durations in milliseconds, not counts.

Before: "120 BPM = 2,000 Whole Notes" (confusing - sounds like a count)
After: "120 BPM = 2,000 Whole Note (ms)" (clear - it's a duration)

Changes:
- All note units now show "(ms)" in both singular and plural forms
- Triplet labels shortened for brevity (e.g., "Quarter Triplet (ms)")
- Makes the conversion meaning immediately clear to users

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 13:50:14 +01:00
fa1b82bbd6 fix: handle same-unit conversions in tempo converter
Fix issue where converting BPM to BPM (or any tempo unit to itself)
was incorrectly applying the conversion formula instead of returning
the same value.

Example bug: 120 BPM → BPM was returning 0.008333 instead of 120

Added check: if fromUnit === toUnit, return value unchanged.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 11:59:15 +01:00
75f895284f feat: add custom tempo/BPM converter with musical note units
Add comprehensive tempo conversion system supporting:
- BPM (beats per minute) as base unit
- Musical note durations: whole, half, quarter, eighth, sixteenth, thirty-second
- Dotted notes (1.5x duration): dotted-half, dotted-quarter, dotted-eighth, dotted-sixteenth
- Triplet notes (2/3 duration): quarter-triplet, eighth-triplet, sixteenth-triplet
- Time units: milliseconds, seconds, Hertz

Technical implementation:
- Created lib/tempo.ts with custom measure definition
- Extended lib/units.ts with tempo integration and reciprocal conversion logic
- Added tempo category color (orange #F97316) to globals.css
- Conversion formula: milliseconds per beat = 60000 / BPM
- Special handling for BPM ↔ time unit conversions using reciprocal relationship

The tempo converter integrates seamlessly with existing UX:
- Appears as "Tempo / BPM" category in category selector
- Supports all features: search, favorites, history, visual comparison, draggable bars
- Enables musicians to convert between BPM and note durations for tempo calculations

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 11:53:50 +01:00
1943974908 fix: use direct hex colors for visual comparison bars
Fixed the colored bar segments not showing:

🎨 Direct Color Implementation:
- Added getCategoryColorHex() function to return actual hex values
- Changed from CSS variables to direct backgroundColor
- No more var(--color-*) that wasn't resolving
- Direct hex colors like #3B82F6 for length, #10B981 for mass, etc.

 Visual Improvements:
- Taller bars (h-8, 32px) for better visibility
- Drop shadow on percentage labels for readability
- White text on bars >30% filled
- Foreground color text on smaller bars
- pointer-events-none on overlay to prevent interaction issues

🔧 Updated Components:
- MainConverter: Import and use getCategoryColorHex()
- VisualComparison: Accept hex color string directly
- lib/units: Added getCategoryColorHex() with all 23 colors

The bars will now definitely show with vibrant colors!

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 10:31:35 +01:00
5a7bb9a05c feat: implement Phase 3 - Advanced UX features and interactivity
Add comprehensive UX enhancements with innovative features:

🔍 Fuzzy Search Component (SearchUnits.tsx):
- Powered by Fuse.js for intelligent fuzzy matching
- Searches across unit abbreviations, names, and categories
- Real-time dropdown with results
- Keyboard shortcut: Press "/" to focus search
- Press Escape to close
- Click outside to dismiss
- Shows measure category with color dot
- Top 10 results displayed
- Smart weighting: abbr (2x), singular/plural (1.5x), measure (1x)

💾 Conversion History (ConversionHistory.tsx):
- LocalStorage persistence (max 50 entries)
- Auto-saves conversions as user types
- Collapsible history panel
- Click to restore previous conversion
- Clear all with confirmation
- Shows relative time (just now, 5m ago, etc.)
- Live updates across tabs with storage events
- Custom event dispatch for same-window updates

🌓 Dark Mode Support:
- ThemeProvider with light/dark/system modes
- Persistent theme preference in localStorage
- Smooth theme transitions
- ThemeToggle component with animated sun/moon icons
- Gradient text adapts to theme
- System preference detection

 Favorites & Copy Features:
- Star button to favorite units (localStorage)
- Copy to clipboard with visual feedback
- Hover to reveal action buttons
- Check icon confirmation for 2 seconds
- Yellow star fill for favorited units

⌨️ Keyboard Shortcuts:
- "/" - Focus search input
- "Escape" - Close search, blur inputs
- More shortcuts ready to add (Tab, Ctrl+K, etc.)

📦 LocalStorage Utilities (lib/storage.ts):
- saveToHistory() - Add conversion record
- getHistory() - Retrieve history
- clearHistory() - Clear all history
- getFavorites() / addToFavorites() / removeFromFavorites()
- toggleFavorite() - Toggle favorite status
- Type-safe ConversionRecord interface
- Automatic error handling

🎨 Enhanced MainConverter:
- Integrated search at top
- Conversion history at bottom
- Copy & favorite buttons on each result card
- Hover effects with opacity transitions
- Auto-save to history on conversion
- Click history item to restore conversion
- Visual feedback for all interactions

📱 Updated Layout & Page:
- ThemeProvider wraps entire app
- suppressHydrationWarning for SSR
- Top navigation bar with theme toggle
- Keyboard hint for search
- Dark mode gradient text variants

Dependencies Added:
- fuse.js 7.1.0 - Fuzzy search engine
- lucide-react 0.553.0 - Icon library (Search, Copy, Star, Check, etc.)

Features Now Working:
 Intelligent fuzzy search across 187 units
 Conversion history with persistence
 Dark mode with system detection
 Copy any result to clipboard
 Favorite units for quick access
 Keyboard shortcuts (/, Esc)
 Smooth animations and transitions
 Mobile-responsive design

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 10:14:03 +01:00
901d9047e2 feat: implement Phase 2 - Core conversion engine and UI
Complete Phase 2 implementation with working unit converter:

Core Conversion Engine (lib/units.ts):
- Type-safe wrapper for convert-units library
- Support for all 23 measures with TypeScript types
- getAllMeasures() - Get all available categories
- getUnitsForMeasure() - Get units for specific measure
- getUnitInfo() - Get detailed unit information
- convertUnit() - Convert between two units
- convertToAll() - Convert to all compatible units
- getCategoryColor() - Get Tailwind color class for measure
- formatMeasureName() - Format measure names for display
- searchUnits() - Fuzzy search across all units

Utility Functions (lib/utils.ts):
- cn() - Merge Tailwind classes with clsx and tailwind-merge
- formatNumber() - Smart number formatting with scientific notation
- debounce() - Debounce helper for inputs
- parseNumberInput() - Parse user input to number
- getRelativeTime() - Format timestamps

UI Components:
- Input - Styled input with focus states
- Button - 6 variants (default, destructive, outline, secondary, ghost, link)
- Card - Card container with header, title, description, content, footer

Main Converter Component (components/converter/MainConverter.tsx):
- Real-time conversion as user types
- Category selection with 23 color-coded buttons
- Input field with unit selector
- Grid display of all conversions in selected measure
- Color-coded result cards with category colors
- Responsive layout (1/2/3 column grid)

Homepage Updates:
- Integrated MainConverter component
- Clean header with gradient text
- Uses design system colors

Dependencies Added:
- clsx - Class name utilities
- tailwind-merge - Merge Tailwind classes intelligently

Features Working:
✓ Select from 23 measurement categories
✓ Real-time conversion to all compatible units
✓ Color-coded categories
✓ Formatted number display
✓ Responsive design

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 09:34:57 +01:00