Skip to content

Design and build Delight app shell with core surfaces#18

Open
thejackluo wants to merge 9 commits intomainfrom
claude/delight-app-shell-01N3hZUa4f8ERhoTFK2ojNZL
Open

Design and build Delight app shell with core surfaces#18
thejackluo wants to merge 9 commits intomainfrom
claude/delight-app-shell-01N3hZUa4f8ERhoTFK2ojNZL

Conversation

@thejackluo
Copy link
Copy Markdown
Contributor

No description provided.

claude and others added 9 commits November 18, 2025 17:40
Built comprehensive application shell for Delight with proper navigation,
mock data, and all core surfaces ready for backend wiring.

## What was built:

### 1. Foundation Layer
- Created comprehensive constants and type system (value categories, zones, mission statuses)
- Built extensive mock data layer with realistic seed data
- Implemented proper TypeScript types for all entities
- Updated Tailwind theme with brand colors (warm amber/gold primary, soft purple secondary)

### 2. App Layout & Navigation
- Implemented authenticated app layout with sticky header
- Built responsive navigation with Dashboard, Missions, Memory, Narrative, Progress, Lab tabs
- Integrated Clerk UserButton for authentication
- Added mobile-responsive navigation patterns

### 3. Dashboard Hub (`/dashboard`)
- Greeting card with date, time, and narrative snippet
- Mission Triad showing high/medium/low priority missions
- Streak snapshot with category breakdowns
- DCI mini chart with 7-day sparkline
- Quick jump tiles to all main sections

### 4. Goals & Missions (`/missions`)
- Tabbed interface for Goals and Missions views
- Goals list with filtering by status and detail panel
- Mission list with comprehensive table view
- Reusable Mission Triad component
- Mission cards with category chips, time estimates, energy levels

### 5. Memory Studio (`/memory`)
- 3-tier memory visualization (Personal, Project, Task)
- Search and filter capabilities
- Memory detail panel with metadata
- Visual distinction between memory tiers
- Organized UI for exploring memory graph

### 6. Narrative Explorer (`/narrative`)
- Chapter navigation with act/chapter structure
- Beautiful story reading area with prose typography
- World state panel showing:
  - Location discovery status
  - Character relationship levels
  - Items, titles, and artifacts
- Emotional tone indicators

### 7. Progress & DCI Dashboard (`/progress`)
- Large DCI score card with breakdown
- 7/30/90 day trend visualizations
- Streak panel with category progress bars
- Mission distribution by value category
- Highlight reels display

### 8. Dev Lab (`/lab`)
- Eliza Chat tester with model selection
- Memory Inspector with query testing
- Narrative generation simulator
- Dev tools (cost estimator, latency monitor, toggles)
- Warning banner for internal tool designation

## Technical Implementation:
- All surfaces use mock data from `/lib/mock/data.ts`
- Clear `// TODO:` comments for API wiring points
- Responsive design with mobile support
- Consistent component structure and styling
- shadcn/ui Tabs component integrated
- Proper TypeScript typing throughout
- Build successful with Next.js 15

## Next Steps:
All surfaces are ready for backend integration. Each page includes TODO comments
indicating where to wire real API calls (e.g., `// TODO: wire to /api/v1/missions`).
Added critical foundation files that were missing from initial commit:
- lib/constants/index.ts: Value categories, zones, mission statuses
- lib/types/index.ts: Complete TypeScript type definitions
- lib/mock/data.ts: Comprehensive mock data for all surfaces
- lib/utils.ts: Utility functions (cn, formatDate, formatDuration, etc.)

These files are essential for all app surfaces to function.
…ttps://github.com/magk-app/delight into claude/delight-app-shell-01N3hZUa4f8ERhoTFK2ojNZL

# Conflicts:
#	packages/frontend/src/lib/constants/index.ts
#	packages/frontend/src/lib/mock/data.ts
#	packages/frontend/src/lib/types/index.ts
#	packages/frontend/src/lib/utils.ts
Landing Page Improvements:
- Auto-redirect authenticated users to /dashboard
- Beautiful hero section with Delight branding
- Features grid showcasing 4 key features (Goals, Memory, Narrative, Progress)
- Value categories section with visual cards (Health, Craft, Growth, Connection)
- Clean gradient design with proper CTAs
- Professional footer

Documentation:
- Created comprehensive implementation guide at docs/implementation/app-shell-implementation.md
- Documents all 6 surfaces with detailed breakdowns
- Integration guide with clear TODO mapping
- File manifest and git history
- Testing checklist and deployment notes
- Architecture explanation and data layer description

This completes the app shell implementation with proper user flow and documentation.
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Nov 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
delight Ready Ready Preview Comment Nov 18, 2025 7:50pm

Copy link
Copy Markdown
Contributor Author

@thejackluo thejackluo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, mostly frontend changes

@claude
Copy link
Copy Markdown

