From 24ed3311bcbbc807983b4758d7b95749b6a173cd Mon Sep 17 00:00:00 2001 From: yoen-velt Date: Tue, 16 Dec 2025 15:51:02 -0500 Subject: [PATCH 1/2] Open Envoy Fixes --- .../components/document/document-canvas.tsx | 8 ++-- .../components/sidebar/sidebar.tsx | 44 ++++++++----------- .../components/velt/VeltCollaboration.tsx | 2 +- .../components/velt/VeltTools.tsx | 11 ----- .../VeltNotificationsToolWf.tsx | 13 ++++++ .../velt/ui-customization/index.tsx | 3 ++ 6 files changed, 40 insertions(+), 41 deletions(-) create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/VeltNotificationsToolWf.tsx diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/document-canvas.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/document-canvas.tsx index 9a23b828..ba483867 100644 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/document-canvas.tsx +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/document-canvas.tsx @@ -3,7 +3,7 @@ import { useState } from 'react' import Header from '@/components/header/header' import Sidebar from '@/components/sidebar/sidebar' -import { VeltCommentBubble, VeltCommentTool, VeltInlineCommentsSection } from '@veltdev/react' +import { VeltCommentBubble, VeltInlineCommentsSection } from '@veltdev/react' import JobDetailModal from './JobDetailModal' // Types @@ -486,8 +486,10 @@ export default function DocumentCanvas() { className="flex items-center justify-center min-w-[64px] relative overflow-visible" onClick={(e) => e.stopPropagation()} > - - + diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/sidebar/sidebar.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/sidebar/sidebar.tsx index 96ef3b49..50aab537 100644 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/sidebar/sidebar.tsx +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/sidebar/sidebar.tsx @@ -1,7 +1,6 @@ 'use client'; -import { useState } from 'react'; -import { VeltNotificationsPanel } from '@veltdev/react'; +import { VeltNotificationsTool, useNotificationUtils } from '@veltdev/react'; // Sidebar icon assets const imgOpenEnvoyWordmarkSmallUsePositive1 = "/icons/sidebar/open-envoy-logo.svg"; @@ -82,10 +81,10 @@ function SectionHeader({ label }: SectionHeaderProps) { } export default function Sidebar() { - const [isNotificationsPanelOpen, setIsNotificationsPanelOpen] = useState(false); + const notificationUtils = useNotificationUtils(); - const toggleNotificationsPanel = () => { - setIsNotificationsPanelOpen(!isNotificationsPanelOpen); + const handleNotificationsClick = () => { + notificationUtils?.openNotificationsPanel(); }; return ( @@ -130,13 +129,20 @@ export default function Sidebar() { icon={imgSearch} label="Search" /> - + {/* Notifications - entire row clickable */} + - - {/* Velt Notifications Panel - Embedded beside sidebar */} - {isNotificationsPanelOpen && ( -
- -
- )} ); } diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltCollaboration.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltCollaboration.tsx index 94ecf5e8..fe902200 100644 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltCollaboration.tsx +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltCollaboration.tsx @@ -35,7 +35,7 @@ export function VeltCollaboration() { groupMatchedComments={true} priority={true} /> - + ); } diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltTools.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltTools.tsx index f3968964..e010f5dc 100644 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltTools.tsx +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/VeltTools.tsx @@ -2,7 +2,6 @@ import { VeltPresence, VeltSidebarButton, - VeltNotificationsTool, } from "@veltdev/react"; function VeltTools() { @@ -12,16 +11,6 @@ function VeltTools() { {/* [Velt] Toggle comments sidebar */} - {/* [Velt] Notifications panel */} - ); } diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/VeltNotificationsToolWf.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/VeltNotificationsToolWf.tsx new file mode 100644 index 00000000..da10a70c --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/VeltNotificationsToolWf.tsx @@ -0,0 +1,13 @@ +import { VeltNotificationsToolWireframe } from '@veltdev/react'; + +const VeltNotificationsToolWf = () => { + return ( + +
+ +
+
+ ); +}; + +export default VeltNotificationsToolWf; diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/index.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/index.tsx index 71ff5ac6..c3588c27 100644 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/index.tsx +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/velt/ui-customization/index.tsx @@ -2,12 +2,15 @@ import { VeltWireframe } from '@veltdev/react'; import VeltSidebarButtonWf from './VeltSidebarButtonWf'; import VeltCommentToolWf from './VeltCommentToolWf'; import VeltCommentBubbleWf from './VeltCommentBubbleWf'; +import VeltNotificationsToolWf from './VeltNotificationsToolWf'; + const VeltCustomization = () => { return ( + ); }; From 7f7b05ee8dc9bbf824104a4ffe6def7ef3b294a6 Mon Sep 17 00:00:00 2001 From: yoen-velt Date: Tue, 16 Dec 2025 15:56:50 -0500 Subject: [PATCH 2/2] Refactored documentcanvas.tsx --- .../components/document/Avatar.tsx | 20 + .../components/document/CommentsSidebar.tsx | 39 ++ .../components/document/DueBadge.tsx | 31 ++ .../components/document/JobsTable.tsx | 117 ++++ .../components/document/Pagination.tsx | 43 ++ .../components/document/StatusBadge.tsx | 49 ++ .../components/document/SummaryCards.tsx | 34 ++ .../components/document/document-canvas.tsx | 498 +----------------- .../components/document/icons.tsx | 107 ++++ .../components/document/jobs-data.ts | 252 +++++++++ .../components/document/types.ts | 22 + .../components/sidebar/sidebar.tsx | 41 +- 12 files changed, 758 insertions(+), 495 deletions(-) create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Avatar.tsx create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/CommentsSidebar.tsx create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/DueBadge.tsx create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/JobsTable.tsx create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Pagination.tsx create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/StatusBadge.tsx create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/SummaryCards.tsx create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/icons.tsx create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/jobs-data.ts create mode 100644 apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/types.ts diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Avatar.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Avatar.tsx new file mode 100644 index 00000000..0ea88165 --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Avatar.tsx @@ -0,0 +1,20 @@ +interface AvatarProps { + initials: string + color: string + size?: number + hasIndicator?: boolean +} + +export const Avatar = ({ initials, color, size = 24, hasIndicator = false }: AvatarProps) => ( +
+
+ {initials} +
+ {hasIndicator && ( + + )} +
+) diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/CommentsSidebar.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/CommentsSidebar.tsx new file mode 100644 index 00000000..05533736 --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/CommentsSidebar.tsx @@ -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 ( +
+ {/* Header */} +
+
+ +
+ Comments + ({selectedJob.id}) +
+
+
+ + {/* VeltInlineCommentsSection for per-row thread */} +
+ +
+
+ ) +} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/DueBadge.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/DueBadge.tsx new file mode 100644 index 00000000..cc8ecf9f --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/DueBadge.tsx @@ -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 ( + + {due} + + ) + } + + return {due} +} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/JobsTable.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/JobsTable.tsx new file mode 100644 index 00000000..ef3d581e --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/JobsTable.tsx @@ -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 ( +
+ + + + + + + + + + + + + + + + + {jobs.map((job) => ( + onRowClick(job)} + > + + + + + + + + + + + + ))} + +
+ + +
+ Job +
+
CostCommentsOwnershipDueCurrent approverApproval policyStatus + +
+ e.stopPropagation()} + /> + + { + e.stopPropagation() + onJobClick(job) + }} + > + {job.id} + + + {job.cost} + +
e.stopPropagation()} + > + +
+
+
+ + {job.ownership.name} +
+
+ + + {job.approver ? ( +
+ + {job.approverTime && {job.approverTime}} +
+ ) : ( + ... + )} +
+ {job.policy} + + +
+
+ ) +} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Pagination.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Pagination.tsx new file mode 100644 index 00000000..b8555daf --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/Pagination.tsx @@ -0,0 +1,43 @@ +import { + ChevronDownIcon, + ArrowLeftIcon, + ArrowRightIcon, + DoubleArrowLeftIcon, + DoubleArrowRightIcon +} from './icons' + +export const Pagination = () => { + return ( +
+ Showing 1-12 of 91 results (page 1 of 8) +
+
+ + + + +
+
+ 12 rows + +
+
+ Go to page: + +
+
+
+ ) +} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/StatusBadge.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/StatusBadge.tsx new file mode 100644 index 00000000..967e3373 --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/StatusBadge.tsx @@ -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 + case 'pending': + return + case 'conflict': + return + case 'dispute': + return + case 'submit': + return + default: + return + } + } + + return ( + + {getIcon()} + {status} + + ) +} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/SummaryCards.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/SummaryCards.tsx new file mode 100644 index 00000000..73f14559 --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/SummaryCards.tsx @@ -0,0 +1,34 @@ +import { CheckCircleIcon, WarningIcon, DisputeIcon } from './icons' + +export const SummaryCards = () => { + return ( +
+ {/* Review & approve card */} +
+
+ +
+ Review & approve + 2 +
+ + {/* Conflict card */} +
+
+ +
+ Conflict + 2 +
+ + {/* Dispute card */} +
+
+ +
+ Dispute + 6 +
+
+ ) +} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/document-canvas.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/document-canvas.tsx index ba483867..68615830 100644 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/document-canvas.tsx +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/document-canvas.tsx @@ -3,338 +3,17 @@ import { useState } from 'react' import Header from '@/components/header/header' import Sidebar from '@/components/sidebar/sidebar' -import { VeltCommentBubble, VeltInlineCommentsSection } from '@veltdev/react' import JobDetailModal from './JobDetailModal' +import { Job } from './types' +import { jobsData } from './jobs-data' +import { FileIcon, ChevronDownIcon, PlusIcon, FilterIcon, SearchIcon, SettingsIcon } from './icons' +import { SummaryCards } from './SummaryCards' +import { JobsTable } from './JobsTable' +import { Pagination } from './Pagination' +import { CommentsSidebar } from './CommentsSidebar' -// Types -export interface JobLineItem { - id: string - description: string - quantity: number - unitPrice: number - total: number -} - -export interface Job { - id: string - cost: string - comments: number - ownership: { color: string; initials: string; name: string } - due: string - dueType?: string - approver: { initials: string; color: string; hasIndicator?: boolean } | null - approverTime?: string - policy: string - status: string - statusType: string - lineItems: JobLineItem[] -} - -// Sample data for the table with line items -const jobsData: Job[] = [ - { id: 'OE0001', cost: '', comments: 0, ownership: { color: '#10B981', initials: 'E', name: 'Ocean Freight - ...' }, due: '...', approver: null, policy: 'AP Eur Matched Appr...', status: 'Matching', statusType: 'default', lineItems: [ - { id: 'li-1', description: 'Container shipping fee', quantity: 1, unitPrice: 1200, total: 1200 }, - { id: 'li-2', description: 'Port handling charges', quantity: 2, unitPrice: 150, total: 300 }, - ]}, - { id: 'OE0002', cost: '$2,875.93', comments: 32, ownership: { color: '#EC4899', initials: 'R', name: 'Commercial' }, due: '-2 days', dueType: 'overdue', approver: { initials: 'LW', color: '#6366F1' }, approverTime: '<1d', policy: 'AP US Matched Appr...', status: 'Review & approve', statusType: 'review', lineItems: [ - { id: 'li-1', description: 'Marketing materials', quantity: 500, unitPrice: 2.5, total: 1250 }, - { id: 'li-2', description: 'Printing services', quantity: 1, unitPrice: 875.93, total: 875.93 }, - { id: 'li-3', description: 'Design consultation', quantity: 3, unitPrice: 250, total: 750 }, - ]}, - { id: 'OE0003', cost: '$1,729.18', comments: 2, ownership: { color: '#8B5CF6', initials: 'WW', name: 'General AP' }, due: '...', approver: null, policy: 'AP Eur Matched Appr...', status: 'Pending', statusType: 'pending', lineItems: [ - { id: 'li-1', description: 'Office supplies', quantity: 10, unitPrice: 89.50, total: 895 }, - { id: 'li-2', description: 'Equipment maintenance', quantity: 1, unitPrice: 834.18, total: 834.18 }, - ]}, - { id: 'OE0004', cost: '$2,432.82', comments: 0, ownership: { color: '#F59E0B', initials: 'RS', name: 'Packaged Goods' }, due: '-10 days', dueType: 'overdue', approver: { initials: 'LW', color: '#6366F1' }, approverTime: '<1d', policy: 'AP Eur Matched Appr...', status: 'Review & approve', statusType: 'review', lineItems: [ - { id: 'li-1', description: 'Packaging materials', quantity: 1000, unitPrice: 1.25, total: 1250 }, - { id: 'li-2', description: 'Label printing', quantity: 5000, unitPrice: 0.15, total: 750 }, - { id: 'li-3', description: 'Shipping boxes', quantity: 100, unitPrice: 4.33, total: 432.82 }, - ]}, - { id: 'OE0005', cost: '$16,431.76', comments: 0, ownership: { color: '#8B5CF6', initials: 'MJ', name: 'Ocean Freight - ...' }, due: 'Today', dueType: 'today', approver: { initials: 'LW', color: '#6366F1' }, approverTime: '3d', policy: 'Metals & Timber', status: 'Review & approve', statusType: 'review', lineItems: [ - { id: 'li-1', description: 'Steel beams shipment', quantity: 50, unitPrice: 250, total: 12500 }, - { id: 'li-2', description: 'Insurance premium', quantity: 1, unitPrice: 2431.76, total: 2431.76 }, - { id: 'li-3', description: 'Customs clearance', quantity: 1, unitPrice: 1500, total: 1500 }, - ]}, - { id: 'OE0006', cost: '$115,472.51', comments: 5, ownership: { color: '#10B981', initials: 'SC', name: '3rd Party Suppli...' }, due: '12 days', dueType: 'warning', approver: { initials: 'LW', color: '#6366F1' }, policy: 'Vegetable protein ap...', status: 'Conflict', statusType: 'conflict', lineItems: [ - { id: 'li-1', description: 'Bulk protein powder', quantity: 10000, unitPrice: 8.50, total: 85000 }, - { id: 'li-2', description: 'Quality testing', quantity: 1, unitPrice: 5472.51, total: 5472.51 }, - { id: 'li-3', description: 'Expedited shipping', quantity: 1, unitPrice: 25000, total: 25000 }, - ]}, - { id: 'OE0007', cost: '$5,820.91', comments: 0, ownership: { color: '#3B82F6', initials: 'JK', name: 'Commercial' }, due: '47 days', approver: { initials: 'LW', color: '#6366F1' }, policy: 'Vegetable protein ap...', status: 'Conflict', statusType: 'conflict', lineItems: [ - { id: 'li-1', description: 'Trade show booth rental', quantity: 1, unitPrice: 3500, total: 3500 }, - { id: 'li-2', description: 'Display materials', quantity: 1, unitPrice: 2320.91, total: 2320.91 }, - ]}, - { id: 'OE0008', cost: '$3,711.83', comments: 0, ownership: { color: '#6366F1', initials: 'EL', name: 'General AP' }, due: '8 days', dueType: 'warning', approver: { initials: 'AK', color: '#F59E0B' }, approverTime: '1d', policy: 'Metals & Timber', status: 'Submit for approval', statusType: 'submit', lineItems: [ - { id: 'li-1', description: 'Timber processing fee', quantity: 1, unitPrice: 2500, total: 2500 }, - { id: 'li-2', description: 'Quality inspection', quantity: 1, unitPrice: 711.83, total: 711.83 }, - { id: 'li-3', description: 'Documentation fee', quantity: 1, unitPrice: 500, total: 500 }, - ]}, - { id: 'OE0009', cost: '$8,348.07', comments: 0, ownership: { color: '#3B82F6', initials: 'JK', name: 'N. American Over...' }, due: 'Paid', dueType: 'paid', approver: { initials: 'LW', color: '#6366F1' }, policy: 'AP Eur Matched Appr...', status: 'Dispute', statusType: 'dispute', lineItems: [ - { id: 'li-1', description: 'Ground transportation', quantity: 15, unitPrice: 450, total: 6750 }, - { id: 'li-2', description: 'Fuel surcharge', quantity: 1, unitPrice: 1598.07, total: 1598.07 }, - ]}, - { id: 'OE0010', cost: '$11,096.22', comments: 3, ownership: { color: '#8B5CF6', initials: 'WW', name: 'Trucking' }, due: '11 days', approver: { initials: 'LW', color: '#6366F1' }, policy: 'AP Mex Matched App...', status: 'Verifying', statusType: 'default', lineItems: [ - { id: 'li-1', description: 'Long haul trucking', quantity: 3, unitPrice: 3200, total: 9600 }, - { id: 'li-2', description: 'Loading/unloading', quantity: 6, unitPrice: 249.37, total: 1496.22 }, - ]}, - { id: 'OE0011', cost: '$85,682.06', comments: 0, ownership: { color: '#3B82F6', initials: 'JK', name: 'Journal entries' }, due: 'Paid', dueType: 'paid', approver: { initials: 'LW', color: '#F59E0B', hasIndicator: true }, approverTime: '6d', policy: 'AP Mex Matched App...', status: 'Approvals', statusType: 'default', lineItems: [ - { id: 'li-1', description: 'Q4 inventory adjustment', quantity: 1, unitPrice: 45000, total: 45000 }, - { id: 'li-2', description: 'Depreciation entries', quantity: 1, unitPrice: 25682.06, total: 25682.06 }, - { id: 'li-3', description: 'Accrual reversal', quantity: 1, unitPrice: 15000, total: 15000 }, - ]}, - { id: 'OE0012', cost: '$7,026.34', comments: 0, ownership: { color: '#10B981', initials: 'GB', name: 'Commercial' }, due: '32 days', approver: { initials: 'MN', color: '#EC4899' }, approverTime: '8d', policy: 'Metals & Timber', status: 'Approvals', statusType: 'default', lineItems: [ - { id: 'li-1', description: 'Client entertainment', quantity: 1, unitPrice: 3500, total: 3500 }, - { id: 'li-2', description: 'Travel expenses', quantity: 1, unitPrice: 2526.34, total: 2526.34 }, - { id: 'li-3', description: 'Conference registration', quantity: 2, unitPrice: 500, total: 1000 }, - ]}, - { id: 'OE0013', cost: '$7,026.34', comments: 27, ownership: { color: '#10B981', initials: 'GB', name: 'Commercial' }, due: '32 days', approver: { initials: 'EA', color: '#6366F1' }, approverTime: '2d', policy: 'Metals & Timber', status: 'Review & approve', statusType: 'review', lineItems: [ - { id: 'li-1', description: 'Advertising spend', quantity: 1, unitPrice: 5000, total: 5000 }, - { id: 'li-2', description: 'Media placement', quantity: 1, unitPrice: 2026.34, total: 2026.34 }, - ]}, - { id: 'OE0014', cost: '$7,026.34', comments: 9, ownership: { color: '#10B981', initials: 'GB', name: 'Commercial' }, due: '32 days', approver: { initials: 'TM', color: '#F59E0B' }, approverTime: '11d', policy: 'AP Eur Matched Appr...', status: 'Approvals', statusType: 'default', lineItems: [ - { id: 'li-1', description: 'Consulting services', quantity: 20, unitPrice: 275, total: 5500 }, - { id: 'li-2', description: 'Project expenses', quantity: 1, unitPrice: 1526.34, total: 1526.34 }, - ]}, - { id: 'OE0015', cost: '$7,026.34', comments: 0, ownership: { color: '#10B981', initials: 'GB', name: 'Commercial' }, due: '32 days', approver: { initials: 'MS', color: '#6366F1' }, approverTime: '2d', policy: 'AP Mex Matched App...', status: 'Approvals', statusType: 'default', lineItems: [ - { id: 'li-1', description: 'Software licenses', quantity: 10, unitPrice: 450, total: 4500 }, - { id: 'li-2', description: 'Support contract', quantity: 1, unitPrice: 2526.34, total: 2526.34 }, - ]}, -] - -// Icon components -const FileIcon = () => ( - - - - -) - -const ChevronDownIcon = () => ( - - - -) - -const PlusIcon = () => ( - - - -) - -const FilterIcon = () => ( - - - -) - -const SearchIcon = () => ( - - - -) - -const SettingsIcon = () => ( - - - -) - -const CheckCircleIcon = () => ( - - - - -) - -const WarningIcon = () => ( - - - - -) - -const DisputeIcon = () => ( - - - -) - -const GearIcon = () => ( - - - - -) - -const ArrowLeftIcon = () => ( - - - -) - -const ArrowRightIcon = () => ( - - - -) - -const DoubleArrowLeftIcon = () => ( - - - -) - -const DoubleArrowRightIcon = () => ( - - - -) - -const ClockIcon = () => ( - - - - -) - -const EyeIcon = () => ( - - - - -) - -const ChevronLeftIcon = () => ( - - - -) - -// Status badge component -const StatusBadge = ({ status, type }: { status: string; type: string }) => { - 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 - case 'pending': - return - case 'conflict': - return - case 'dispute': - return - case 'submit': - return - default: - return - } - } - - return ( - - {getIcon()} - {status} - - ) -} - -// Due date badge component -const DueBadge = ({ due, type }: { due: string; type?: string }) => { - 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 ( - - {due} - - ) - } - - return {due} -} - -// Avatar component -const Avatar = ({ initials, color, size = 24, hasIndicator = false }: { initials: string; color: string; size?: number; hasIndicator?: boolean }) => ( -
-
- {initials} -
- {hasIndicator && ( - - )} -
-) - -// Comments Sidebar Component - Per-row thread using VeltInlineCommentsSection -const CommentsSidebar = ({ - isOpen, - onClose, - selectedJob -}: { - isOpen: boolean; - onClose: () => void; - selectedJob: Job | null; -}) => { - if (!isOpen || !selectedJob) return null - - return ( -
- {/* Header */} -
-
- -
- Comments - ({selectedJob.id}) -
-
-
- - {/* VeltInlineCommentsSection for per-row thread */} -
- -
-
- ) -} +// Re-export types for backwards compatibility +export type { Job, JobLineItem } from './types' export default function DocumentCanvas() { const [selectedJob, setSelectedJob] = useState(null) @@ -352,7 +31,6 @@ export default function DocumentCanvas() { setSelectedJob(null) } - // Handler for opening comment sidebar for a specific row const handleOpenCommentsForRow = (job: Job) => { setSelectedJobForComments(job) setIsCommentSidebarOpen(true) @@ -401,161 +79,17 @@ export default function DocumentCanvas() { {/* Summary Cards */} -
- {/* Review & approve card */} -
-
- -
- Review & approve - 2 -
- - {/* Conflict card */} -
-
- -
- Conflict - 2 -
- - {/* Dispute card */} -
-
- -
- Dispute - 6 -
-
+ {/* Data Table */} -
- - - - - - - - - - - - - - - - - {jobsData.map((job) => ( - handleOpenCommentsForRow(job)} - > - - - - - - - - - - - - ))} - -
- - -
- Job -
-
CostCommentsOwnershipDueCurrent approverApproval policyStatus - -
- e.stopPropagation()} /> - - { - e.stopPropagation() - handleJobClick(job) - }} - > - {job.id} - - - {job.cost} - -
e.stopPropagation()} - > - -
-
-
- - {job.ownership.name} -
-
- - - {job.approver ? ( -
- - {job.approverTime && {job.approverTime}} -
- ) : ( - ... - )} -
- {job.policy} - - -
-
+ {/* Pagination */} -
- Showing 1-12 of 91 results (page 1 of 8) -
-
- - - - -
-
- 12 rows - -
-
- Go to page: - -
-
-
+ {/* Comments Sidebar - Per-row thread */} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/icons.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/icons.tsx new file mode 100644 index 00000000..2489ce5d --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/icons.tsx @@ -0,0 +1,107 @@ +export const FileIcon = () => ( + + + + +) + +export const ChevronDownIcon = () => ( + + + +) + +export const PlusIcon = () => ( + + + +) + +export const FilterIcon = () => ( + + + +) + +export const SearchIcon = () => ( + + + +) + +export const SettingsIcon = () => ( + + + +) + +export const CheckCircleIcon = () => ( + + + + +) + +export const WarningIcon = () => ( + + + + +) + +export const DisputeIcon = () => ( + + + +) + +export const GearIcon = () => ( + + + + +) + +export const ArrowLeftIcon = () => ( + + + +) + +export const ArrowRightIcon = () => ( + + + +) + +export const DoubleArrowLeftIcon = () => ( + + + +) + +export const DoubleArrowRightIcon = () => ( + + + +) + +export const ClockIcon = () => ( + + + + +) + +export const EyeIcon = () => ( + + + + +) + +export const ChevronLeftIcon = () => ( + + + +) diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/jobs-data.ts b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/jobs-data.ts new file mode 100644 index 00000000..2b0ffa3d --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/jobs-data.ts @@ -0,0 +1,252 @@ +import { Job } from './types' + +export const jobsData: Job[] = [ + { + id: 'OE0001', + cost: '', + comments: 0, + ownership: { color: '#10B981', initials: 'E', name: 'Ocean Freight - ...' }, + due: '...', + approver: null, + policy: 'AP Eur Matched Appr...', + status: 'Matching', + statusType: 'default', + lineItems: [ + { id: 'li-1', description: 'Container shipping fee', quantity: 1, unitPrice: 1200, total: 1200 }, + { id: 'li-2', description: 'Port handling charges', quantity: 2, unitPrice: 150, total: 300 }, + ] + }, + { + id: 'OE0002', + cost: '$2,875.93', + comments: 32, + ownership: { color: '#EC4899', initials: 'R', name: 'Commercial' }, + due: '-2 days', + dueType: 'overdue', + approver: { initials: 'LW', color: '#6366F1' }, + approverTime: '<1d', + policy: 'AP US Matched Appr...', + status: 'Review & approve', + statusType: 'review', + lineItems: [ + { id: 'li-1', description: 'Marketing materials', quantity: 500, unitPrice: 2.5, total: 1250 }, + { id: 'li-2', description: 'Printing services', quantity: 1, unitPrice: 875.93, total: 875.93 }, + { id: 'li-3', description: 'Design consultation', quantity: 3, unitPrice: 250, total: 750 }, + ] + }, + { + id: 'OE0003', + cost: '$1,729.18', + comments: 2, + ownership: { color: '#8B5CF6', initials: 'WW', name: 'General AP' }, + due: '...', + approver: null, + policy: 'AP Eur Matched Appr...', + status: 'Pending', + statusType: 'pending', + lineItems: [ + { id: 'li-1', description: 'Office supplies', quantity: 10, unitPrice: 89.50, total: 895 }, + { id: 'li-2', description: 'Equipment maintenance', quantity: 1, unitPrice: 834.18, total: 834.18 }, + ] + }, + { + id: 'OE0004', + cost: '$2,432.82', + comments: 0, + ownership: { color: '#F59E0B', initials: 'RS', name: 'Packaged Goods' }, + due: '-10 days', + dueType: 'overdue', + approver: { initials: 'LW', color: '#6366F1' }, + approverTime: '<1d', + policy: 'AP Eur Matched Appr...', + status: 'Review & approve', + statusType: 'review', + lineItems: [ + { id: 'li-1', description: 'Packaging materials', quantity: 1000, unitPrice: 1.25, total: 1250 }, + { id: 'li-2', description: 'Label printing', quantity: 5000, unitPrice: 0.15, total: 750 }, + { id: 'li-3', description: 'Shipping boxes', quantity: 100, unitPrice: 4.33, total: 432.82 }, + ] + }, + { + id: 'OE0005', + cost: '$16,431.76', + comments: 0, + ownership: { color: '#8B5CF6', initials: 'MJ', name: 'Ocean Freight - ...' }, + due: 'Today', + dueType: 'today', + approver: { initials: 'LW', color: '#6366F1' }, + approverTime: '3d', + policy: 'Metals & Timber', + status: 'Review & approve', + statusType: 'review', + lineItems: [ + { id: 'li-1', description: 'Steel beams shipment', quantity: 50, unitPrice: 250, total: 12500 }, + { id: 'li-2', description: 'Insurance premium', quantity: 1, unitPrice: 2431.76, total: 2431.76 }, + { id: 'li-3', description: 'Customs clearance', quantity: 1, unitPrice: 1500, total: 1500 }, + ] + }, + { + id: 'OE0006', + cost: '$115,472.51', + comments: 5, + ownership: { color: '#10B981', initials: 'SC', name: '3rd Party Suppli...' }, + due: '12 days', + dueType: 'warning', + approver: { initials: 'LW', color: '#6366F1' }, + policy: 'Vegetable protein ap...', + status: 'Conflict', + statusType: 'conflict', + lineItems: [ + { id: 'li-1', description: 'Bulk protein powder', quantity: 10000, unitPrice: 8.50, total: 85000 }, + { id: 'li-2', description: 'Quality testing', quantity: 1, unitPrice: 5472.51, total: 5472.51 }, + { id: 'li-3', description: 'Expedited shipping', quantity: 1, unitPrice: 25000, total: 25000 }, + ] + }, + { + id: 'OE0007', + cost: '$5,820.91', + comments: 0, + ownership: { color: '#3B82F6', initials: 'JK', name: 'Commercial' }, + due: '47 days', + approver: { initials: 'LW', color: '#6366F1' }, + policy: 'Vegetable protein ap...', + status: 'Conflict', + statusType: 'conflict', + lineItems: [ + { id: 'li-1', description: 'Trade show booth rental', quantity: 1, unitPrice: 3500, total: 3500 }, + { id: 'li-2', description: 'Display materials', quantity: 1, unitPrice: 2320.91, total: 2320.91 }, + ] + }, + { + id: 'OE0008', + cost: '$3,711.83', + comments: 0, + ownership: { color: '#6366F1', initials: 'EL', name: 'General AP' }, + due: '8 days', + dueType: 'warning', + approver: { initials: 'AK', color: '#F59E0B' }, + approverTime: '1d', + policy: 'Metals & Timber', + status: 'Submit for approval', + statusType: 'submit', + lineItems: [ + { id: 'li-1', description: 'Timber processing fee', quantity: 1, unitPrice: 2500, total: 2500 }, + { id: 'li-2', description: 'Quality inspection', quantity: 1, unitPrice: 711.83, total: 711.83 }, + { id: 'li-3', description: 'Documentation fee', quantity: 1, unitPrice: 500, total: 500 }, + ] + }, + { + id: 'OE0009', + cost: '$8,348.07', + comments: 0, + ownership: { color: '#3B82F6', initials: 'JK', name: 'N. American Over...' }, + due: 'Paid', + dueType: 'paid', + approver: { initials: 'LW', color: '#6366F1' }, + policy: 'AP Eur Matched Appr...', + status: 'Dispute', + statusType: 'dispute', + lineItems: [ + { id: 'li-1', description: 'Ground transportation', quantity: 15, unitPrice: 450, total: 6750 }, + { id: 'li-2', description: 'Fuel surcharge', quantity: 1, unitPrice: 1598.07, total: 1598.07 }, + ] + }, + { + id: 'OE0010', + cost: '$11,096.22', + comments: 3, + ownership: { color: '#8B5CF6', initials: 'WW', name: 'Trucking' }, + due: '11 days', + approver: { initials: 'LW', color: '#6366F1' }, + policy: 'AP Mex Matched App...', + status: 'Verifying', + statusType: 'default', + lineItems: [ + { id: 'li-1', description: 'Long haul trucking', quantity: 3, unitPrice: 3200, total: 9600 }, + { id: 'li-2', description: 'Loading/unloading', quantity: 6, unitPrice: 249.37, total: 1496.22 }, + ] + }, + { + id: 'OE0011', + cost: '$85,682.06', + comments: 0, + ownership: { color: '#3B82F6', initials: 'JK', name: 'Journal entries' }, + due: 'Paid', + dueType: 'paid', + approver: { initials: 'LW', color: '#F59E0B', hasIndicator: true }, + approverTime: '6d', + policy: 'AP Mex Matched App...', + status: 'Approvals', + statusType: 'default', + lineItems: [ + { id: 'li-1', description: 'Q4 inventory adjustment', quantity: 1, unitPrice: 45000, total: 45000 }, + { id: 'li-2', description: 'Depreciation entries', quantity: 1, unitPrice: 25682.06, total: 25682.06 }, + { id: 'li-3', description: 'Accrual reversal', quantity: 1, unitPrice: 15000, total: 15000 }, + ] + }, + { + id: 'OE0012', + cost: '$7,026.34', + comments: 0, + ownership: { color: '#10B981', initials: 'GB', name: 'Commercial' }, + due: '32 days', + approver: { initials: 'MN', color: '#EC4899' }, + approverTime: '8d', + policy: 'Metals & Timber', + status: 'Approvals', + statusType: 'default', + lineItems: [ + { id: 'li-1', description: 'Client entertainment', quantity: 1, unitPrice: 3500, total: 3500 }, + { id: 'li-2', description: 'Travel expenses', quantity: 1, unitPrice: 2526.34, total: 2526.34 }, + { id: 'li-3', description: 'Conference registration', quantity: 2, unitPrice: 500, total: 1000 }, + ] + }, + { + id: 'OE0013', + cost: '$7,026.34', + comments: 27, + ownership: { color: '#10B981', initials: 'GB', name: 'Commercial' }, + due: '32 days', + approver: { initials: 'EA', color: '#6366F1' }, + approverTime: '2d', + policy: 'Metals & Timber', + status: 'Review & approve', + statusType: 'review', + lineItems: [ + { id: 'li-1', description: 'Advertising spend', quantity: 1, unitPrice: 5000, total: 5000 }, + { id: 'li-2', description: 'Media placement', quantity: 1, unitPrice: 2026.34, total: 2026.34 }, + ] + }, + { + id: 'OE0014', + cost: '$7,026.34', + comments: 9, + ownership: { color: '#10B981', initials: 'GB', name: 'Commercial' }, + due: '32 days', + approver: { initials: 'TM', color: '#F59E0B' }, + approverTime: '11d', + policy: 'AP Eur Matched Appr...', + status: 'Approvals', + statusType: 'default', + lineItems: [ + { id: 'li-1', description: 'Consulting services', quantity: 20, unitPrice: 275, total: 5500 }, + { id: 'li-2', description: 'Project expenses', quantity: 1, unitPrice: 1526.34, total: 1526.34 }, + ] + }, + { + id: 'OE0015', + cost: '$7,026.34', + comments: 0, + ownership: { color: '#10B981', initials: 'GB', name: 'Commercial' }, + due: '32 days', + approver: { initials: 'MS', color: '#6366F1' }, + approverTime: '2d', + policy: 'AP Mex Matched App...', + status: 'Approvals', + statusType: 'default', + lineItems: [ + { id: 'li-1', description: 'Software licenses', quantity: 10, unitPrice: 450, total: 4500 }, + { id: 'li-2', description: 'Support contract', quantity: 1, unitPrice: 2526.34, total: 2526.34 }, + ] + }, +] diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/types.ts b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/types.ts new file mode 100644 index 00000000..dd7a4985 --- /dev/null +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/document/types.ts @@ -0,0 +1,22 @@ +export interface JobLineItem { + id: string + description: string + quantity: number + unitPrice: number + total: number +} + +export interface Job { + id: string + cost: string + comments: number + ownership: { color: string; initials: string; name: string } + due: string + dueType?: string + approver: { initials: string; color: string; hasIndicator?: boolean } | null + approverTime?: string + policy: string + status: string + statusType: string + lineItems: JobLineItem[] +} diff --git a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/sidebar/sidebar.tsx b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/sidebar/sidebar.tsx index 50aab537..d7a9131e 100644 --- a/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/sidebar/sidebar.tsx +++ b/apps/react/comments/dashboard/inline-comments/open-envoy-demo/components/sidebar/sidebar.tsx @@ -1,6 +1,6 @@ 'use client'; -import { VeltNotificationsTool, useNotificationUtils } from '@veltdev/react'; +import { VeltNotificationsTool, useNotificationUtils, useUnreadNotificationsCount } from '@veltdev/react'; // Sidebar icon assets const imgOpenEnvoyWordmarkSmallUsePositive1 = "/icons/sidebar/open-envoy-logo.svg"; @@ -82,11 +82,15 @@ function SectionHeader({ label }: SectionHeaderProps) { export default function Sidebar() { const notificationUtils = useNotificationUtils(); + const unreadCount = useUnreadNotificationsCount(); const handleNotificationsClick = () => { notificationUtils?.openNotificationsPanel(); }; + // Get the count for "For You" tab (default), fallback to 0 + const notificationCount = unreadCount?.forYou ?? 0; + return (