@webinex/chatify 1.0.2-rc3 → 1.0.3-rc3

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.
Files changed (40) hide show
  1. package/dist/css/chatify.css +249 -143
  2. package/dist/esm/index.js +1 -1
  3. package/dist/esm/index.js.map +1 -1
  4. package/dist/esm/types/core/action.d.ts +1 -0
  5. package/dist/esm/types/core/useAddChatMutation.d.ts +1 -1
  6. package/dist/esm/types/ui/ChatList/ChatListItemLastMessageSentAt.d.ts +3 -0
  7. package/dist/esm/types/ui/ChatList/index.d.ts +1 -0
  8. package/dist/esm/types/ui/Chatify.d.ts +2 -1
  9. package/dist/esm/types/ui/Icon.d.ts +6 -5
  10. package/dist/esm/types/ui/localizer.d.ts +2 -0
  11. package/dist/index.d.ts +13 -6
  12. package/package.json +1 -1
  13. package/src/core/action.tsx +11 -1
  14. package/src/core/useAddChatMutation.tsx +9 -3
  15. package/src/core/useGetChatQuery.tsx +1 -1
  16. package/src/styles/aside.scss +59 -21
  17. package/src/styles/chat.scss +81 -92
  18. package/src/styles/index.scss +34 -5
  19. package/src/styles/input.scss +72 -0
  20. package/src/styles/variables.scss +4 -4
  21. package/src/ui/AddChatButton.tsx +5 -3
  22. package/src/ui/ChatList/ChatListItemLastMessage.tsx +2 -0
  23. package/src/ui/ChatList/ChatListItemLastMessageSentAt.tsx +22 -0
  24. package/src/ui/ChatList/index.ts +1 -0
  25. package/src/ui/ChatPanel/ChatHeader.tsx +3 -5
  26. package/src/ui/ChatPanel/ChatHeaderMembers.tsx +6 -4
  27. package/src/ui/ChatPanel/ChatHeaderName.tsx +17 -15
  28. package/src/ui/ChatPanel/ChatMembersButton.tsx +1 -1
  29. package/src/ui/ChatPanel/ChatMembersPanel.tsx +8 -4
  30. package/src/ui/Chatify.tsx +11 -5
  31. package/src/ui/CreateChatPanel/CreateChatPanel.tsx +20 -4
  32. package/src/ui/Icon.tsx +7 -5
  33. package/src/ui/InputBox/InputTextBox.tsx +2 -1
  34. package/src/ui/Layout/Aside.tsx +2 -0
  35. package/src/ui/Layout/Header.tsx +1 -6
  36. package/src/ui/Message/MessageContent.tsx +0 -2
  37. package/src/ui/Message/MessageInfoBox.tsx +1 -0
  38. package/src/ui/Message/MessageRow.tsx +5 -1
  39. package/src/ui/localizer.tsx +4 -0
  40. package/src/styles/settings.scss +0 -5
@@ -10,57 +10,85 @@
10
10
  flex-flow: column nowrap;
11
11
 
12
12
  .wxchtf-chat-header {
13
- border-bottom: $border;
14
- padding: 0.5rem 1rem;
13
+ padding: 15px 20px;
14
+ line-height: 24px;
15
+ z-index: 1;
16
+ box-shadow: 0px 2px 4px 0px rgba(88, 99, 107, 0.04), 0px 1px 9px -1px rgba(88, 99, 107, 0.04),
17
+ 0px 1px 2px 0px rgba(88, 99, 107, 0.06);
15
18
 
16
19
  .wxchtf-chat-name {
17
20
  font-weight: 600;
21
+ font-size: 16px;
18
22
  flex: none;
19
23
 
20
24
  &.--editable {
21
25
  cursor: pointer;
22
26
  }
23
27
  }
28
+
29
+ .wxchtf-chat-members {
30
+ display: inline-flex;
31
+ gap: 6px;
32
+ }
24
33
  }
25
34
 