claude bot commented Nov 18, 2025

Code Review: Delight App Shell Implementation

🎯 Executive Summary

This PR successfully implements the app shell with 6 main surfaces (Dashboard, Missions, Memory, Narrative, Progress, Lab) using Next.js 15, React 19, and TypeScript. The implementation demonstrates solid architecture and clean code patterns, but requires several critical fixes before merging.

Overall Assessment: ✅ APPROVE WITH REQUIRED CHANGES


🚨 Critical Issues (MUST FIX)

1. Missing Clerk Middleware ⚠️ BLOCKER

File: packages/frontend/middleware.ts (does not exist)

Issue: Authentication protection is not enabled. Per CLAUDE.md requirements, Clerk middleware is required for server-side auth.

Required fix:

// packages/frontend/middleware.ts
import { clerkMiddleware } from "@clerk/nextjs/server";

export default clerkMiddleware();

export const config = {
  matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
};

Impact: HIGH - All authenticated routes are currently unprotected.


2. Type Mismatch: Memory Field Naming

Files:

  • src/lib/types/index.ts (line 97)
  • Backend: app/models/memory.py

Issue: Frontend uses tier: MemoryTier but backend model uses memory_type: MemoryType. This will cause API integration failures.

Recommendation: Align on memory_type or create explicit mapping in API client:

// Future API client
function transformMemory(backendMemory: BackendMemory): Memory {
  return {
    ...backendMemory,
    tier: backendMemory.memory_type, // Map field
  };
}

3. Missing camelCase/snake_case Transformation Layer

Issue: Frontend uses camelCase (clerkUserId, createdAt, valueCategory) but backend uses snake_case (clerk_user_id, created_at, value_category). No transformation exists.

Recommendation: Create API client with automatic case conversion:

// lib/api/client.ts
import humps from 'humps'; // or write custom transformer

