hazo_chat 2.0.8 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ A full-featured React chat component library for 1-1 communication with document
|
|
|
20
20
|
## Table of Contents
|
|
21
21
|
|
|
22
22
|
- [Installation](#installation)
|
|
23
|
+
- [UI Requirements](#ui-requirements)
|
|
23
24
|
- [Quick Start](#quick-start)
|
|
24
25
|
- [API Routes Setup](#api-routes-setup)
|
|
25
26
|
- [Props Reference](#props-reference)
|
|
@@ -37,6 +38,89 @@ A full-featured React chat component library for 1-1 communication with document
|
|
|
37
38
|
npm install hazo_chat hazo_connect next
|
|
38
39
|
```
|
|
39
40
|
|
|
41
|
+
## UI Requirements
|
|
42
|
+
|
|
43
|
+
hazo_chat requires the following UI setup to match the design standards:
|
|
44
|
+
|
|
45
|
+
### Required UI Dependencies
|
|
46
|
+
|
|
47
|
+
Install these packages in your consuming project:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install sonner @radix-ui/react-alert-dialog
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Required UI Components (shadcn/ui style)
|
|
54
|
+
|
|
55
|
+
The following components must be available in your project at `@/components/ui/`:
|
|
56
|
+
|
|
57
|
+
- `AlertDialog` - For user acknowledgment dialogs (must be created by consuming project)
|
|
58
|
+
- `Button` - Included in hazo_chat package
|
|
59
|
+
- `Input` - Included in hazo_chat package
|
|
60
|
+
- All other components are included in hazo_chat package
|
|
61
|
+
|
|
62
|
+
**Note:** The `AlertDialog` component is not included in the hazo_chat package. You must create it using shadcn/ui Alert Dialog component. See `test-app/src/components/ui/alert-dialog.tsx` for a reference implementation.
|
|
63
|
+
|
|
64
|
+
### Required Global Providers
|
|
65
|
+
|
|
66
|
+
Add Sonner Toaster to your root layout:
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
// app/layout.tsx
|
|
70
|
+
import { Toaster } from 'sonner';
|
|
71
|
+
|
|
72
|
+
export default function RootLayout({ children }) {
|
|
73
|
+
return (
|
|
74
|
+
<html>
|
|
75
|
+
<body>
|
|
76
|
+
{children}
|
|
77
|
+
<Toaster position="top-right" richColors />
|
|
78
|
+
</body>
|
|
79
|
+
</html>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Required Tailwind Configuration
|
|
85
|
+
|
|
86
|
+
Your `tailwind.config.ts` must include hazo_chat package paths in content:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
export default {
|
|
90
|
+
content: [
|
|
91
|
+
// ... your existing paths
|
|
92
|
+
'./node_modules/hazo_chat/dist/**/*.{js,ts,jsx,tsx}',
|
|
93
|
+
],
|
|
94
|
+
// ... rest of config
|
|
95
|
+
};
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Important:** Without this configuration, Tailwind classes used by hazo_chat components may not be compiled, causing styling issues.
|
|
99
|
+
|
|
100
|
+
### Required CSS Variables
|
|
101
|
+
|
|
102
|
+
Your global CSS must define these CSS variables (shadcn/ui standard):
|
|
103
|
+
|
|
104
|
+
**Core Colors:**
|
|
105
|
+
- `--background`, `--foreground`
|
|
106
|
+
- `--primary`, `--primary-foreground`
|
|
107
|
+
- `--secondary`, `--secondary-foreground`
|
|
108
|
+
- `--muted`, `--muted-foreground`
|
|
109
|
+
- `--accent`, `--accent-foreground`
|
|
110
|
+
- `--destructive`, `--destructive-foreground`
|
|
111
|
+
|
|
112
|
+
**Border and Input:**
|
|
113
|
+
- `--border`, `--input`, `--ring`
|
|
114
|
+
|
|
115
|
+
**Card:**
|
|
116
|
+
- `--card`, `--card-foreground`
|
|
117
|
+
|
|
118
|
+
See `test-app/src/app/globals.css` for complete variable definitions with example values.
|
|
119
|
+
|
|
120
|
+
### UI Design Standards
|
|
121
|
+
|
|
122
|
+
For detailed visual design specifications, component behavior, and layout standards, see [UI_DESIGN_STANDARDS.md](./UI_DESIGN_STANDARDS.md).
|
|
123
|
+
|
|
40
124
|
## Quick Start
|
|
41
125
|
|
|
42
126
|
### Step 1: Create API Routes
|
|
@@ -480,6 +564,22 @@ import { DEFAULT_POLLING_INTERVAL, MIME_TYPE_MAP } from 'hazo_chat/lib';
|
|
|
480
564
|
4. **CORS errors**
|
|
481
565
|
- API routes should be on the same domain as the frontend
|
|
482
566
|
|
|
567
|
+
5. **UI components not styled correctly**
|
|
568
|
+
- Ensure Tailwind config includes hazo_chat package paths in `content` array
|
|
569
|
+
- Verify CSS variables are defined in `globals.css`
|
|
570
|
+
- Check that all UI dependencies are installed (see [UI Requirements](#ui-requirements))
|
|
571
|
+
- Rebuild CSS: `rm -rf .next` and restart dev server
|
|
572
|
+
|
|
573
|
+
6. **Toast notifications not appearing**
|
|
574
|
+
- Ensure Sonner Toaster is added to root layout (see [UI Requirements](#ui-requirements))
|
|
575
|
+
- Check that `sonner` package is installed
|
|
576
|
+
- Verify `<Toaster position="top-right" richColors />` is in layout body
|
|
577
|
+
|
|
578
|
+
7. **Alert Dialog not working**
|
|
579
|
+
- Create Alert Dialog component at `src/components/ui/alert-dialog.tsx`
|
|
580
|
+
- See `test-app/src/components/ui/alert-dialog.tsx` for reference implementation
|
|
581
|
+
- Ensure `@radix-ui/react-alert-dialog` is installed
|
|
582
|
+
|
|
483
583
|
## Related Packages
|
|
484
584
|
|
|
485
585
|
- [hazo_connect](https://github.com/pub12/hazo_connect) - Database adapter
|
|
@@ -493,3 +593,7 @@ MIT © Pubs Abayasiri
|
|
|
493
593
|
---
|
|
494
594
|
|
|
495
595
|
For detailed setup instructions, see [SETUP_CHECKLIST.md](./SETUP_CHECKLIST.md).
|
|
596
|
+
|
|
597
|
+
For UI design standards and visual specifications, see [UI_DESIGN_STANDARDS.md](./UI_DESIGN_STANDARDS.md).
|
|
598
|
+
|
|
599
|
+
For UI design standards and specifications, see [UI_DESIGN_STANDARDS.md](./UI_DESIGN_STANDARDS.md).
|
package/SETUP_CHECKLIST.md
CHANGED
|
@@ -11,9 +11,11 @@ A comprehensive, step-by-step guide for setting up hazo_chat in a Next.js projec
|
|
|
11
11
|
3. [Database Setup](#3-database-setup)
|
|
12
12
|
4. [API Routes](#4-api-routes)
|
|
13
13
|
5. [Component Integration](#5-component-integration)
|
|
14
|
-
6. [
|
|
15
|
-
7. [
|
|
16
|
-
8. [
|
|
14
|
+
6. [UI Components and Styling Setup](#6-ui-components-and-styling-setup)
|
|
15
|
+
7. [Configuration (Optional)](#7-configuration-optional)
|
|
16
|
+
8. [UI Design Standards Compliance](#8-ui-design-standards-compliance)
|
|
17
|
+
9. [Verification Checklist](#9-verification-checklist)
|
|
18
|
+
10. [Troubleshooting](#10-troubleshooting)
|
|
17
19
|
|
|
18
20
|
---
|
|
19
21
|
|
|
@@ -306,7 +308,327 @@ export default function ChatPage() {
|
|
|
306
308
|
|
|
307
309
|
---
|
|
308
310
|
|
|
309
|
-
## 6.
|
|
311
|
+
## 6. UI Components and Styling Setup
|
|
312
|
+
|
|
313
|
+
### Step 6.1: Install UI Dependencies
|
|
314
|
+
|
|
315
|
+
Install the required UI packages:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
npm install sonner @radix-ui/react-alert-dialog
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Verification:**
|
|
322
|
+
- [ ] `sonner` package installed
|
|
323
|
+
- [ ] `@radix-ui/react-alert-dialog` installed
|
|
324
|
+
- [ ] `package.json` contains both dependencies
|
|
325
|
+
|
|
326
|
+
### Step 6.2: Create Alert Dialog Component
|
|
327
|
+
|
|
328
|
+
**File:** `src/components/ui/alert-dialog.tsx`
|
|
329
|
+
|
|
330
|
+
Create the Alert Dialog component using shadcn/ui style. This component is used for messages requiring user acknowledgment.
|
|
331
|
+
|
|
332
|
+
**Reference Implementation:** See `test-app/src/components/ui/alert-dialog.tsx` for a complete example.
|
|
333
|
+
|
|
334
|
+
**Minimum Required Structure:**
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
"use client"
|
|
338
|
+
|
|
339
|
+
import * as React from "react"
|
|
340
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
|
341
|
+
import { Button } from "@/components/ui/button"
|
|
342
|
+
import { cn } from "@/lib/utils"
|
|
343
|
+
|
|
344
|
+
const AlertDialog = AlertDialogPrimitive.Root
|
|
345
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
|
346
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
|
347
|
+
|
|
348
|
+
const AlertDialogOverlay = React.forwardRef<
|
|
349
|
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
350
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
351
|
+
>(({ className, ...props }, ref) => (
|
|
352
|
+
<AlertDialogPrimitive.Overlay
|
|
353
|
+
className={cn(
|
|
354
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
355
|
+
className
|
|
356
|
+
)}
|
|
357
|
+
{...props}
|
|
358
|
+
ref={ref}
|
|
359
|
+
/>
|
|
360
|
+
))
|
|
361
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
|
362
|
+
|
|
363
|
+
const AlertDialogContent = React.forwardRef<
|
|
364
|
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
365
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
|
366
|
+
>(({ className, ...props }, ref) => (
|
|
367
|
+
<AlertDialogPortal>
|
|
368
|
+
<AlertDialogOverlay />
|
|
369
|
+
<AlertDialogPrimitive.Content
|
|
370
|
+
ref={ref}
|
|
371
|
+
className={cn(
|
|
372
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
373
|
+
className
|
|
374
|
+
)}
|
|
375
|
+
{...props}
|
|
376
|
+
/>
|
|
377
|
+
</AlertDialogPortal>
|
|
378
|
+
))
|
|
379
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
|
380
|
+
|
|
381
|
+
const AlertDialogHeader = ({
|
|
382
|
+
className,
|
|
383
|
+
...props
|
|
384
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
385
|
+
<div
|
|
386
|
+
className={cn(
|
|
387
|
+
"flex flex-col space-y-2 text-center sm:text-left",
|
|
388
|
+
className
|
|
389
|
+
)}
|
|
390
|
+
{...props}
|
|
391
|
+
/>
|
|
392
|
+
)
|
|
393
|
+
AlertDialogHeader.displayName = "AlertDialogHeader"
|
|
394
|
+
|
|
395
|
+
const AlertDialogFooter = ({
|
|
396
|
+
className,
|
|
397
|
+
...props
|
|
398
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
399
|
+
<div
|
|
400
|
+
className={cn(
|
|
401
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
402
|
+
className
|
|
403
|
+
)}
|
|
404
|
+
{...props}
|
|
405
|
+
/>
|
|
406
|
+
)
|
|
407
|
+
AlertDialogFooter.displayName = "AlertDialogFooter"
|
|
408
|
+
|
|
409
|
+
const AlertDialogTitle = React.forwardRef<
|
|
410
|
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
411
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
412
|
+
>(({ className, ...props }, ref) => (
|
|
413
|
+
<AlertDialogPrimitive.Title
|
|
414
|
+
ref={ref}
|
|
415
|
+
className={cn("text-lg font-semibold", className)}
|
|
416
|
+
{...props}
|
|
417
|
+
/>
|
|
418
|
+
))
|
|
419
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
|
420
|
+
|
|
421
|
+
const AlertDialogDescription = React.forwardRef<
|
|
422
|
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
423
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
424
|
+
>(({ className, ...props }, ref) => (
|
|
425
|
+
<AlertDialogPrimitive.Description
|
|
426
|
+
ref={ref}
|
|
427
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
428
|
+
{...props}
|
|
429
|
+
/>
|
|
430
|
+
))
|
|
431
|
+
AlertDialogDescription.displayName =
|
|
432
|
+
AlertDialogPrimitive.Description.displayName
|
|
433
|
+
|
|
434
|
+
const AlertDialogAction = React.forwardRef<
|
|
435
|
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
436
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
|
437
|
+
>(({ className, ...props }, ref) => (
|
|
438
|
+
<AlertDialogPrimitive.Action
|
|
439
|
+
ref={ref}
|
|
440
|
+
className={cn(
|
|
441
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
442
|
+
className
|
|
443
|
+
)}
|
|
444
|
+
{...props}
|
|
445
|
+
/>
|
|
446
|
+
))
|
|
447
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
|
448
|
+
|
|
449
|
+
const AlertDialogCancel = React.forwardRef<
|
|
450
|
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
451
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
|
452
|
+
>(({ className, ...props }, ref) => (
|
|
453
|
+
<AlertDialogPrimitive.Cancel
|
|
454
|
+
ref={ref}
|
|
455
|
+
className={cn(
|
|
456
|
+
"mt-2 sm:mt-0",
|
|
457
|
+
className
|
|
458
|
+
)}
|
|
459
|
+
{...props}
|
|
460
|
+
/>
|
|
461
|
+
))
|
|
462
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
|
463
|
+
|
|
464
|
+
export {
|
|
465
|
+
AlertDialog,
|
|
466
|
+
AlertDialogPortal,
|
|
467
|
+
AlertDialogOverlay,
|
|
468
|
+
AlertDialogTrigger,
|
|
469
|
+
AlertDialogContent,
|
|
470
|
+
AlertDialogHeader,
|
|
471
|
+
AlertDialogFooter,
|
|
472
|
+
AlertDialogTitle,
|
|
473
|
+
AlertDialogDescription,
|
|
474
|
+
AlertDialogAction,
|
|
475
|
+
AlertDialogCancel,
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
**Verification:**
|
|
480
|
+
- [ ] Alert Dialog component created at `src/components/ui/alert-dialog.tsx`
|
|
481
|
+
- [ ] Component exports all required sub-components
|
|
482
|
+
- [ ] No TypeScript errors
|
|
483
|
+
|
|
484
|
+
### Step 6.3: Setup Sonner Toaster
|
|
485
|
+
|
|
486
|
+
**File:** `src/app/layout.tsx`
|
|
487
|
+
|
|
488
|
+
Add the Sonner Toaster component to your root layout for toast notifications:
|
|
489
|
+
|
|
490
|
+
```tsx
|
|
491
|
+
import { Toaster } from 'sonner';
|
|
492
|
+
|
|
493
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
494
|
+
return (
|
|
495
|
+
<html lang="en">
|
|
496
|
+
<body>
|
|
497
|
+
{children}
|
|
498
|
+
<Toaster position="top-right" richColors />
|
|
499
|
+
</body>
|
|
500
|
+
</html>
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**Verification:**
|
|
506
|
+
- [ ] `Toaster` imported from `sonner`
|
|
507
|
+
- [ ] Toaster added to root layout
|
|
508
|
+
- [ ] Position set to `top-right`
|
|
509
|
+
- [ ] `richColors` prop enabled
|
|
510
|
+
|
|
511
|
+
### Step 6.4: Configure Tailwind CSS
|
|
512
|
+
|
|
513
|
+
**File:** `tailwind.config.ts`
|
|
514
|
+
|
|
515
|
+
Ensure hazo_chat package is included in Tailwind content paths:
|
|
516
|
+
|
|
517
|
+
```typescript
|
|
518
|
+
import type { Config } from 'tailwindcss';
|
|
519
|
+
|
|
520
|
+
const config: Config = {
|
|
521
|
+
content: [
|
|
522
|
+
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
|
|
523
|
+
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
|
|
524
|
+
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
|
|
525
|
+
// Include hazo_chat package components
|
|
526
|
+
'./node_modules/hazo_chat/dist/**/*.{js,ts,jsx,tsx}',
|
|
527
|
+
],
|
|
528
|
+
// ... rest of your config
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
export default config;
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
**Important:** Without this configuration, Tailwind classes used by hazo_chat components will not be compiled, causing styling issues.
|
|
535
|
+
|
|
536
|
+
**Verification:**
|
|
537
|
+
- [ ] `tailwind.config.ts` includes hazo_chat package path
|
|
538
|
+
- [ ] Path matches your `node_modules` location
|
|
539
|
+
- [ ] Config syntax is valid
|
|
540
|
+
|
|
541
|
+
### Step 6.5: Setup CSS Variables
|
|
542
|
+
|
|
543
|
+
**File:** `src/app/globals.css`
|
|
544
|
+
|
|
545
|
+
Ensure all required CSS variables are defined. hazo_chat uses shadcn/ui standard CSS variables:
|
|
546
|
+
|
|
547
|
+
```css
|
|
548
|
+
@tailwind base;
|
|
549
|
+
@tailwind components;
|
|
550
|
+
@tailwind utilities;
|
|
551
|
+
|
|
552
|
+
@layer base {
|
|
553
|
+
:root {
|
|
554
|
+
--radius: 0.5rem;
|
|
555
|
+
--background: 0 0% 100%;
|
|
556
|
+
--foreground: 0 0% 3.9%;
|
|
557
|
+
--card: 0 0% 100%;
|
|
558
|
+
--card-foreground: 0 0% 3.9%;
|
|
559
|
+
--popover: 0 0% 100%;
|
|
560
|
+
--popover-foreground: 0 0% 3.9%;
|
|
561
|
+
--primary: 0 0% 9%;
|
|
562
|
+
--primary-foreground: 0 0% 98%;
|
|
563
|
+
--secondary: 0 0% 96.1%;
|
|
564
|
+
--secondary-foreground: 0 0% 9%;
|
|
565
|
+
--muted: 0 0% 96.1%;
|
|
566
|
+
--muted-foreground: 0 0% 45.1%;
|
|
567
|
+
--accent: 0 0% 96.1%;
|
|
568
|
+
--accent-foreground: 0 0% 9%;
|
|
569
|
+
--destructive: 0 84.2% 60.2%;
|
|
570
|
+
--destructive-foreground: 0 0% 98%;
|
|
571
|
+
--border: 0 0% 89.8%;
|
|
572
|
+
--input: 0 0% 89.8%;
|
|
573
|
+
--ring: 0 0% 3.9%;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.dark {
|
|
577
|
+
--background: 0 0% 3.9%;
|
|
578
|
+
--foreground: 0 0% 98%;
|
|
579
|
+
--card: 0 0% 3.9%;
|
|
580
|
+
--card-foreground: 0 0% 98%;
|
|
581
|
+
--popover: 0 0% 3.9%;
|
|
582
|
+
--popover-foreground: 0 0% 98%;
|
|
583
|
+
--primary: 0 0% 98%;
|
|
584
|
+
--primary-foreground: 0 0% 9%;
|
|
585
|
+
--secondary: 0 0% 14.9%;
|
|
586
|
+
--secondary-foreground: 0 0% 98%;
|
|
587
|
+
--muted: 0 0% 14.9%;
|
|
588
|
+
--muted-foreground: 0 0% 63.9%;
|
|
589
|
+
--accent: 0 0% 14.9%;
|
|
590
|
+
--accent-foreground: 0 0% 98%;
|
|
591
|
+
--destructive: 0 62.8% 30.6%;
|
|
592
|
+
--destructive-foreground: 0 0% 98%;
|
|
593
|
+
--border: 0 0% 14.9%;
|
|
594
|
+
--input: 0 0% 14.9%;
|
|
595
|
+
--ring: 0 0% 83.1%;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
@layer base {
|
|
600
|
+
* {
|
|
601
|
+
@apply border-border;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
body {
|
|
605
|
+
@apply bg-background text-foreground;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
**Reference:** See `test-app/src/app/globals.css` for a complete example with oklch color format.
|
|
611
|
+
|
|
612
|
+
**Verification:**
|
|
613
|
+
- [ ] All required CSS variables defined in `:root`
|
|
614
|
+
- [ ] Dark mode variables defined (if supporting dark mode)
|
|
615
|
+
- [ ] Tailwind directives included (`@tailwind base`, etc.)
|
|
616
|
+
- [ ] Base layer styles applied
|
|
617
|
+
|
|
618
|
+
### UI Setup Verification Checklist
|
|
619
|
+
|
|
620
|
+
- [ ] All UI dependencies installed
|
|
621
|
+
- [ ] Alert Dialog component created and working
|
|
622
|
+
- [ ] Sonner Toaster added to root layout
|
|
623
|
+
- [ ] Tailwind config includes hazo_chat paths
|
|
624
|
+
- [ ] CSS variables defined in globals.css
|
|
625
|
+
- [ ] No build errors related to UI components
|
|
626
|
+
- [ ] Toast notifications working
|
|
627
|
+
- [ ] Alert dialogs displaying correctly
|
|
628
|
+
|
|
629
|
+
---
|
|
630
|
+
|
|
631
|
+
## 7. Configuration (Optional)
|
|
310
632
|
|
|
311
633
|
### hazo_connect Configuration
|
|
312
634
|
|
|
@@ -350,7 +672,43 @@ module.exports = nextConfig;
|
|
|
350
672
|
|
|
351
673
|
---
|
|
352
674
|
|
|
353
|
-
##
|
|
675
|
+
## 8. UI Design Standards Compliance
|
|
676
|
+
|
|
677
|
+
### Visual Design Verification
|
|
678
|
+
|
|
679
|
+
**Document Preview:**
|
|
680
|
+
- [ ] Empty state shows `IoDocumentOutline` icon (not image icon)
|
|
681
|
+
- [ ] Icon size is 48px × 48px with 50% opacity
|
|
682
|
+
|
|
683
|
+
**REFERENCES Section:**
|
|
684
|
+
- [ ] Font size is 9px (`text-[9px]`)
|
|
685
|
+
- [ ] Text is uppercase with wide letter spacing
|
|
686
|
+
- [ ] Section is collapsible with chevron indicator
|
|
687
|
+
|
|
688
|
+
**Input Area:**
|
|
689
|
+
- [ ] Padding is 16px (`p-4`) on all sides
|
|
690
|
+
- [ ] Input field and send button are properly aligned
|
|
691
|
+
|
|
692
|
+
**Message Display:**
|
|
693
|
+
- [ ] Only timestamp shown under messages (no status icons)
|
|
694
|
+
- [ ] Double green checkmark (`IoCheckmarkDoneSharp`) appears when message is read
|
|
695
|
+
- [ ] Checkmark only shows for sender's messages with `read_at` not null
|
|
696
|
+
|
|
697
|
+
**Header:**
|
|
698
|
+
- [ ] Close button visible when `on_close` prop provided
|
|
699
|
+
- [ ] Hamburger menu hidden on desktop (screens >= 768px)
|
|
700
|
+
- [ ] Hamburger menu visible on mobile (screens < 768px)
|
|
701
|
+
|
|
702
|
+
**Document Viewer:**
|
|
703
|
+
- [ ] Toggle button visible between viewer and chat area
|
|
704
|
+
- [ ] Smooth expand/collapse transitions
|
|
705
|
+
- [ ] Button position adjusts correctly
|
|
706
|
+
|
|
707
|
+
For detailed specifications, see [UI_DESIGN_STANDARDS.md](./UI_DESIGN_STANDARDS.md).
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
## 9. Verification Checklist
|
|
354
712
|
|
|
355
713
|
### Installation Verification
|
|
356
714
|
- [ ] All packages installed without errors
|
|
@@ -423,7 +781,7 @@ curl "http://localhost:3000/api/hazo_chat/messages?receiver_user_id=user-id"
|
|
|
423
781
|
|
|
424
782
|
---
|
|
425
783
|
|
|
426
|
-
##
|
|
784
|
+
## 10. Troubleshooting
|
|
427
785
|
|
|
428
786
|
### Error: "Module not found: Can't resolve 'fs'"
|
|
429
787
|
|
|
@@ -501,6 +859,49 @@ curl "http://localhost:3000/api/hazo_chat/messages?receiver_user_id=user-id"
|
|
|
501
859
|
3. Check for JavaScript errors in console
|
|
502
860
|
4. Verify API returns `{ success: true, messages: [] }` format
|
|
503
861
|
|
|
862
|
+
### Issue: UI components not styled correctly
|
|
863
|
+
|
|
864
|
+
**Possible Causes:**
|
|
865
|
+
1. Tailwind CSS not configured to include hazo_chat package paths
|
|
866
|
+
2. CSS variables not defined in globals.css
|
|
867
|
+
3. Missing UI dependencies
|
|
868
|
+
|
|
869
|
+
**Solution:**
|
|
870
|
+
1. Ensure `tailwind.config.ts` includes: `'./node_modules/hazo_chat/dist/**/*.{js,ts,jsx,tsx}'` in content array
|
|
871
|
+
2. Verify all required CSS variables are defined (see Step 6.5)
|
|
872
|
+
3. Check that `@tailwind base`, `@tailwind components`, `@tailwind utilities` are in globals.css
|
|
873
|
+
4. Rebuild: `rm -rf .next` and `npm run build`
|
|
874
|
+
|
|
875
|
+
### Issue: Alert Dialog not working
|
|
876
|
+
|
|
877
|
+
**Cause:** Alert Dialog component not created or not properly imported.
|
|
878
|
+
|
|
879
|
+
**Solution:**
|
|
880
|
+
1. Create Alert Dialog component at `src/components/ui/alert-dialog.tsx`
|
|
881
|
+
2. See `test-app/src/components/ui/alert-dialog.tsx` for reference
|
|
882
|
+
3. Ensure `@radix-ui/react-alert-dialog` is installed
|
|
883
|
+
4. Verify component exports all required sub-components
|
|
884
|
+
|
|
885
|
+
### Issue: Toast notifications not appearing
|
|
886
|
+
|
|
887
|
+
**Cause:** Sonner Toaster not added to root layout.
|
|
888
|
+
|
|
889
|
+
**Solution:**
|
|
890
|
+
1. Import `Toaster` from `sonner` in root layout
|
|
891
|
+
2. Add `<Toaster position="top-right" richColors />` to layout body
|
|
892
|
+
3. Ensure `sonner` package is installed
|
|
893
|
+
4. Check browser console for errors
|
|
894
|
+
|
|
895
|
+
### Issue: CSS variables not applying
|
|
896
|
+
|
|
897
|
+
**Cause:** CSS variables not defined or Tailwind not processing them.
|
|
898
|
+
|
|
899
|
+
**Solution:**
|
|
900
|
+
1. Verify CSS variables are in `globals.css` under `@layer base { :root { ... } }`
|
|
901
|
+
2. Check that Tailwind config has correct content paths
|
|
902
|
+
3. Ensure CSS file is imported in root layout
|
|
903
|
+
4. Rebuild CSS: restart dev server or rebuild
|
|
904
|
+
|
|
504
905
|
---
|
|
505
906
|
|
|
506
907
|
## Quick Setup Summary
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# UI Design Standards for hazo_chat
|
|
2
|
+
|
|
3
|
+
This document defines the visual design standards and component behavior specifications for the hazo_chat component library. All consuming projects should follow these standards to ensure consistent UI appearance and behavior.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Visual Design Elements
|
|
8
|
+
|
|
9
|
+
### Document Preview Icon
|
|
10
|
+
|
|
11
|
+
**Location:** Empty state in document viewer (`HazoChatDocumentViewer`)
|
|
12
|
+
|
|
13
|
+
**Specification:**
|
|
14
|
+
- Icon: `IoDocumentOutline` (from `react-icons/io5`)
|
|
15
|
+
- Size: `w-12 h-12` (48px × 48px)
|
|
16
|
+
- Opacity: `opacity-50`
|
|
17
|
+
- Text: "Select a document to preview" in `text-sm`
|
|
18
|
+
|
|
19
|
+
**File Reference:** `src/components/hazo_chat/hazo_chat_document_viewer.tsx` (EmptyState component)
|
|
20
|
+
|
|
21
|
+
### REFERENCES Section Font
|
|
22
|
+
|
|
23
|
+
**Location:** References section header (`hazo_chat.tsx`)
|
|
24
|
+
|
|
25
|
+
**Specification:**
|
|
26
|
+
- Font size: `text-[9px]` (9px)
|
|
27
|
+
- Font weight: `font-medium`
|
|
28
|
+
- Text transform: `uppercase`
|
|
29
|
+
- Letter spacing: `tracking-wider`
|
|
30
|
+
- Color: `text-muted-foreground`
|
|
31
|
+
|
|
32
|
+
**File Reference:** `src/components/hazo_chat/hazo_chat.tsx` (line ~299)
|
|
33
|
+
|
|
34
|
+
### Input Area Padding
|
|
35
|
+
|
|
36
|
+
**Location:** Chat input container (`HazoChatInput`)
|
|
37
|
+
|
|
38
|
+
**Specification:**
|
|
39
|
+
- Padding: `p-4` (16px on all sides)
|
|
40
|
+
- Border: `border-t` (top border only)
|
|
41
|
+
- Background: `bg-background`
|
|
42
|
+
|
|
43
|
+
**File Reference:** `src/components/hazo_chat/hazo_chat_input.tsx` (line ~107)
|
|
44
|
+
|
|
45
|
+
### Message Timestamp Display
|
|
46
|
+
|
|
47
|
+
**Location:** Chat bubble footer (`ChatBubble`)
|
|
48
|
+
|
|
49
|
+
**Specification:**
|
|
50
|
+
- Only timestamp is displayed (no status icons for sent/unread messages)
|
|
51
|
+
- Font size: `text-xs`
|
|
52
|
+
- Color: `text-muted-foreground`
|
|
53
|
+
- Format: 24-hour format (e.g., "10:37 AM", "15:51")
|
|
54
|
+
- Timezone: Respects `timezone` prop (default: "GMT+10")
|
|
55
|
+
|
|
56
|
+
**File Reference:** `src/components/ui/chat_bubble.tsx` (line ~264)
|
|
57
|
+
|
|
58
|
+
### Read Receipt Indicator
|
|
59
|
+
|
|
60
|
+
**Location:** Chat bubble footer, after timestamp (`ChatBubble`)
|
|
61
|
+
|
|
62
|
+
**Specification:**
|
|
63
|
+
- Icon: `IoCheckmarkDoneSharp` (from `react-icons/io5`)
|
|
64
|
+
- Size: `h-4 w-4` (16px × 16px)
|
|
65
|
+
- Color: `text-green-500`
|
|
66
|
+
- Display condition: Only shown when `read_at` is not null AND message is from sender
|
|
67
|
+
- Position: After timestamp with `gap-1` spacing
|
|
68
|
+
|
|
69
|
+
**File Reference:** `src/components/ui/chat_bubble.tsx` (line ~267)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Component Behavior
|
|
74
|
+
|
|
75
|
+
### Close Button
|
|
76
|
+
|
|
77
|
+
**Location:** Chat header (`HazoChatHeader`)
|
|
78
|
+
|
|
79
|
+
**Specification:**
|
|
80
|
+
- Visibility: Always visible when `on_close` prop is provided to `HazoChat` component
|
|
81
|
+
- Icon: `IoClose` (from `react-icons/io5`)
|
|
82
|
+
- Size: `h-8 w-8` (32px × 32px)
|
|
83
|
+
- Variant: `ghost`
|
|
84
|
+
- Hover state: `hover:bg-destructive/10 hover:text-destructive`
|
|
85
|
+
- Position: Top-right of header, after refresh button
|
|
86
|
+
|
|
87
|
+
**File Reference:** `src/components/hazo_chat/hazo_chat_header.tsx` (line ~124-147)
|
|
88
|
+
|
|
89
|
+
### Hamburger Menu Button
|
|
90
|
+
|
|
91
|
+
**Location:** Chat header (`HazoChatHeader`)
|
|
92
|
+
|
|
93
|
+
**Specification:**
|
|
94
|
+
- Desktop behavior: Hidden (`md:hidden` class)
|
|
95
|
+
- Mobile behavior: Visible on screens < 768px
|
|
96
|
+
- Purpose: Toggle document viewer sidebar on mobile
|
|
97
|
+
- Icon: `IoMenuOutline` (from `react-icons/io5`)
|
|
98
|
+
- Size: `h-8 w-8` (32px × 32px)
|
|
99
|
+
- Position: Top-left of header, before title
|
|
100
|
+
|
|
101
|
+
**Important:** If hamburger button appears on desktop, check Tailwind CSS configuration and ensure `md:` breakpoint utilities are working correctly.
|
|
102
|
+
|
|
103
|
+
**File Reference:** `src/components/hazo_chat/hazo_chat_header.tsx` (line ~54-77)
|
|
104
|
+
|
|
105
|
+
### Document Viewer Toggle Button
|
|
106
|
+
|
|
107
|
+
**Location:** Between document viewer and chat area (`hazo_chat.tsx`)
|
|
108
|
+
|
|
109
|
+
**Specification:**
|
|
110
|
+
- Icon: Chevron (`IoChevronBack` when expanded, `IoChevronForward` when collapsed)
|
|
111
|
+
- Size: `h-8 w-6` (32px height × 24px width)
|
|
112
|
+
- Position: Absolute, vertically centered between columns
|
|
113
|
+
- Variant: `outline`
|
|
114
|
+
- Border: `rounded-r-md rounded-l-none border-l-0`
|
|
115
|
+
- Behavior: Smooth transitions with `transition-all duration-300`
|
|
116
|
+
- Desktop: Visible when document viewer column is present
|
|
117
|
+
- Mobile: Hidden when sidebar is closed
|
|
118
|
+
|
|
119
|
+
**File Reference:** `src/components/hazo_chat/hazo_chat.tsx` (line ~344-367)
|
|
120
|
+
|
|
121
|
+
### References Section Collapse/Expand
|
|
122
|
+
|
|
123
|
+
**Location:** References row (`hazo_chat.tsx`)
|
|
124
|
+
|
|
125
|
+
**Specification:**
|
|
126
|
+
- Collapsed height: `max-h-8`
|
|
127
|
+
- Expanded height: `max-h-96`
|
|
128
|
+
- Transition: `transition-all duration-300 ease-in-out`
|
|
129
|
+
- Indicator: Chevron icon (`IoChevronDown` when collapsed, `IoChevronUp` when expanded)
|
|
130
|
+
- Default state: Collapsed when no references, expanded when references exist
|
|
131
|
+
- Auto-expand: Automatically expands when references are added
|
|
132
|
+
|
|
133
|
+
**File Reference:** `src/components/hazo_chat/hazo_chat.tsx` (line ~288-318)
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Layout Standards
|
|
138
|
+
|
|
139
|
+
### Chat Input Area
|
|
140
|
+
|
|
141
|
+
**Location:** Bottom of chat component (`HazoChatInput`)
|
|
142
|
+
|
|
143
|
+
**Specification:**
|
|
144
|
+
- Layout: Flex container with `flex items-center gap-2`
|
|
145
|
+
- Components:
|
|
146
|
+
- Single `Input` field (replaces previous Textarea)
|
|
147
|
+
- Send button (`Button` with `IoSend` icon)
|
|
148
|
+
- No attachment buttons: Attachment/image buttons removed for simplified design
|
|
149
|
+
- Input padding: `p-4` on container
|
|
150
|
+
- Button alignment: Aligned with input height using flex
|
|
151
|
+
|
|
152
|
+
**File Reference:** `src/components/hazo_chat/hazo_chat_input.tsx` (line ~119-144)
|
|
153
|
+
|
|
154
|
+
### Button Alignment and Sizing
|
|
155
|
+
|
|
156
|
+
**Specification:**
|
|
157
|
+
- Send button: Standard button size, aligned with input
|
|
158
|
+
- All interactive buttons: Consistent sizing for visual harmony
|
|
159
|
+
- Icon sizes within buttons: `w-4 h-4` (16px × 16px)
|
|
160
|
+
|
|
161
|
+
### Responsive Breakpoints
|
|
162
|
+
|
|
163
|
+
**Specification:**
|
|
164
|
+
- Mobile: < 768px (default)
|
|
165
|
+
- Desktop: >= 768px (`md:` prefix)
|
|
166
|
+
- Standard Tailwind breakpoints used throughout
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Color and Theming
|
|
171
|
+
|
|
172
|
+
### Required CSS Variables
|
|
173
|
+
|
|
174
|
+
The following CSS variables must be defined in the consuming project's global CSS file:
|
|
175
|
+
|
|
176
|
+
**Core Colors:**
|
|
177
|
+
- `--background`
|
|
178
|
+
- `--foreground`
|
|
179
|
+
- `--primary` / `--primary-foreground`
|
|
180
|
+
- `--secondary` / `--secondary-foreground`
|
|
181
|
+
- `--muted` / `--muted-foreground`
|
|
182
|
+
- `--accent` / `--accent-foreground`
|
|
183
|
+
- `--destructive` / `--destructive-foreground`
|
|
184
|
+
|
|
185
|
+
**Border and Input:**
|
|
186
|
+
- `--border`
|
|
187
|
+
- `--input`
|
|
188
|
+
- `--ring`
|
|
189
|
+
|
|
190
|
+
**Card:**
|
|
191
|
+
- `--card` / `--card-foreground`
|
|
192
|
+
|
|
193
|
+
**Reference:** See `test-app/src/app/globals.css` for complete variable definitions.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Typography
|
|
198
|
+
|
|
199
|
+
### Font Families
|
|
200
|
+
|
|
201
|
+
**Primary:** System font stack or custom font via `--font-sans` CSS variable
|
|
202
|
+
|
|
203
|
+
**Monospace:** System monospace or custom font via `--font-mono` CSS variable
|
|
204
|
+
|
|
205
|
+
### Font Sizes
|
|
206
|
+
|
|
207
|
+
- Header title: `text-sm` (14px)
|
|
208
|
+
- Header subtitle: `text-xs` (12px)
|
|
209
|
+
- Message text: `text-sm` (14px)
|
|
210
|
+
- Timestamp: `text-xs` (12px)
|
|
211
|
+
- References header: `text-[9px]` (9px)
|
|
212
|
+
- Empty state text: `text-sm` (14px)
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Spacing and Padding
|
|
217
|
+
|
|
218
|
+
### Standard Padding Values
|
|
219
|
+
|
|
220
|
+
- Container padding: `p-4` (16px)
|
|
221
|
+
- Header padding: `px-4` (16px horizontal)
|
|
222
|
+
- Message bubble padding: `px-4 py-2` (16px horizontal, 8px vertical)
|
|
223
|
+
- Gap between elements: `gap-2` (8px) or `gap-1` (4px) for tight spacing
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Animation and Transitions
|
|
228
|
+
|
|
229
|
+
### Standard Transitions
|
|
230
|
+
|
|
231
|
+
- Component state changes: `transition-all duration-300`
|
|
232
|
+
- Hover states: `transition-colors`
|
|
233
|
+
- Smooth animations for expand/collapse: `ease-in-out`
|
|
234
|
+
|
|
235
|
+
### Loading States
|
|
236
|
+
|
|
237
|
+
- Skeleton loaders for initial message load
|
|
238
|
+
- Spinner animation for refresh button when loading
|
|
239
|
+
- Pulse animation removed from status indicators
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Accessibility
|
|
244
|
+
|
|
245
|
+
### ARIA Labels
|
|
246
|
+
|
|
247
|
+
All interactive elements must have appropriate ARIA labels:
|
|
248
|
+
|
|
249
|
+
- Input fields: `aria-label="Message input"`
|
|
250
|
+
- Buttons: `aria-label` describing action (e.g., "Send message", "Refresh chat history")
|
|
251
|
+
- Close button: `aria-label="Close chat"`
|
|
252
|
+
- Toggle buttons: `aria-label` and `aria-expanded` attributes
|
|
253
|
+
|
|
254
|
+
### Keyboard Navigation
|
|
255
|
+
|
|
256
|
+
- Send message: Enter key
|
|
257
|
+
- Close dialogs: Escape key (handled by Alert Dialog component)
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Component Dependencies
|
|
262
|
+
|
|
263
|
+
### Required External Components
|
|
264
|
+
|
|
265
|
+
The following components must be available in consuming projects:
|
|
266
|
+
|
|
267
|
+
1. **AlertDialog** (shadcn/ui style)
|
|
268
|
+
- Used for user acknowledgment dialogs
|
|
269
|
+
- Not included in hazo_chat package
|
|
270
|
+
- Must be created by consuming project
|
|
271
|
+
|
|
272
|
+
2. **Toaster** (from `sonner` package)
|
|
273
|
+
- Used for toast notifications (FYI messages)
|
|
274
|
+
- Must be added to root layout
|
|
275
|
+
- Position: `top-right`
|
|
276
|
+
- Configuration: `richColors` prop enabled
|
|
277
|
+
|
|
278
|
+
### Included Components
|
|
279
|
+
|
|
280
|
+
The following UI components are included in hazo_chat package:
|
|
281
|
+
|
|
282
|
+
- Button
|
|
283
|
+
- Input
|
|
284
|
+
- Textarea
|
|
285
|
+
- Avatar
|
|
286
|
+
- ScrollArea
|
|
287
|
+
- Tooltip
|
|
288
|
+
- Separator
|
|
289
|
+
- Badge
|
|
290
|
+
- ChatBubble (chat-specific)
|
|
291
|
+
- LoadingSkeleton (chat-specific)
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Example Reference
|
|
296
|
+
|
|
297
|
+
For complete implementation examples, see:
|
|
298
|
+
- `test-app/src/app/page.tsx` - Usage example
|
|
299
|
+
- `test-app/src/app/layout.tsx` - Toaster setup
|
|
300
|
+
- `test-app/src/components/ui/alert-dialog.tsx` - Alert Dialog implementation
|
|
301
|
+
- `test-app/src/app/globals.css` - CSS variables example
|
|
302
|
+
- `test-app/tailwind.config.ts` - Tailwind configuration example
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Version Information
|
|
307
|
+
|
|
308
|
+
**Document Version:** 1.0
|
|
309
|
+
**Last Updated:** 2024
|
|
310
|
+
**Applies to hazo_chat version:** 2.0.8+
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
For setup instructions, see [SETUP_CHECKLIST.md](./SETUP_CHECKLIST.md) and [README.md](./README.md).
|
|
315
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_bubble.d.ts","sourceRoot":"","sources":["../../../src/components/ui/chat_bubble.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"chat_bubble.d.ts","sourceRoot":"","sources":["../../../src/components/ui/chat_bubble.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,sBAAsB,CAAC;AA4C/E,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,SAAS,EACT,cAAc,EACd,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,cAAsB,EACtB,SAAS,EACV,EAAE,eAAe,2CA4JjB;yBArKe,UAAU"}
|
|
@@ -15,7 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
15
15
|
import { useState, useCallback } from 'react';
|
|
16
16
|
import { format } from 'date-fns';
|
|
17
17
|
import { toZonedTime } from 'date-fns-tz';
|
|
18
|
-
import { IoTrashOutline, IoDocumentAttachSharp } from 'react-icons/io5';
|
|
18
|
+
import { IoTrashOutline, IoDocumentAttachSharp, IoCheckmarkDoneSharp } from 'react-icons/io5';
|
|
19
19
|
import { cn } from '../../lib/utils.js';
|
|
20
20
|
import { DELETED_MESSAGE_PLACEHOLDER } from '../../lib/constants.js';
|
|
21
21
|
import { Avatar, AvatarImage, AvatarFallback } from './avatar.js';
|
|
@@ -78,7 +78,7 @@ export function ChatBubble({ message, is_sender, sender_profile, timezone, on_de
|
|
|
78
78
|
? 'bg-primary text-primary-foreground rounded-br-md'
|
|
79
79
|
: 'bg-muted text-foreground rounded-bl-md', is_deleted && 'opacity-60 italic'), children: [_jsx("p", { className: "cls_bubble_text text-sm whitespace-pre-wrap break-words", children: display_text }), has_references && !is_deleted && (_jsx("div", { className: "cls_bubble_references flex flex-wrap gap-1 mt-2 pt-2 border-t border-current/10", children: message.reference_list?.map((ref) => (_jsxs(Button, { variant: "ghost", size: "sm", onClick: () => handle_reference_click(ref), className: cn('cls_bubble_reference_btn', 'h-6 px-2 text-xs', is_sender
|
|
80
80
|
? 'hover:bg-primary-foreground/20'
|
|
81
|
-
: 'hover:bg-background/50'), children: [_jsx(IoDocumentAttachSharp, { className: "w-3 h-3 mr-1" }), _jsx("span", { className: "truncate max-w-[100px]", children: ref.name })] }, ref.id))) })), is_sender && !is_deleted && on_delete && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { variant: show_delete_confirm ? 'destructive' : 'ghost', size: "icon", onClick: handle_delete_click, className: cn('cls_bubble_delete_btn', 'absolute -left-8 top-1/2 -translate-y-1/2', 'w-6 h-6', 'opacity-0 group-hover:opacity-100 transition-opacity'), children: _jsx(IoTrashOutline, { className: "w-3.5 h-3.5" }) }) }), _jsx(TooltipContent, { children: show_delete_confirm ? 'Click again to confirm' : 'Delete message' })] }))] }),
|
|
81
|
+
: 'hover:bg-background/50'), children: [_jsx(IoDocumentAttachSharp, { className: "w-3 h-3 mr-1" }), _jsx("span", { className: "truncate max-w-[100px]", children: ref.name })] }, ref.id))) })), is_sender && !is_deleted && on_delete && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { variant: show_delete_confirm ? 'destructive' : 'ghost', size: "icon", onClick: handle_delete_click, className: cn('cls_bubble_delete_btn', 'absolute -left-8 top-1/2 -translate-y-1/2', 'w-6 h-6', 'opacity-0 group-hover:opacity-100 transition-opacity'), children: _jsx(IoTrashOutline, { className: "w-3.5 h-3.5" }) }) }), _jsx(TooltipContent, { children: show_delete_confirm ? 'Click again to confirm' : 'Delete message' })] }))] }), _jsxs("div", { className: cn('cls_bubble_meta', 'flex items-center gap-1 mt-1', is_sender ? 'justify-end mr-1' : 'ml-1'), children: [_jsx("span", { className: "cls_bubble_time text-xs text-muted-foreground", children: format_timestamp(message.created_at, timezone) }), is_sender && message.read_at && (_jsx(IoCheckmarkDoneSharp, { className: "h-4 w-4 text-green-500" }))] })] }), is_sender && (_jsxs(Avatar, { className: "cls_bubble_avatar h-8 w-8 ml-2 flex-shrink-0", children: [_jsx(AvatarImage, { src: sender_profile?.avatar_url, alt: "Your avatar" }), _jsx(AvatarFallback, { className: "text-xs bg-primary/20 text-primary", children: get_initials(sender_profile?.name) })] }))] }));
|
|
82
82
|
}
|
|
83
83
|
ChatBubble.displayName = 'ChatBubble';
|
|
84
84
|
//# sourceMappingURL=chat_bubble.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_bubble.js","sourceRoot":"","sources":["../../../src/components/ui/chat_bubble.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,qBAAqB,
|
|
1
|
+
{"version":3,"file":"chat_bubble.js","sourceRoot":"","sources":["../../../src/components/ui/chat_bubble.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;GAEG;AACH,SAAS,gBAAgB,CAAC,SAAiB,EAAE,QAAgB;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iBAAiB,EACjB,8BAA8B,EAC9B,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CACxC,aAED,eAAM,SAAS,EAAC,+CAA+C,YAC5D,gBAAgB,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,GAC1C,EACN,SAAS,IAAI,OAAO,CAAC,OAAO,IAAI,CAC/B,KAAC,oBAAoB,IAAC,SAAS,EAAC,wBAAwB,GAAG,CAC5D,IACG,IACF,EAGL,SAAS,IAAI,CACZ,MAAC,MAAM,IAAC,SAAS,EAAC,8CAA8C,aAC9D,KAAC,WAAW,IACV,GAAG,EAAE,cAAc,EAAE,UAAU,EAC/B,GAAG,EAAC,aAAa,GACjB,EACF,KAAC,cAAc,IAAC,SAAS,EAAC,oCAAoC,YAC3D,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC,GACpB,IACV,CACV,IACG,CACP,CAAC;AACJ,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_chat",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "Chat interface for 1-1 communication with API-first architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
33
|
"README.md",
|
|
34
|
-
"SETUP_CHECKLIST.md"
|
|
34
|
+
"SETUP_CHECKLIST.md",
|
|
35
|
+
"UI_DESIGN_STANDARDS.md"
|
|
35
36
|
],
|
|
36
37
|
"workspaces": [
|
|
37
38
|
"test-app"
|