26
35
  .wxchtf-chat-body {
27
36
  flex: 1 1 auto;
28
37
  height: 100px;
29
38
  overflow-y: auto;
30
- background: $chatBodyBackground;
39
+ background: white;
31
40
  padding: 2rem 1rem;
41
+ padding-right: 1rem;
32
42
  display: flex;
33
43
  flex-flow: column-reverse nowrap;
44
+ align-items: center;
34
45
 
35
46
  @include scrollbar();
36
47
 
37
- @media only screen and (min-width: 1120px) {
38
- padding-right: 30%;
48
+ .wxchtf-message,
49
+ .wxchtf-sending-message,
50
+ .wxchtf-system-message,
51
+ .wxchtf-message-skeleton {
52
+ margin-bottom: 8px;
53
+ max-width: $messageBoxWidth;
54
+ width: 100%;
55
+
56
+ &:first-child {
57
+ margin-bottom: 0;
58
+ }
39
59
  }
40
60
 
41
61
  .wxchtf-message,
42
62
  .wxchtf-sending-message {
43
63
  display: flex;
44
64
  flex-flow: row nowrap;
45
- width: 100%;
46
- align-items: flex-end;
65
+ align-items: flex-start;
66
+
67
+ &:not(.--my) {
68
+ .wxchtf-message-content,
69
+ .wxchtf-sending-message-content {
70
+ border-bottom-left-radius: 0;
71
+ }
72
+ }
47
73
 
48
74
  &.--my {
49
75
  direction: rtl;
50
76
  justify-content: flex-start;
51
77
 
52
78
  .wxchtf-message-author {
53
- margin-right: 0;
54
- margin-left: 15px;
79
+ display: none;
55
80
  }
56
81
 
57
82
  .wxchtf-message-content,
58
83
  .wxchtf-sending-message-content {
59
84
  direction: ltr;
60
- border-bottom-left-radius: 10px;
61
85
  border-bottom-right-radius: 0;
62
86
  background-color: $myMessageBackground;
63
87
  }
88
+
89
+ .wxchtf-message-info-box {
90
+ text-align: right;
91
+ }
64
92
  }
65
93
 
66
94
  .wxchtf-message-author {
@@ -68,42 +96,45 @@
68
96
 
69
97
  .ant-avatar {
70
98
  @include avatarSize($avatarSize);
71
- box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
99
+ }
100
+ }
101
+
102
+ .wxchtf-message-info-box,
103
+ .wxchtf-sending-message-info-box {
104
+ text-align: left;
105
+ margin-bottom: 3px;
106
+
107
+ .wxchtf-message-author-name,
108
+ .wxchtf-message-sent-at,
109
+ .wxchtf-message-read-box,
110
+ .wxchtf-sending-message-sending-box {
111
+ display: inline-block;
112
+ font-size: 0.85em;
113
+ opacity: 0.5;
114
+ }
115
+
116
+ .wxchtf-message-sent-at,
117
+ .wxchtf-message-read-box,
118
+ .wxchtf-sending-message-sending-box {
119
+ margin-left: 5px;
72
120
  }
73
121
  }
74
122
 
75
123
  .wxchtf-message-content,
76
124
  .wxchtf-sending-message-content {
125
+ width: fit-content;
77
126
  min-width: 300px;
78
127
  max-width: 70%;
79
- border-radius: $messageBorderRadius;
80
- padding: 0.75rem 1rem;
128
+ padding: 12px 19px;
81
129
  background: white;
82
- border-bottom-left-radius: 0;
83
130
  background-color: $messageBackground;
84
- box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
85
131
  display: block;
86
132
  white-space: pre-wrap;
87
133
  overflow-wrap: break-word;
134
+ border-radius: 24px;
88
135
 
89
- .wxchtf-message-info-box,
90
- .wxchtf-sending-message-info-box {
91
- text-align: right;
92
-
93
- .wxchtf-message-sent-at,
94
- .wxchtf-message-read-box,
95
- .wxchtf-sending-message-sending-box {
96
- display: inline-block;
97
- font-style: italic;
98
- font-size: 0.75em;
99
- margin-top: 0.5rem;
100
- opacity: 0.5;
101
- }
102
-
103
- .wxchtf-message-read-box,
104
- .wxchtf-sending-message-sending-box {
105
- margin-left: 5px;
106
- }
136
+ .wxchtf-message-text {
137
+ line-height: 21px;
107
138
  }
108
139
  }
109
140
  }
@@ -112,27 +143,31 @@
112
143
  font-style: italic;
113
144
  position: relative;
114
145
  text-align: center;
146
+ color: #0e0f1799;
115
147
 
116
148
  .wxchtf-text,
117
149
  .wxchtf-timestamp {
150
+ position: relative;
151
+ z-index: 1;
152
+ padding-inline: 8px;
118
153
  display: inline-block;
119
- opacity: 0.9;
120
154
  font-size: 0.85em;
155
+ background-color: white;
121
156
  }
122
157
 
123
158
  .wxchtf-timestamp {
124
- margin-left: 1rem;
159
+ padding-left: 10px;
125
160
  }
126
- }
127
-
128
- .wxchtf-message,
129
- .wxchtf-sending-message,
130
- .wxchtf-system-message,
131
- .wxchtf-message-skeleton {
132
- margin-bottom: 2rem;
133
161
 
134
- &:first-child {
135
- margin-bottom: 0;
162
+ &::after {
163
+ content: '';
164
+ position: absolute;
165
+ height: 1px;
166
+ width: 100%;
167
+ left: 0;
168
+ top: 50%;
169
+ z-index: 0;
170
+ background-color: #0000000f;
136
171
  }
137
172
  }
138
173
 
@@ -159,62 +194,16 @@
159
194
  }
160
195
  }
161
196
  }