export async function apiRequest<T>(endpoint: string): Promise<T> {
  const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}${endpoint}`);
  const data = await res.json();
  return humps.camelizeKeys(data) as T; // Convert snake_case → camelCase
}

🔴 High Priority Issues

4. Missing API Client Layer

Issue: Components import mock data directly. No abstraction layer for API calls.

Current pattern (problematic):

import { mockMissions } from '@/lib/mock/data'; // Direct import

Recommended pattern:

// lib/api/missions.ts
export async function getMissions(): Promise<Mission[]> {
  // For now, return mocks - easy to swap later
  return mockMissions;
  
  // Future implementation:
  // return apiRequest<Mission[]>('/api/v1/missions');
}

// In component
const missions = await getMissions();

Action: Create lib/api/client.ts that returns mock data initially, making backend integration straightforward.


5. DCI Threshold Inconsistency

Location: src/lib/utils.ts:37-47

Issue: getDCIStatusColor() uses different thresholds than DCI_THRESHOLDS constant.

Constants say:

FRAGILE: 0.3, STEADY: 0.6, STRONG: 0.8, EXCELLENT: 0.9

Function uses:

if (score >= 0.8) // Should be 0.9 for EXCELLENT
else if (score >= 0.4) // Should be 0.3 for FRAGILE

Fix:

export function getDCIStatusColor(score: number): string {
  if (score >= DCI_THRESHOLDS.EXCELLENT) return "text-green-600";
  else if (score >= DCI_THRESHOLDS.STRONG) return "text-blue-600";
  else if (score >= DCI_THRESHOLDS.STEADY) return "text-yellow-600";
  else return "text-red-600";
}

6. Missing dynamic = "force-dynamic" on Authenticated Pages

Issue: Only 2 pages export dynamic = "force-dynamic" but all authenticated pages need this for Clerk to work properly with server components.

Required fix: Add to all pages in app/(app)/:

export const dynamic = "force-dynamic";

Affected files:

  • dashboard/page.tsx (already has it)
  • lab/page.tsx (already has it)
  • missions/page.tsx (missing)
  • memory/page.tsx (missing)
  • narrative/page.tsx (missing)
  • progress/page.tsx (missing)

7. Hard-coded Mock User ID Security Risk

Location: src/lib/mock/data.ts:33

const MOCK_USER_ID = 'user_mock_001';

Issue: Risk of accidentally exposing data cross-user when switching to real API.

Recommendation: Add prominent warning comment:

// ⚠️ SECURITY WARNING: This mock user ID is used for all test data.
// When connecting to real API, replace ALL references with actual user ID from Clerk.
// Search codebase for "MOCK_USER_ID" before deploying to production.
const MOCK_USER_ID = 'user_mock_001';

🟡 Medium Priority Issues

8. No Error Handling in Lab Page

Location: app/(app)/lab/page.tsx:210-223

Issue: Mock chat and memory search have no try-catch blocks, loading states, or error messages.

Example fix:

const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);

const handleSendMessage = async () => {
  if (!inputMessage.trim()) return;
  
  setIsLoading(true);
  setError(null);
  
  try {
    // Easy to replace with real API later
    const response = await mockChatAPI(inputMessage);
    setChatMessages(prev => [...prev, 
      { role: 'user', content: inputMessage },
      { role: 'assistant', content: response }
    ]);
  } catch (err) {
    setError('Failed to send message. Please try again.');
  } finally {
    setIsLoading(false);
    setInputMessage('');
  }
};

9. Accessibility Issues

Issue 1: Missing ARIA labels on close buttons

// memory/page.tsx:172
<button
  onClick={() => setSelectedMemory(null)}
  className="text-gray-400 hover:text-gray-600"
  aria-label="Close detail panel" // ← ADD THIS
>
  
</button>

Issue 2: Divs used for clickable cards instead of buttons

// memory/page.tsx:121 - NOT accessible via keyboard
<div onClick={() => setSelectedMemory(memory)} className="...cursor-pointer">

// Fix:
<button 
  onClick={() => setSelectedMemory(memory)} 
  className="...w-full text-left"
  aria-pressed={selectedMemory?.id === memory.id}
>

10. Missing Loading States

Issue: All components render static mock data with no loading indicators. This will cause flash of empty content when connected to API.

Recommendation: Add skeleton states:

export function MissionsList() {
  const [loading, setLoading] = useState(true);
  
  if (loading) {
    return <MissionsSkeleton />; // Or simple "Loading..."
  }
  
  return (/* existing JSX */);
}

🟢 Low Priority Issues (Can Defer)

11. Inconsistent Date Formatting

Multiple components format dates differently. Create centralized utility:

// lib/utils.ts
export function formatDate(date: Date | string, format: 'short' | 'long' = 'short'): string {
  const d = typeof date === 'string' ? new Date(date) : date;
  
  return d.toLocaleDateString('en-US', 
    format === 'long' 
      ? { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric' }
      : { month: 'short', day: 'numeric', year: 'numeric' }
  );
}

12. Magic Numbers in Chart Rendering

Location: components/app/DCIMiniChart.tsx:49

style={{ height: `${Math.max(height, 10)}%` }} // What is 10?

Fix:

const MIN_BAR_HEIGHT_PERCENT = 10;
style={{ height: `${Math.max(height, MIN_BAR_HEIGHT_PERCENT)}%` }}

✅ Strengths (Excellent Work!)

  1. Comprehensive TypeScript Types - Full type coverage in lib/types/index.ts
  2. Well-Structured Mock Data - Realistic test data covering edge cases
  3. Clean Component Architecture - Proper separation of concerns
  4. Modern React Patterns - Correct use of React 19 features
  5. Tailwind Best Practices - Consistent spacing, responsive design
  6. Good Documentation - Clear TODO comments for backend integration
  7. Realistic UI/UX - Professional design matching brand colors

📋 BMAD Compliance Checklist

✅ GOOD:

  • Clear story implementation (app shell surfaces)
  • Incremental development approach
  • Good inline documentation

⚠️ GAPS:

  • Missing tests for new pages (BMAD requires tests before merge)
  • No story summary documenting completion
  • Missing acceptance criteria checklist

Recommendation: Add basic Playwright E2E test:

// tests/e2e/navigation.spec.ts
test('user can navigate between all app surfaces', async ({ page }) => {
  await page.goto('/dashboard');
  
  await page.click('text=Missions');
  await expect(page).toHaveURL('/missions');
  
  await page.click('text=Memory');
  await expect(page).toHaveURL('/memory');
  
  // Test all 6 surfaces
});

🎯 Action Items Before Merge

Required (BLOCKER)

  • Add middleware.ts with Clerk authentication
  • Add export const dynamic = "force-dynamic" to missions, memory, narrative, progress pages
  • Fix DCI threshold inconsistency in utils.ts
  • Add security warning comment to MOCK_USER_ID

Strongly Recommended

  • Create API client abstraction layer (lib/api/client.ts)
  • Add basic error handling to Lab page
  • Fix accessibility issues (ARIA labels, button elements)
  • Add basic E2E navigation test

Can Defer to Follow-up PR

  • Case transformation utility
  • Loading skeleton states
  • Date formatting utility
  • Extract magic numbers

📊 Summary

Stats:

  • Files changed: 28
  • Lines added: ~20,574
  • Critical issues: 6
  • High priority issues: 2
  • Medium priority issues: 4

Verdict: This is excellent foundation work with clean architecture and comprehensive implementation. The critical issues are straightforward to fix (~2-3 hours). Once addressed, this will be production-ready for the mock data phase.

Estimated time to address required changes: 2-3 hours

Great work on building a solid app shell! 🚀

@thejackluo thejackluo force-pushed the claude/delight-app-shell-01N3hZUa4f8ERhoTFK2ojNZL branch from de47583 to 136507f Compare November 18, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants