This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Trip Share is a modern, mobile-first trip planning web app built as part of Decode's onboarding tutorial. It features interactive maps, itinerary planning, and social features for collaborative trip planning.
- Frontend: React 19 + TypeScript
- Build Tool: Vite (dev server runs on port 5179)
- Routing: TanStack Router (file-based routing with auto-generated route tree)
- State Management:
- Zustand (client state with persistence)
- TanStack Query (server state/async data)
- Styling: TailwindCSS v3 with custom design system
- UI Components:
- Silk Bottom Sheets (
@silk-hq/components) - Custom components in
src/components/
- Silk Bottom Sheets (
- Maps: MapLibre GL JS
- Animation: Framer Motion
# Install dependencies
pnpm install
# Start dev server (runs on http://localhost:5179)
pnpm dev
# Type check and build for production
pnpm build
# Lint code
pnpm lint
# Preview production build
pnpm previewUses TanStack Router with file-based routing. Routes are defined in src/routes/:
__root.tsx- Root layout with AppShell wrapperindex.tsx- Redirects to /discoverdiscover.tsx- Browse citiescities.$cityId.tsx- City detail viewtrips.index.tsx- Trip listtrips.$tripId.tsx- Trip detail with itinerarymap.tsx- Interactive map with place filteringactivity.tsx- Social activity feedmessages.index.tsx- Conversation listmessages.$conversationId.tsx- Chat viewsettings.index.tsx- Settings menusettings.profile.tsx- Profile settingscomponents.index.tsx- Component gallery
Important: The route tree is auto-generated at src/routeTree.gen.ts by the TanStack Router Vite plugin. Don't edit this file manually.
Zustand Stores (in src/stores/):
useTripsStore- Trip and itinerary data with localStorage persistenceuseMapStore- Map state (center, zoom, selected place, category filters)
TanStack Query: Used for async data fetching via mock API (src/lib/mock-api.ts). Configured in src/main.tsx with 5-minute stale time.
- Mock data is defined in
src/lib/seed-data.ts(cities, places, trips, users) src/lib/mock-api.tsprovides async functions that simulate API calls with 300ms latency- Components use TanStack Query hooks to fetch data
- Zustand stores manage client-side state that needs persistence or global access
Layout Components:
AppShell.tsx- Main layout with bottom navigation and floating settings button- Hides UI chrome when viewing single component (
/components?component=X) - Bottom nav highlights active route with animated indicator
- Hides UI chrome when viewing single component (
Feature Components:
Map.tsx- MapLibre GL integration with category filteringPlaceDetailSheet.tsx- Silk bottom sheet for place detailsCityDetailSheet.tsx- Silk bottom sheet for city overviewLoadingSkeleton.tsx- Loading states
UI Components (in src/components/ui/):
BottomSheet.tsx- Wrapper for Silk bottom sheetsTabs.tsx- Animated tab navigation
Custom dark theme defined in tailwind.config.js:
Colors:
- Background:
#0C0F14 - Surface:
#11161C - Text Primary:
#E8EDF7 - Text Secondary:
#9AA5B4 - Accent Teal:
#2ED3B7 - Accent Cyan:
#22D3EE
Patterns:
- Glass morphism effects with backdrop blur
- Gradient backgrounds (teal → cyan)
- Rounded corners (2xl = 1rem, 3xl = 1.5rem)
- Custom animations (shimmer, float, pulse-slow)
The /components route provides a comprehensive design system showcase:
Layout Structure:
- Grid View (
/components): Displays all components organized by category with mini previews - Isolation View (
/components?component=ComponentId): Shows a single component without any UI chrome (no AppShell, no navigation)
How to view components in isolation:
- Navigate to
/componentsto see the gallery grid - Click any component or manually add
?component=ComponentIdto URL - The component will render centered on screen without bottom nav or settings button
- Perfect for developing/reviewing components in isolation or embedding in webviews
Component Categories:
- Timeline & Cards:
TripTimelineCard,TripCardVariants,CityCard,ActivityCard - Chat & Messaging:
MessageBubble,MessageBubbleVariants,ConversationItem - Navigation:
TabsComponent,SettingsItem - UI Elements:
DateBadge,AvatarGroup,StatusBadges,Buttons
Implementation Details:
- Component definitions live in
src/routes/components.index.tsx - Each component has mock data and demonstrates usage patterns
- Mini previews shown in grid, full version in isolation view
- The
isSingleComponentViewflag in AppShell detects?component=query param and hides chrome
Use Cases:
- Design system documentation
- Component development in isolation
- Embedding components in external tools/webviews
- Visual regression testing
- Design review sessions
Sizing Components for Webviews: When adding component gallery items to boards in Decode:
- ALWAYS analyze the component code first to estimate its natural rendered size
- Components in isolation view (
?component=X) are centered with minimal chrome - Most UI components are much smaller than full mobile views - avoid generic dimensions
- Size webviews to tightly fit the component content, leaving minimal blank space
- Inspect the JSX structure to understand component dimensions:
- Check hardcoded width/height values
- Look at padding, text sizes, and nested elements
- Consider that the component renders centered in the viewport
- Size guidelines by component type:
- Small atomic components (badges, pills, single buttons): ~100-250w x 40-100h
- Avatar groups, status indicators: ~150-250w x 50-100h
- Medium components (cards, list items, forms): ~300-450w x 100-250h
- Large cards with rich content: ~350-500w x 250-450h
- Button groups (3+ buttons stacked): ~250-350w x 200-300h
- Err on the side of compact - it's better to be slightly too small than show excessive blank space
@/ is aliased to ./src/ in vite.config.ts. Always use this for imports:
import { mockApi } from '@/lib/mock-api'
import { useTripsStore } from '@/stores/useTripsStore'src/main.tsx- App entry point, router + query client setupsrc/types/index.ts- TypeScript type definitionssrc/lib/seed-data.ts- Mock datasrc/lib/mock-api.ts- Simulated backend APIsrc/lib/utils.ts- Utility functions (includingcnfor class merging)tailwind.config.js- Design system configurationvite.config.ts- Build configuration
- The app uses mock data only (no real backend)
- MapLibre GL requires map tiles - check Map component for configuration
- Bottom sheets use Silk components - refer to their docs for advanced usage
- All routing is client-side via TanStack Router
- localStorage is used for trip/itinerary persistence via Zustand middleware
- The Tutorial.decode file is a Decode-specific design file (ignore for code work)