Skip to content

Wave-to-Meet Quick Start Guide โ€‹

Get the Wave-to-Meet feature running locally in 5 minutes.


Prerequisites โ€‹

  • Node.js 16+ installed
  • Code editor (VS Code recommended)
  • Terminal access

Setup โ€‹

1. Install Dependencies โ€‹

bash
cd /home/mechelle/repos/lantern_app
npm install

2. Start Development Server โ€‹

bash
npm run dev

Server starts at http://localhost:5173


Testing the Feature โ€‹

  1. Open the app in your browser

  2. Simulate a wave:

    • Look for the purple "Simulate Wave" button in the top-right corner
    • Click it to trigger an incoming wave notification
  3. Accept the wave:

    • Wave notification appears at bottom of screen
    • Click "Accept" button
    • Connection is created
  4. Open chat:

    • Click "Open Chat" button on the accepted wave
    • Full-screen chat interface opens
    • Type a message and press Send
  5. Activate beacon:

    • Click "Hold Up Lantern to Meet" button
    • Full-screen color beacon activates
    • Color pulses and glows
  6. Test different colors:

    • Close beacon (X button)
    • Decline the wave
    • Simulate another wave
    • Accept it (gets random color)
    • Repeat to see all 5 colors

Option B: Storybook โ€‹

bash
npm run storybook

Browse components:

  • Components > WaveManager: Wave notification states
  • Components > Chat: Chat interface with messages
  • Components > LanternBeacon: All 5 color variants

File Structure โ€‹

src/
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ WaveManager.jsx         # Wave notifications
โ”‚   โ”œโ”€โ”€ WaveManager.stories.jsx
โ”‚   โ”œโ”€โ”€ Chat.jsx                # Anonymous chat
โ”‚   โ”œโ”€โ”€ Chat.stories.jsx
โ”‚   โ”œโ”€โ”€ LanternBeacon.jsx       # Color beacon
โ”‚   โ””โ”€โ”€ LanternBeacon.stories.jsx
โ”‚
โ”œโ”€โ”€ dashboard/
โ”‚   โ””โ”€โ”€ Dashboard.jsx           # Main app (integrates wave flow)
โ”‚
โ””โ”€โ”€ App.jsx                     # Root component

docs/
โ”œโ”€โ”€ features/
โ”‚   โ””โ”€โ”€ wave/
โ”‚       โ”œโ”€โ”€ WAVE_TO_MEET.md            # Complete feature docs
โ”‚       โ”œโ”€โ”€ FEATURE_SUMMARY.md         # Implementation summary
โ”‚       โ”œโ”€โ”€ BEACON_COLORS.md           # Color reference
โ”‚       โ””โ”€โ”€ WAVE_QUICK_START.md        # This guide
โ””โ”€โ”€ engineering/
   โ””โ”€โ”€ API.md                        # Backend endpoints (updated)

Key Functions to Know โ€‹

In Dashboard.jsx โ€‹

Send a wave:

js
handleSendWave(lanternId)
// TODO: POST to /api/waves

Accept a wave:

js
handleAcceptWave(waveId)
// Generates random color
// Creates connection
// TODO: POST to /api/waves/:id/accept

Open chat:

js
handleOpenChat(connectionId)
// Sets activeChat state
// Renders Chat component

Activate beacon:

js
handleHoldUpLantern()
// Sets showBeacon to true
// Renders LanternBeacon component

Simulating Backend Responses โ€‹

The feature is currently frontend-only with stubbed data. To connect to a real backend:

1. Update Wave Sending โ€‹

In Dashboard.jsx, replace:

js
console.log('Wave sent to lantern:', lanternId)

With:

js
await fetch('/api/waves', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ targetLanternId: lanternId, senderLanternId: myLantern.id })
})

2. Add WebSocket for Real-time Waves โ€‹

js
useEffect(() => {
  const ws = new WebSocket('ws://localhost:3000/ws/waves')
  
  ws.onmessage = (event) => {
    const data = JSON.parse(event.data)
    if (data.type === 'wave_received') {
      setIncomingWaves([...incomingWaves, data.wave])
    }
  }

  return () => ws.close()
}, [])

3. Update Chat Messages โ€‹

In Chat.jsx, replace the TODO with:

js
await fetch('/api/messages', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ connectionId: connection.id, text: message, timestamp: new Date() })
})

Troubleshooting โ€‹

Wave button doesn't work โ€‹

  • Check browser console for errors
  • Verify onWave prop is passed to VenueView component
  • Ensure handleSendWave is defined in Dashboard

Chat doesn't open after accepting wave โ€‹

  • Verify activeChat state is set correctly
  • Check that Chat component is rendered conditionally
  • Inspect React DevTools for state changes

Beacon doesn't show matching color โ€‹

  • Verify matchColor is in the connection object
  • Check that showBeacon state is true
  • Try different colors in Storybook to isolate issue

"Simulate Wave" button not appearing โ€‹

  • Only shows in development mode (NODE_ENV === 'development')
  • Check that dev server is running (not production build)

Next Steps โ€‹

  1. Review Documentation:

  2. Backend Integration:

    • Implement WebSocket server for real-time notifications
    • Create REST endpoints for waves, connections, messages
    • Add geofencing validation
  3. Testing:

    • Write unit tests for wave acceptance logic
    • Test color synchronization across devices
    • Validate rate limiting
  4. Deploy:

    • Remove "Simulate Wave" button
    • Build production bundle: npm run build
    • Deploy with your hosting provider

Questions? โ€‹

Happy coding! ๐Ÿฎ

Built with VitePress