|
1 | 1 | <script module lang="ts"> |
2 | 2 | import { defineMeta } from '@storybook/addon-svelte-csf'; |
3 | | - import { ChatConversationsItem } from '$lib/components'; |
4 | | - import type { Conversation } from '$lib/types/conversation'; |
| 3 | + import { ChatSidebarConversationItem } from '$lib/components'; |
| 4 | + import type { DatabaseConversation } from '$lib/types/database'; |
5 | 5 |
|
6 | 6 | const { Story } = defineMeta({ |
7 | | - title: 'Components/ChatSidebar/ChatConversationItem', |
8 | | - component: ChatConversationsItem, |
| 7 | + title: 'Components/ChatSidebar/ChatSidebarConversationItem', |
| 8 | + component: ChatSidebarConversationItem, |
9 | 9 | parameters: { |
10 | 10 | layout: 'centered' |
11 | 11 | } |
12 | 12 | }); |
13 | 13 |
|
14 | | - const sampleConversation: Conversation = { |
| 14 | + const sampleConversation: DatabaseConversation = { |
15 | 15 | id: '1', |
16 | 16 | name: 'Hello World Chat', |
17 | 17 | lastModified: Date.now() - 1000 * 60 * 5, // 5 minutes ago |
18 | | - messageCount: 12 |
| 18 | + currNode: null, |
19 | 19 | }; |
20 | 20 |
|
21 | | - const longNameConversation: Conversation = { |
| 21 | + const longNameConversation: DatabaseConversation = { |
22 | 22 | id: '2', |
23 | 23 | name: 'This is a very long conversation name that should be truncated when displayed in the sidebar', |
24 | 24 | lastModified: Date.now() - 1000 * 60 * 60 * 2, // 2 hours ago |
25 | | - messageCount: 24 |
| 25 | + currNode: null, |
26 | 26 | }; |
27 | 27 |
|
28 | | - const recentConversation: Conversation = { |
| 28 | + const recentConversation: DatabaseConversation = { |
29 | 29 | id: '3', |
30 | 30 | name: 'Recent Chat', |
31 | 31 | lastModified: Date.now() - 1000 * 30, // 30 seconds ago |
32 | | - messageCount: 3 |
| 32 | + currNode: null, |
33 | 33 | }; |
34 | 34 | </script> |
35 | 35 |
|
36 | 36 | <Story |
37 | 37 | name="Default" |
38 | 38 | args={{ |
39 | 39 | conversation: sampleConversation, |
40 | | - class: 'w-80' |
41 | 40 | }} |
42 | 41 | /> |
43 | 42 |
|
|
46 | 45 | args={{ |
47 | 46 | conversation: sampleConversation, |
48 | 47 | isActive: true, |
49 | | - class: 'w-80' |
50 | 48 | }} |
51 | 49 | /> |
52 | 50 |
|
53 | 51 | <Story |
54 | 52 | name="LongName" |
55 | 53 | args={{ |
56 | 54 | conversation: longNameConversation, |
57 | | - class: 'w-80' |
58 | 55 | }} |
59 | 56 | /> |
60 | 57 |
|
61 | 58 | <Story |
62 | 59 | name="Recent" |
63 | 60 | args={{ |
64 | 61 | conversation: recentConversation, |
65 | | - class: 'w-80' |
66 | 62 | }} |
67 | 63 | /> |
68 | 64 |
|
69 | 65 | <Story |
70 | 66 | name="WithActions" |
71 | 67 | args={{ |
72 | 68 | conversation: sampleConversation, |
73 | | - class: 'w-80', |
74 | 69 | onSelect: (id: string) => console.log('Selected:', id), |
75 | 70 | onEdit: (id: string) => console.log('Edit:', id), |
76 | 71 | onDelete: (id: string) => console.log('Delete:', id) |
|
0 commit comments