From 80156d2fd580ded544e107726c4f49274fd2cfb0 Mon Sep 17 00:00:00 2001 From: Rakesh Date: Wed, 17 Dec 2025 01:57:42 -0800 Subject: [PATCH 1/2] Update dependencies and refactor components in dashboard-inline-comments-demo - Updated @veltdev/react and @veltdev/types to version 4.6.5 in package.json. - Refactored layout to include AppProviders for user authentication. - Integrated VeltProvider for collaboration features in the main page. - Adjusted document ID handling in DocumentContext for better shareability. - Removed unused Velt comment tools and streamlined comments section in JobDetailModal and ActionModal. - Enhanced sidebar and header components for improved layout and functionality. - Added new UI customization components for notifications and sidebar buttons. - Updated API key handling in token route for consistency. These changes improve the overall structure and functionality of the demo application. --- .../app/api/velt/token/route.ts | 4 +- .../app/document/DocumentContext.tsx | 4 +- .../app/layout.tsx | 5 +- .../app/page.tsx | 40 ++++------ .../components/document/ActionModal.tsx | 6 -- .../components/document/CommentsSidebar.tsx | 9 ++- .../components/document/JobDetailModal.tsx | 36 ++------- .../components/document/JobsTable.tsx | 2 +- .../components/document/document-canvas.tsx | 4 +- .../components/header/header.tsx | 2 +- .../components/sidebar/sidebar.tsx | 39 +--------- .../components/velt/VeltCollaboration.tsx | 6 +- .../velt/VeltInitializeDocument.tsx | 12 +-- .../ui-customization/VeltCommentBubbleWf.tsx | 1 + .../ui-customization/VeltCommentToolWf.tsx | 1 + .../ui-customization/VeltCustomization.tsx | 19 +++++ .../VeltNotificationsToolWf.tsx | 22 +++++- .../ui-customization/VeltSidebarButtonWf.tsx | 1 + .../velt/ui-customization/index.tsx | 18 ----- .../velt/ui-customization/styles.css | 70 ++++++++++++++++++ .../package.json | 5 +- pnpm-lock.yaml | 74 ++++++++++++++++++- 22 files changed, 236 insertions(+), 144 deletions(-) create mode 100644 apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/velt/ui-customization/VeltCustomization.tsx delete mode 100644 apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/velt/ui-customization/index.tsx create mode 100644 apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/velt/ui-customization/styles.css diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/token/route.ts b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/token/route.ts index 17cc582b..e409e0a0 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/token/route.ts +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/api/velt/token/route.ts @@ -1,8 +1,8 @@ import { NextRequest, NextResponse } from 'next/server'; // [Velt] API key and auth token from environment variables -const NEXT_PUBLIC_VELT_API_KEY = process.env.NEXT_PUBLIC_VELT_API_KEY || process.env.VELT_API_KEY || ''; -const VELT_AUTH_TOKEN = process.env.VELT_AUTH_TOKEN; +const NEXT_PUBLIC_VELT_API_KEY = "6xTcUFtlYAlCdh11zrKB"; +const VELT_AUTH_TOKEN = "bd4d5226050470b6c658054fcdf1092a"; export async function POST(req: NextRequest) { try { diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/document/DocumentContext.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/document/DocumentContext.tsx index b09a9140..38ccffe0 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/document/DocumentContext.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/document/DocumentContext.tsx @@ -48,13 +48,13 @@ export function useCurrentDocument(): CurrentDocument { localStorage.setItem('velt-demo-document-id', docId); } else { // 2. Check localStorage for existing document - const stored = localStorage.getItem('velt-demo-document-id'); + const stored = localStorage.getItem('velt-inline-comments-demo-doc-id'); if (stored) { docId = stored; } else { // 3. Generate new document ID docId = `doc-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`; - localStorage.setItem('velt-demo-document-id', docId); + localStorage.setItem('velt-inline-comments-demo-doc-id', docId); } // Update URL with document ID for shareability diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/layout.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/layout.tsx index 2ecfc014..8f5ea9fe 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/layout.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/layout.tsx @@ -1,5 +1,6 @@ import type { Metadata } from 'next' import '../styles/globals.css' +import { AppProviders } from "@/app/userAuth/AppProviders" export const metadata: Metadata = { title: 'Dashboard Inline Demo', @@ -13,7 +14,9 @@ export default function RootLayout({ }) { return ( - {children} + + {children} + ) } diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/page.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/page.tsx index 3de64af6..80e7e9ae 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/page.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/app/page.tsx @@ -1,33 +1,25 @@ -'use client' - +"use client"; +// [Velt] Provider + collaboration +import { VeltProvider } from "@veltdev/react"; +import { useVeltAuthProvider } from "@/components/velt/VeltInitializeUser"; +import { VeltCollaboration } from "@/components/velt/VeltCollaboration"; import DocumentCanvas from '@/components/document/document-canvas' -import { VeltProvider } from '@veltdev/react' -import { VeltCollaboration } from '@/components/velt/VeltCollaboration' -import { AppProviders } from './userAuth/AppProviders' -import { useVeltAuthProvider } from '@/components/velt/VeltInitializeUser' -function VeltWrapper({ children }: { children: React.ReactNode }) { - const { authProvider } = useVeltAuthProvider() +// [Velt] Replace with your own API key from https://console.velt.dev +const NEXT_PUBLIC_VELT_API_KEY = "6xTcUFtlYAlCdh11zrKB"; + +export default function Home() { + // [Velt] Auth provider (reads from app/userAuth/useAppUser) + const { authProvider } = useVeltAuthProvider(); return ( + // [Velt] Wrap app with VeltProvider - {children} + - ) -} - -export default function Home() { - return ( - - -
- -
-
-
- ) -} + ); +} \ No newline at end of file diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/ActionModal.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/ActionModal.tsx index 0b9e4801..4aba55b5 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/ActionModal.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/ActionModal.tsx @@ -1,7 +1,6 @@ 'use client' import { useState } from 'react' -import { VeltCommentTool } from '@veltdev/react' interface ActionModalProps { jobId: string @@ -190,11 +189,6 @@ export default function ActionModal({ jobId, actionType, actionLabel, onClose, o )} - {/* Hidden Velt comment tool for creating the action comment */} -
- -
- {/* Info about action comments */}

diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/CommentsSidebar.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/CommentsSidebar.tsx index 05533736..7038badd 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/CommentsSidebar.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/CommentsSidebar.tsx @@ -14,7 +14,7 @@ export const CommentsSidebar = ({ isOpen, onClose, selectedJob }: CommentsSideba return (

{/* Header */} -
+
- {/* VeltInlineCommentsSection for per-row thread */} -
+ {/* VeltInlineCommentsSection for each line item */} +
diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/JobDetailModal.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/JobDetailModal.tsx index d498c122..0be476b3 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/JobDetailModal.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/JobDetailModal.tsx @@ -1,7 +1,7 @@ 'use client' import { useState } from 'react' -import { VeltCommentTool, VeltCommentBubble, VeltInlineCommentsSection } from '@veltdev/react' +import { VeltInlineCommentsSection } from '@veltdev/react' import type { Job, JobLineItem } from './document-canvas' import ActionModal from './ActionModal' @@ -39,25 +39,7 @@ function LineItemRow({ lineItem, jobId }: { lineItem: JobLineItem; jobId: string
${lineItem.total.toFixed(2)}
-
-
- - -
-
- - {/* Inline comments section for this line item */} - {showComments && ( -
-
Comments for: {lineItem.description}
- -
- )}
) } @@ -67,8 +49,6 @@ export default function JobDetailModal({ job, isOpen, onClose }: JobDetailModalP if (!isOpen) return null - const jobTargetId = `job-${job.id}` - // Calculate totals const subtotal = job.lineItems.reduce((sum, item) => sum + item.total, 0) const tax = subtotal * 0.08 // 8% tax @@ -174,18 +154,13 @@ export default function JobDetailModal({ job, isOpen, onClose }: JobDetailModalP

Job Comments

-
-
- - -
-
-
+
@@ -200,7 +175,6 @@ export default function JobDetailModal({ job, isOpen, onClose }: JobDetailModalP
Qty
Unit Price
Total
-
Comments
{/* Line Items */} diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/JobsTable.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/JobsTable.tsx index 4c101d67..ca583d3d 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/JobsTable.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/document/JobsTable.tsx @@ -72,7 +72,7 @@ export const JobsTable = ({ jobs, onJobClick, onRowClick }: JobsTableProps) => { className="flex items-center justify-center min-w-[64px] relative overflow-visible" onClick={(e) => e.stopPropagation()} > - + +
-
+
{/* Main Content Area */} diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/header/header.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/header/header.tsx index e096fc7e..85bd3b20 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/header/header.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/header/header.tsx @@ -4,7 +4,7 @@ import VeltTools from '@/components/velt/VeltTools' export default function Header() { return ( -
+

Dashboard Inline Demo

diff --git a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/sidebar/sidebar.tsx b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/sidebar/sidebar.tsx index 936bcce7..ea1a9f36 100644 --- a/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/sidebar/sidebar.tsx +++ b/apps/react/comments/dashboard/inline-comments/dashboard-inline-comments-demo/components/sidebar/sidebar.tsx @@ -1,6 +1,6 @@ 'use client'; -import { VeltNotificationsTool, useNotificationUtils, useUnreadNotificationsCount } from '@veltdev/react'; +import { VeltNotificationsTool } from '@veltdev/react'; // Sidebar icon assets const imgLogo = "/icons/sidebar/open-envoy-logo.svg"; @@ -81,16 +81,6 @@ 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 (