162
-
163
- .wxchtf-input-form {
164
- flex: none;
165
- max-height: 300px;
166
- display: flex;
167
- flex-flow: column nowrap;
168
-
169
- .wxchtf-input-box {
170
- flex: none;
171
- display: flex;
172
- flex-flow: row nowrap;
173
- padding: 1rem 0;
174
- border-top: $border;
175
-
176
- @mixin iconBtn {
177
- flex: none;
178
- display: flex;
179
- padding: 0 1rem;
180
- align-items: flex-end;
181
-
182
- .ant-btn.ant-btn-icon-only .anticon {
183
- font-size: 1.5rem;
184
- }
185
- }
186
-
187
- .wxchtf-add-files-box {
188
- @include iconBtn();
189
- }
190
-
191
- .wxchtf-text-input-box {
192
- flex: auto;
193
-
194
- textarea {
195
- resize: none;
196
- border: none;
197
- outline: none;
198
- box-shadow: none;
199
-
200
- @include scrollbar();
201
- }
202
- }
203
-
204
- .wxchtf-submit-btn-box {
205
- @include iconBtn();
206
- }
207
- }
208
- }
209
197
  }
210
198
 
211
199
  .wxchtf-chat-members-panel {
212
200
  min-width: 300px;
213
- border-left: $border;
201
+ box-shadow: -4px 0px 20px -5px #0cd9e214, -2px 1px 12px #006e720f;
214
202
 
215
203
  .wxchtf-chat-members-list {
216
204
  .wxchtf-chat-members-list-item {
217
205
  padding-inline: 1rem;
206
+ border-block-end: none;
218
207
  }
219
208
  }
220
209
  }
@@ -2,11 +2,10 @@
2
2
  @import './mixins.scss';
3
3
  @import './keyframes.scss';
4
4
  @import './aside.scss';
5
- @import './settings.scss';
6
5
  @import './chat.scss';
6
+ @import './input.scss';
7
7
 
