# Using tsx (recommended)
npx tsx scripts/run-milestone-review-migration.ts
# Or using the standard migrate script
npm run migrateThis will create:
milestone_submission_historytable for tracking all submission events- Extended
milestonestable with review-related columns - Necessary indexes for optimal performance
The feature is now ready to use! No additional configuration needed.
- ✅ Display submitted files/links - All deliverables shown with proper formatting
- ✅ Milestone description - Full context and objectives displayed
- ✅ Submission timestamp - Records when deliverable was submitted
- ✅ Approve milestone button - Client can confirm completion
- ✅ Request changes button - Client can provide feedback for revisions
- ✅ Submission history - Complete log of all submissions and responses
- ✅ Confirmation before approval - Alert dialog confirms action
- ✅ Proper loading/error states - Graceful handling with spinners and messages
- ✅ Different UI based on role - Clients review, freelancers view status
- ✅ Submission history accessible - Expandable timeline for both roles
- ✅ Responsive design - Works perfectly on desktop, tablet, and mobile
- Review Submissions - View all deliverables and submission notes
- Approve Milestones - One-click approval with confirmation
- Request Revisions - Provide detailed feedback for changes
- Reject Work - Formal rejection with required reasoning
- Track History - See all past submissions and decisions
- View Status - See current milestone state
- Read Feedback - Understand what clients need revised
- Submission History - Review all past submissions
- Revision Alerts - Clear notifications when changes requested
lib/db/migrations/008_milestone_submission_history.sql- Database schema
app/api/milestones/[id]/route.ts- GET milestone (updated)app/api/milestones/[id]/approve/route.ts- Approve/reject (updated)app/api/milestones/[id]/submit/route.ts- Submit milestone (updated)app/api/milestones/[id]/request-changes/route.ts- Request revisions (new)app/api/milestones/[id]/history/route.ts- Get submission history (new)
components/dashboard/milestone-review.tsx- Main review interfacecomponents/ui/collapsible.tsx- Collapsible UI componentcomponents/ui/separator.tsx- Visual separator componentcomponents/ui/scroll-area.tsx- Scrollable area component
app/dashboard/milestones/[id]/page.tsx- Milestone review page
docs/milestone-review-interface.md- Complete technical documentationMILESTONE_REVIEW_SETUP.md- This setup guide
scripts/run-milestone-review-migration.ts- Migration runner
- Navigate to a contract with milestones
- Click the arrow (→) next to any milestone
- You'll be taken to the milestone review page
/dashboard/milestones/[milestone-id]
┌─────────────────────────────────────────────┐
│ Milestone Title [Status] │
│ Description... │
├─────────────────────────────────────────────┤
│ Amount: $X,XXX | Due: Date | Submitted │
├─────────────────────────────────────────────┤
│ 📝 Submission Notes │
│ "Notes from freelancer..." │
├─────────────────────────────────────────────┤
│ 📄 Deliverables (3) │
│ • file1.pdf │
│ • https://link-to-work.com │
│ • file2.docx │
├─────────────────────────────────────────────┤
│ ⏱️ Submission History ▼ │
│ [Expandable timeline...] │
├─────────────────────────────────────────────┤
│ [✓ Approve] [💬 Request Changes] [✗ Reject]│
└─────────────────────────────────────────────┘
┌─────────────────────────────────────────────┐
│ Milestone Title [Status] │
├─────────────────────────────────────────────┤
│ ⚠️ Revisions Requested │
│ The client has requested changes. │
│ Please review the feedback and resubmit. │
├─────────────────────────────────────────────┤
│ ⏱️ Submission History ▼ │
│ [View feedback and revision notes] │
└─────────────────────────────────────────────┘
const response = await fetch(`/api/milestones/${milestoneId}`)
const { milestone } = await response.json()await fetch(`/api/milestones/${milestoneId}/approve`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'approve' })
})await fetch(`/api/milestones/${milestoneId}/request-changes`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
revision_notes: 'Please update the color scheme to match brand guidelines'
})
})const response = await fetch(`/api/milestones/${milestoneId}/history`)
const { history } = await response.json()- All endpoints require wallet-based authentication
- JWT tokens validated on every request
- Clients can: approve, reject, request changes
- Freelancers can: submit, view status
- Both can: view milestone details and history
- Access verified by contract relationship
- All inputs validated server-side
- SQL injection prevention via parameterized queries
- XSS protection via React's built-in escaping
- Mobile: < 640px - Single column, stacked buttons
- Tablet: 640px - 1024px - Adaptive grid, 2 columns
- Desktop: > 1024px - Full layout, 3 columns
As Client:
- View submitted milestone
- Expand submission history
- Approve a milestone
- Request changes with feedback
- Reject a milestone with reason
- Verify notifications sent
- Test on mobile device
As Freelancer:
- View milestone status
- See submission history
- View revision request feedback
- See revision counter
- Test on mobile device
- Pending milestone (no actions available)
- In-progress milestone
- Submitted milestone (full review UI for client)
- Approved milestone (read-only)
- Rejected milestone (read-only)
# Check database connection
echo $DATABASE_URL
# Verify migration file exists
ls lib/db/migrations/008_milestone_submission_history.sql
# Run with verbose logging
npx tsx scripts/run-milestone-review-migration.ts- Verify user is authenticated
- Check user is part of the contract (client or freelancer)
- Confirm milestone belongs to an active contract
- Check browser console for errors
- Verify API endpoint is accessible
- Confirm milestone has submission history entries
- Clear browser cache
- Check for CSS conflicts
- Verify Tailwind classes are loading
For complete technical details, see:
- docs/milestone-review-interface.md - Full documentation
For component usage:
- Check
components/dashboard/milestone-review.tsxfor props and examples
For API details:
- See individual route files in
app/api/milestones/[id]/
Consider these additions:
- File upload widget for direct deliverable uploads
- Inline commenting on specific deliverables
- Version comparison across submissions
- Email notifications for milestone events
- Batch approval for multiple milestones
- Export submission history as PDF
- Pre-written revision request templates
The Milestone Review Interface is production-ready and provides:
- Transparency - Complete visibility into submission history
- Accountability - Audit trail of all actions
- Collaboration - Clear communication between parties
- User Experience - Intuitive, responsive, accessible
- Security - Proper authentication and authorization
- Performance - Optimized queries with proper indexing
Status: ✅ Ready to deploy and use!