Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
interface AvatarProps {
initials: string
color: string
size?: number
hasIndicator?: boolean
}

export const Avatar = ({ initials, color, size = 24, hasIndicator = false }: AvatarProps) => (
<div className="relative inline-flex">
<div
className="rounded-full flex items-center justify-center text-white font-medium"
style={{ backgroundColor: color, width: size, height: size, fontSize: size * 0.4 }}
>
{initials}
</div>
{hasIndicator && (
<span className="absolute -bottom-0.5 -right-0.5 w-2 h-2 bg-green-500 rounded-full border border-white"></span>
)}
</div>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { VeltInlineCommentsSection } from '@veltdev/react'
import { ChevronLeftIcon } from './icons'
import { Job } from './types'

interface CommentsSidebarProps {
isOpen: boolean
onClose: () => void
selectedJob: Job | null
}

export const CommentsSidebar = ({ isOpen, onClose, selectedJob }: CommentsSidebarProps) => {
if (!isOpen || !selectedJob) return null

return (
<div className="w-[400px] h-full flex flex-col bg-white border-l border-gray-200">
{/* Header */}
<div className="h-[56px] px-4 flex items-center justify-between border-b border-gray-200">
<div className="flex items-center gap-3">
<button onClick={onClose} className="p-1 hover:bg-gray-100 rounded">
<ChevronLeftIcon />
</button>
<div className="flex items-center gap-2">
<span className="text-lg font-semibold text-gray-900">Comments</span>
<span className="text-sm text-gray-500">({selectedJob.id})</span>
</div>
</div>
</div>

{/* VeltInlineCommentsSection for per-row thread */}
<div className="flex-1 overflow-y-auto" data-id={`job-${selectedJob.id}`}>
<VeltInlineCommentsSection
multiThread={false}
targetElementId={`job-${selectedJob.id}`}
shadowDom={false}
/>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
interface DueBadgeProps {
due: string
type?: string
}

export const DueBadge = ({ due, type }: DueBadgeProps) => {
const getStyles = () => {
switch (type) {
case 'overdue':
return 'bg-red-100 text-red-700'
case 'today':
return 'bg-green-100 text-green-700'
case 'warning':
return 'bg-yellow-100 text-yellow-700'
case 'paid':
return 'text-gray-400'
default:
return 'text-gray-600'
}
}

if (type === 'overdue' || type === 'today' || type === 'warning') {
return (
<span className={`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${getStyles()}`}>
{due}
</span>
)
}

return <span className={`text-sm ${getStyles()}`}>{due}</span>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { VeltCommentBubble } from '@veltdev/react'
import { ChevronDownIcon, GearIcon } from './icons'
import { Avatar } from './Avatar'
import { StatusBadge } from './StatusBadge'
import { DueBadge } from './DueBadge'
import { Job } from './types'

interface JobsTableProps {
jobs: Job[]
onJobClick: (job: Job) => void
onRowClick: (job: Job) => void
}

export const JobsTable = ({ jobs, onJobClick, onRowClick }: JobsTableProps) => {
return (
<div className="flex-1 overflow-auto px-8">
<table className="w-full min-w-[1200px]">
<thead className="sticky top-0 bg-white z-10">
<tr className="border-b border-gray-200">
<th className="w-12 py-2 px-3 text-left">
<input type="checkbox" className="w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500" />
</th>
<th className="py-2 px-3 text-left text-xs font-medium text-gray-500">
<div className="flex items-center gap-1">
Job <ChevronDownIcon />
</div>
</th>
<th className="py-2 px-3 text-left text-xs font-medium text-gray-500">Cost</th>
<th className="w-20 py-2 px-3 text-left text-xs font-medium text-gray-500">Comments</th>
<th className="py-2 px-3 text-left text-xs font-medium text-gray-500">Ownership</th>
<th className="py-2 px-3 text-left text-xs font-medium text-gray-500">Due</th>
<th className="py-2 px-3 text-left text-xs font-medium text-gray-500">Current approver</th>
<th className="py-2 px-3 text-left text-xs font-medium text-gray-500">Approval policy</th>
<th className="py-2 px-3 text-left text-xs font-medium text-gray-500">Status</th>
<th className="w-10 py-2 px-3">
<GearIcon />
</th>
</tr>
</thead>
<tbody className="divide-y divide-gray-100">
{jobs.map((job) => (
<tr
key={job.id}
className="hover:bg-gray-50 cursor-pointer"
id={`job-${job.id}`}
data-id={`job-${job.id}`}
onClick={() => onRowClick(job)}
>
<td className="py-3 px-3">
<input
type="checkbox"
className="w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"
onClick={(e) => e.stopPropagation()}
/>
</td>
<td className="py-3 px-3">
<span
className="text-sm font-medium text-blue-600 hover:text-blue-800 cursor-pointer"
onClick={(e) => {
e.stopPropagation()
onJobClick(job)
}}
>
{job.id}
</span>
</td>
<td className="py-3 px-3">
<span className="text-sm text-gray-900">{job.cost}</span>
</td>
<td className="py-3 px-3">
<div
className="flex items-center justify-center min-w-[64px] relative overflow-visible"
onClick={(e) => e.stopPropagation()}
>
<VeltCommentBubble
targetElementId={`job-${job.id}`}
shadowDom={false}
/>
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Missing VeltCommentTool removes comment creation functionality

During the refactoring from document-canvas.tsx to JobsTable.tsx, the VeltCommentTool component was removed from the Comments column. The original code rendered both VeltCommentTool (for creating new comments) and VeltCommentBubble (for displaying existing comments) in each table row. The new implementation only renders VeltCommentBubble, which means users can no longer initiate new comments directly from the jobs table. Other components like JobDetailModal still use both components together, confirming this was likely an accidental omission.

Fix in Cursor Fix in Web

</td>
<td className="py-3 px-3">
<div className="flex items-center gap-2">
<Avatar initials={job.ownership.initials} color={job.ownership.color} />
<span className="text-sm text-gray-700 truncate max-w-[120px]">{job.ownership.name}</span>
</div>
</td>
<td className="py-3 px-3">
<DueBadge due={job.due} type={job.dueType} />
</td>
<td className="py-3 px-3">
{job.approver ? (
<div className="flex items-center gap-2">
<Avatar
initials={job.approver.initials}
color={job.approver.color}
hasIndicator={job.approver.hasIndicator}
/>
{job.approverTime && <span className="text-xs text-gray-500">{job.approverTime}</span>}
</div>
) : (
<span className="text-sm text-gray-400">...</span>
)}
</td>
<td className="py-3 px-3">
<span className="text-sm text-gray-700 truncate block max-w-[140px]">{job.policy}</span>
</td>
<td className="py-3 px-3">
<StatusBadge status={job.status} type={job.statusType} />
</td>
<td className="py-3 px-3"></td>
</tr>
))}
</tbody>
</table>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
ChevronDownIcon,
ArrowLeftIcon,
ArrowRightIcon,
DoubleArrowLeftIcon,
DoubleArrowRightIcon
} from './icons'

export const Pagination = () => {
return (
<div className="flex items-center justify-between px-8 py-3 border-t border-gray-200 bg-white">
<span className="text-sm text-gray-500">Showing 1-12 of 91 results (page 1 of 8)</span>
<div className="flex items-center gap-4">
<div className="flex items-center gap-1">
<button className="p-1 hover:bg-gray-100 rounded disabled:opacity-50" disabled>
<DoubleArrowLeftIcon />
</button>
<button className="p-1 hover:bg-gray-100 rounded disabled:opacity-50" disabled>
<ArrowLeftIcon />
</button>
<button className="p-1 hover:bg-gray-100 rounded">
<ArrowRightIcon />
</button>
<button className="p-1 hover:bg-gray-100 rounded">
<DoubleArrowRightIcon />
</button>
</div>
<div className="flex items-center gap-2">
<span className="text-sm text-gray-500">12 rows</span>
<ChevronDownIcon />
</div>
<div className="flex items-center gap-2">
<span className="text-sm text-gray-500">Go to page:</span>
<input
type="text"
className="w-12 px-2 py-1 text-sm border border-gray-200 rounded focus:outline-none focus:ring-1 focus:ring-blue-500"
placeholder="1"
/>
</div>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { ClockIcon, EyeIcon } from './icons'

interface StatusBadgeProps {
status: string
type: string
}

export const StatusBadge = ({ status, type }: StatusBadgeProps) => {
const getStatusStyles = () => {
switch (type) {
case 'review':
return 'bg-violet-100 text-violet-700 border-violet-200'
case 'pending':
return 'bg-gray-100 text-gray-600 border-gray-200'
case 'conflict':
return 'bg-red-50 text-red-600 border-red-200'
case 'dispute':
return 'bg-red-50 text-red-600 border-red-200'
case 'submit':
return 'bg-green-50 text-green-700 border-green-200'
default:
return 'bg-gray-50 text-gray-600 border-gray-200'
}
}

const getIcon = () => {
switch (type) {
case 'review':
return <span className="w-2 h-2 rounded-full bg-violet-500 mr-1.5"></span>
case 'pending':
return <span className="mr-1"><ClockIcon /></span>
case 'conflict':
return <span className="w-2 h-2 rounded-full bg-red-500 mr-1.5"></span>
case 'dispute':
return <span className="w-2 h-2 rounded-full bg-red-500 mr-1.5"></span>
case 'submit':
return <span className="w-2 h-2 rounded-full bg-green-500 mr-1.5"></span>
default:
return <span className="mr-1"><EyeIcon /></span>
}
}

return (
<span className={`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium border ${getStatusStyles()}`}>
{getIcon()}
{status}
</span>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { CheckCircleIcon, WarningIcon, DisputeIcon } from './icons'

export const SummaryCards = () => {
return (
<div className="flex gap-4 px-8 pb-4">
{/* Review & approve card */}
<div className="flex-1 flex items-center gap-3 px-4 py-3 bg-violet-50 rounded-lg border border-violet-100">
<div className="flex items-center justify-center w-10 h-10 bg-violet-100 rounded-lg">
<CheckCircleIcon />
</div>
<span className="flex-1 text-sm font-medium text-violet-900">Review & approve</span>
<span className="text-2xl font-semibold text-violet-700">2</span>
</div>

{/* Conflict card */}
<div className="flex-1 flex items-center gap-3 px-4 py-3 bg-amber-50 rounded-lg border border-amber-100">
<div className="flex items-center justify-center w-10 h-10 bg-amber-100 rounded-lg">
<WarningIcon />
</div>
<span className="flex-1 text-sm font-medium text-amber-900">Conflict</span>
<span className="text-2xl font-semibold text-amber-700">2</span>
</div>

{/* Dispute card */}
<div className="flex-1 flex items-center gap-3 px-4 py-3 bg-red-50 rounded-lg border border-red-100">
<div className="flex items-center justify-center w-10 h-10 bg-red-100 rounded-lg">
<DisputeIcon />
</div>
<span className="flex-1 text-sm font-medium text-red-900">Dispute</span>
<span className="text-2xl font-semibold text-red-700">6</span>
</div>
</div>
)
}
Loading
Loading