8
8
  .wxchtf-chatify {
9
- border: $border;
10
9
  display: flex;
11
10
  flex-flow: column nowrap;
12
11
  background: $background;
@@ -14,7 +13,6 @@
14
13
 
15
14
  .wxchtf-header {
16
15
  min-height: 2rem;
17
- border-bottom: $border;
18
16
  }
19
17
 
20
18
  .wxchtf-body {
@@ -25,7 +23,26 @@
25
23
 
26
24
  .wxchtf-footer {
27
25
  min-height: 2rem;
28
- border-top: $border;
26
+ }
27
+
28
+ .wxchtf-add-btn-wrapper {
29
+ width: 100%;
30
+ text-align: right;
31
+ padding-inline: 0.5rem;
32
+ margin-bottom: 1rem;
33
+
34
+ .wxchtf-add-btn {
35
+ border: none;
36
+ background-color: #e4f7f7;
37
+ height: 50px;
38
+ padding: 0;
39
+ line-height: 50px;
40
+ min-width: 150px;
41
+ border-radius: 50px;
42
+ font-weight: 600;
43
+ opacity: 0.9;
44
+ box-shadow: none;
45
+ }
29
46
  }
30
47
  }
31
48
 
@@ -33,13 +50,24 @@
33
50
  flex: auto;
34
51
  display: flex;
35
52
  flex-flow: column nowrap;
53
+ border-top-right-radius: $radius;
54
+ border-bottom-right-radius: $radius;
55
+ box-shadow: 0px 6px 30px 0px #0cd9e214, 0px 1px 12px 0px #006e720f;
56
+ z-index: 2;
36
57
 
37
- .wxchtf-create-chat {
58
+ .wxchtf-create-chat-panel {
38
59
  display: flex;
39
60
  flex-flow: column nowrap;
40
61
  justify-content: center;
41
62
  align-items: center;
42
63
  height: 100%;
64
+ position: relative;
65
+
66
+ .wxchtf-create-chat-panel-close {
67
+ position: absolute;
68
+ right: 25px;
69
+ top: 25px;
70
+ }
43
71
 
44
72
  form {
45
73
  padding: 2rem;
@@ -49,6 +77,7 @@
49
77
  .wxchtf-create-chat-member-input-list {
50
78
  max-height: 15rem;
51
79
  overflow-y: auto;
80
+ @include scrollbar();
52
81
 
53
82
  .ant-list-item {
54
83
  padding-inline: 0.5rem;
@@ -0,0 +1,72 @@
1
+ .wxchtf-input-form {
2
+ flex: none;
3
+ max-height: 300px;
4
+ display: flex;
5
+ flex-flow: column nowrap;
6
+ padding: 12px 20px 20px 20px;
7
+
8
+ .wxchtf-input-box {
9
+ flex: none;
10
+ display: flex;
11
+ flex-flow: row nowrap;
12
+ padding: 8px;
13
+ max-width: $messageBoxWidth;
14
+ width: 100%;
15
+ margin: auto;
16
+ background: rgba(245, 245, 245, 1);
17
+ border-radius: 40px;
18
+
19
+ @mixin iconBtn {
20
+ flex: none;
21
+ display: flex;
22
+ padding: 0 1rem;
23
+ align-items: flex-end;
24
+
25
+ .ant-btn.ant-btn-icon-only .anticon {
26
+ font-size: 1.5rem;
27
+ }
28
+ }
29
+
30
+ .wxchtf-add-files-box,
31
+ .wxchtf-submit-btn-box {
32
+ align-items: center;
33
+
34
+ button {
35
+ width: unset;
36
+ }
37
+
38
+ svg {
39
+ font-size: 18px;
40
+ color: rgba(14, 15, 23, 0.25);
41
+ }
42
+ }
43
+
44
+ .wxchtf-add-files-box {
45
+ @include iconBtn();
46
+ }
47
+
48
+ .wxchtf-text-input-box {
49
+ flex: auto;
50
+ margin-left: 16px;
51
+ margin-right: 16px;
52
+
53
+ textarea {
54
+ resize: none;
55
+ border: none;
56
+ outline: none;
57
+ box-shadow: none;
58
+ background: transparent;
59
+ padding-inline: 0;
60
+ font-size: 13px;
61
+ line-height: 26px;
62
+
63
+ @include scrollbar();
64
+ }
65
+ }
66
+
67
+ .wxchtf-submit-btn-box {
68
+ @include iconBtn();
69
+ margin-left: 1rem;
70
+ }
71
+ }
72
+ }
@@ -1,10 +1,10 @@
1
1
  $borderColor: #ddd;
2
2
  $border: 1px solid #ddd;
3
3
  $background: white;
4
- $radius: 4px;
5
- $chatBodyBackground: #f5f5f5;
6
- $messageBackground: #e1f5fe;
7
- $myMessageBackground: #b9f6ca;
4
+ $radius: 24px;
5
+ $messageBackground: #f5f5f5;
6
+ $myMessageBackground: #e4f7f7;
8
7
  $unreadCountBackground: #ffa726;
9
8
  $avatarSize: 40px;
10
9
  $messageBorderRadius: 10px;
10
+ $messageBoxWidth: 1110px;
@@ -8,8 +8,10 @@ export const AddChatButton = customize('AddChatButton', () => {
8
8
  const onAddChat = useCallback(() => dispatch({ type: 'new_chat_open', data: undefined }), [dispatch]);
9
9
 
10
10
  return (
11
- <Button onClick={onAddChat} icon={'+'} type="link">
12
- Add chat
13
- </Button>
11
+ <span className="wxchtf-add-btn-wrapper">
12
+ <Button className="wxchtf-add-btn" onClick={onAddChat} icon="+">
13
+ Add chat
14
+ </Button>
15
+ </span>
14
16
  );
15
17
  });
@@ -2,12 +2,14 @@ import { customize } from '../customize';
2
2
  import type { ChatListItemBoxProps } from './ChatListItemBox';
3
3
  import { ChatListItemLastMessageContent } from './ChatListItemLastMessageContent';
4
4
  import { ChatListItemLastMessageAuthor } from './ChatListItemLastMessageAuthor';
5
+ import { ChatListItemLastMessageSentAt } from './ChatListItemLastMessageSentAt';
5
6
 
6
7
  export const ChatListItemLastMessage = customize('ChatListItemLastMessage', (props: ChatListItemBoxProps) => {
7
8
  return (
8
9
  <div className="wxchtf-chat-last">
9
10
  <ChatListItemLastMessageAuthor {...props} />
10
11
  <ChatListItemLastMessageContent {...props} />
12
+ <ChatListItemLastMessageSentAt {...props} />
11
13
  </div>
12
14
  );
13
15
  });
@@ -0,0 +1,22 @@
1
+ import { customize } from '../customize';
2
+ import { useLocalizer } from '../localizer';
3
+ import { ChatListItemBoxProps } from './ChatListItemBox';
4
+
5
+ export const ChatListItemLastMessageSentAt = customize(
6
+ 'ChatListItemLastMessageSentAt',
7
+ (props: ChatListItemBoxProps) => {
8
+ const {
9
+ chat: {
10
+ message: { sentAt },
11
+ },
12
+ } = props;
13
+
14
+ const localizer = useLocalizer();
15
+
16
+ return (
17
+ <div className="wxchtf-chat-last-sent-at">
18
+ {localizer.isToday(sentAt) ? localizer.timestamp(sentAt) : localizer.dateTime(sentAt)}
19
+ </div>
20
+ );
21
+ },
22
+ );
@@ -5,3 +5,4 @@ export * from './ChatListItemLastMessageAuthor';
5
5
  export * from './ChatListItemLastMessageContent';
6
6
  export * from './ChatListItemName';
7
7
  export * from './ChatListItemUnreadCount';
8
+ export * from './ChatListItemLastMessageSentAt';
@@ -1,4 +1,4 @@
1
- import { Col, Row, Space } from 'antd';
1
+ import { Col, Row } from 'antd';
2
2
  import { ChatHeaderMembers } from './ChatHeaderMembers';
3
3
  import { ChatMembersButton } from './ChatMembersButton';
4
4
  import { customize } from '../customize';
@@ -21,10 +21,8 @@ export const ChatHeader = customize('ChatHeader', (props: ChatHeaderProps) => {
21
21
  </Col>
22
22
  {chat.active && (
23
23
  <Col className="wxchtf-chat-members">
24
- <Space align="center">
25
- <ChatHeaderMembers id={id} />
26
- <ChatMembersButton id={id} />
27
- </Space>
24
+ <ChatHeaderMembers id={id} />
25
+ <ChatMembersButton id={id} />
28
26
  </Col>
29
27
  )}
30
28
  </Row>
@@ -1,6 +1,8 @@
1
1
  import { useGetChatQuery } from '../../core';
2
- import { Avatar, Tooltip } from 'antd';
2
+ import { Tooltip } from 'antd';
3
3
  import { customize } from '../customize';
4
+ import { Avatar as AntdAvatar } from 'antd';
5
+ import { Avatar } from '../Avatar';
4
6
 
5
7
  export interface ChatHeaderMembersProps {
6
8
  id: string;
@@ -15,12 +17,12 @@ export const ChatHeaderMembers = customize('ChatHeaderMembers', (props: ChatHead
15
17
  }
16
18
 
17
19
  return (
18
- <Avatar.Group maxCount={5}>
20
+ <AntdAvatar.Group maxCount={5}>
19
21
  {chat.members.map((x) => (
20
22
  <Tooltip key={x.id} title={x.name}>
21
- <Avatar src={x.avatar}>{x.name}</Avatar>
23
+ <Avatar account={x} />
22
24
  </Tooltip>
23
25
  ))}
24
- </Avatar.Group>
26
+ </AntdAvatar.Group>
25
27
  );
26
28
  });
@@ -37,23 +37,25 @@ export const ChatHeaderName = customize('ChatHeaderName', (props: ChatHeaderName
37
37
 
38
38
  if (edit) {
39
39
  return (
40
- <Input
41
- value={editNameValue}
42
- onChange={(e) => setEditNameValue(e.target.value)}
43
- onBlur={() => setEdit(false)}
44
- onKeyDown={(e) => {
45
- if (isEscape(e)) {
46
- setEdit(false);
47
- } else if (isEnter(e)) {
48
- setEdit(false);
40
+ <Tooltip defaultOpen title="Press Enter to save new chat name or Escape to cancel editing">
41
+ <Input
42
+ value={editNameValue}
43
+ onChange={(e) => setEditNameValue(e.target.value)}
44
+ onBlur={() => setEdit(false)}
45
+ onKeyDown={(e) => {
46
+ if (isEscape(e)) {
47
+ setEdit(false);
48
+ } else if (isEnter(e)) {
49
+ setEdit(false);
49
50
 
50
- if (editNameValue !== name) {
51
- updateChatName();
51
+ if (editNameValue !== name && editNameValue.trim() !== '') {
52
+ updateChatName();
53
+ }
52
54
  }
53
- }
54
- }}
55
- autoFocus
56
- />
55
+ }}
56
+ autoFocus
57
+ />
58
+ </Tooltip>
57
59
  );
58
60
  }
59
61
 
@@ -17,5 +17,5 @@ export const ChatMembersButton = customize('ChatMembersButton', (_: ChatMembersB
17
17
  [dispatch],
18
18
  );
19
19
 
20
- return <Button onClick={onSettingsClick} type="link" icon={<Icon type="team" />} />;
20
+ return <Button onClick={onSettingsClick} type="link" icon={<Icon type="members" />} />;
21
21
  });
@@ -55,22 +55,26 @@ const ChatMemberListItem = customize('ChatMemberListItem', (props: ChatMemberLis
55
55
  isMember
56
56
  ? [
57
57
  <Tooltip key="remove" title="Remove (keep history)">
58
- <Button onClick={onRemoveKeepHistory} type="link" icon={<Icon type="remove" />} />
58
+ <Button onClick={onRemoveKeepHistory} type="link" icon={<Icon type="remove-member" />} />
59
59
  </Tooltip>,
60
60
  <Tooltip key="remove_delete_history" title="Remove (delete history)">
61
61
  <Button
62
62
  onClick={onRemoveDeleteHistory}
63
63
  type="link"
64
- icon={<Icon type="remove_delete_history" />}
64
+ icon={<Icon type="remove-member-delete-history" />}
65
65
  />
66
66
  </Tooltip>,
67
67
  ]
68
68
  : [
69
69
  <Tooltip key="add_no_history" title="Add (no history)">
70
- <Button onClick={onAddWithoutHistory} type="link" icon={<Icon type="add" />} />
70
+ <Button onClick={onAddWithoutHistory} type="link" icon={<Icon type="add-member" />} />
71
71
  </Tooltip>,
72
72
  <Tooltip key="add" title="Add (share history)">
73
- <Button onClick={onAddWithHistory} type="link" icon={<Icon type="add_with_history" />} />
73
+ <Button
74
+ onClick={onAddWithHistory}
75
+ type="link"
76
+ icon={<Icon type="add-member-with-history" />}
77
+ />
74
78
  </Tooltip>,
75
79
  ]
76
80
  }
@@ -1,8 +1,8 @@
1
- import { CSSProperties, FC } from 'react';
1
+ import { CSSProperties, FC, useMemo } from 'react';
2
2
  import { useReadMonitor } from '../core';
3
3
  import { Localizer, LocalizerContext, defaultLocalizer } from './localizer';
4
4
  import { Avatar } from './Avatar';
5
- import { CustomizeProvider } from './customize';
5
+ import { CustomizeProvider, CustomizeProviderValue } from './customize';
6
6
  import { ChatHeaderMembers } from './ChatPanel/ChatHeaderMembers';
7
7
  import { ChatMembersButton } from './ChatPanel/ChatMembersButton';
8
8
  import { AddChatButton } from './AddChatButton';
@@ -17,6 +17,7 @@ import {
17
17
  ChatListItemLastMessage,
18
18
  ChatListItemUnreadCount,
19
19
  ChatListItemName,
20
+ ChatListItemLastMessageSentAt,
20
21
  } from './ChatList';
21
22
 
22
23
  import {
@@ -58,6 +59,7 @@ export interface ChatifyCustomizeValue {
58
59
  ChatListItemLastMessage?: typeof ChatListItemLastMessage.Component | null;
59
60
  ChatListItemLastMessageAuthor?: typeof ChatListItemLastMessageAuthor.Component | null;
60
61
  ChatListItemLastMessageContent?: typeof ChatListItemLastMessageContent.Component | null;
62
+ ChatListItemLastMessageSentAt?: typeof ChatListItemLastMessageSentAt.Component | null;
61
63
 
62
64
  // ./Layout
63
65
  Header?: typeof Header.Component | null;
@@ -131,14 +133,18 @@ function Content(props: Pick<ChatifyProps, 'className' | 'style'>) {
131
133
  );
132
134
  }
133
135
 
134
- const EMPTY_CUSTOMIZE = {};
136
+ const DEFAULT_CUSTOMIZE: ChatifyCustomizeValue = {
137
+ Header: null,
138
+ Footer: null,
139
+ };
135
140
 
136
141
  export const Chatify: FC<ChatifyProps> = (props) => {
137
- const { localizer = defaultLocalizer, customize = EMPTY_CUSTOMIZE } = props;
142
+ const { localizer = defaultLocalizer, customize = DEFAULT_CUSTOMIZE } = props;
143
+ const customizeValue = useMemo(() => Object.assign({}, DEFAULT_CUSTOMIZE, customize), [customize]);
138
144
 
139
145
  return (
140
146
  <LocalizerContext.Provider value={localizer}>
141
- <CustomizeProvider value={customize}>
147
+ <CustomizeProvider value={customizeValue as CustomizeProviderValue}>
142
148
  <Content {...props} />
143
149
  </CustomizeProvider>
144
150
  </LocalizerContext.Provider>