@webinex/chatify 1.0.0-build2 → 1.0.0-rc2

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 (56) hide show
  1. package/package.json +90 -90
  2. package/src/ChatifyContext.tsx +41 -41
  3. package/src/core/action.tsx +319 -319
  4. package/src/core/client.ts +137 -137
  5. package/src/core/index.ts +14 -14
  6. package/src/core/models.tsx +75 -75
  7. package/src/core/reducer.tsx +86 -86
  8. package/src/core/state.ts +38 -38
  9. package/src/core/useAccounts.tsx +11 -11
  10. package/src/core/useAddChat.tsx +12 -12
  11. package/src/core/useAddMember.tsx +12 -12
  12. package/src/core/useAddMessage.tsx +40 -40
  13. package/src/core/useChat.tsx +12 -12
  14. package/src/core/useChatList.tsx +10 -10
  15. package/src/core/useLoadMore.tsx +42 -42
  16. package/src/core/useMessages.tsx +23 -23
  17. package/src/core/useMutation.tsx +48 -48
  18. package/src/core/useQuery.tsx +45 -45
  19. package/src/core/useReadMonitor.tsx +31 -31
  20. package/src/core/useRemoveMember.tsx +12 -12
  21. package/src/core/useSignalRMonitor.tsx +52 -52
  22. package/src/index.ts +3 -3
  23. package/src/ui/AddChat.tsx +55 -55
  24. package/src/ui/AddChatButton.tsx +19 -19
  25. package/src/ui/Aside.tsx +41 -41
  26. package/src/ui/Avatar.tsx +18 -18
  27. package/src/ui/Chat.tsx +26 -26
  28. package/src/ui/ChatBody.tsx +43 -43
  29. package/src/ui/ChatHeader.tsx +33 -33
  30. package/src/ui/ChatHeaderMembers.tsx +30 -30
  31. package/src/ui/ChatHeaderSettingsButton.tsx +26 -26
  32. package/src/ui/ChatListItem.tsx +101 -101
  33. package/src/ui/ChatName.tsx +15 -15
  34. package/src/ui/ChatSettings.tsx +59 -59
  35. package/src/ui/Chatify.tsx +106 -106
  36. package/src/ui/Footer.tsx +7 -7
  37. package/src/ui/Header.tsx +14 -14
  38. package/src/ui/Icon.tsx +21 -21
  39. package/src/ui/InputForm.tsx +51 -51
  40. package/src/ui/LoadMore.tsx +40 -40
  41. package/src/ui/Main.tsx +16 -16
  42. package/src/ui/Message.tsx +118 -118
  43. package/src/ui/MessageSkeleton.tsx +19 -19
  44. package/src/ui/SendingMessage.tsx +50 -50
  45. package/src/ui/SystemMessage.tsx +32 -32
  46. package/src/ui/index.ts +11 -11
  47. package/src/ui/localizer.tsx +68 -68
  48. package/src/ui/styles/aside.scss +94 -94
  49. package/src/ui/styles/index.scss +248 -248
  50. package/src/ui/styles/keyframes.scss +14 -14
  51. package/src/ui/styles/mixins.scss +20 -20
  52. package/src/ui/styles/variables.scss +10 -10
  53. package/src/util/customize.tsx +45 -45
  54. package/src/util/index.ts +3 -3
  55. package/src/util/uniqBy.tsx +17 -17
  56. package/src/util/uniqId.tsx +3 -3
@@ -1,94 +1,94 @@
1
- .wxchtf-aside {
2
- flex: none;
3
- width: 300px;
4
- border-right: $border;
5
- display: flex;
6
- flex-flow: column nowrap;
7
-
8
- .wxchtf-chats.ant-menu {
9
- flex: 1 1 auto;
10
- height: 100px;
11
- overflow-y: auto;
12
-
13
- @include scrollbar();
14
-
15
- .ant-menu-item {
16
- padding: 0;
17
- height: unset;
18
- margin: 0;
19
- width: 100%;
20
- border-radius: 0;
21
- line-height: 1.5;
22
- border-top: $border;
23
-
24
- &:first-child {
25
- border-top: none;
26
- }
27
-
28
- &.ant-menu-item-selected .wxchtf-chat-name {
29
- font-weight: 600;
30
- }
31
-
32
- .wxchtf-chat {
33
- padding: 0.5rem 1rem;
34
- position: relative;
35
-
36
- &.--unread {
37
- .wxchtf-chat-last {
38
- font-weight: bold;
39
- }
40
- }
41
-
42
- .wxchtf-chat-name {
43
- font-weight: bold;
44
- display: inline-block;
45
- }
46
-
47
- .wxchtf-unread-count {
48
- display: inline-block;
49
- padding: 0.2rem;
50
- min-width: 1rem;
51
- height: 1.2rem;
52
- line-height: 0.7rem;
53
- margin-left: 0.5rem;
54
- border-radius: 50%;
55
- text-align: center;
56
- font-size: 0.7rem;
57
- background: $unreadCountBackground;
58
- }
59
-
60
- .wxchtf-chat-last {
61
- $size: 25px;
62
-
63
- font-style: italic;
64
- opacity: 0.75;
65
- overflow: hidden;
66
- text-overflow: ellipsis;
67
- white-space: nowrap;
68
- line-height: $size;
69
-
70
- .wxchtf-chat-last-author {
71
- display: inline-block;
72
- margin-right: 0.5rem;
73
-
74
- .ant-avatar {
75
- display: inline-block;
76
- border: none;
77
- margin-right: 5px;
78
-
79
- @include avatarSize($size);
80
- }
81
-
82
- &::after {
83
- content: ':';
84
- }
85
- }
86
-
87
- .wxchtf-chat-last-message {
88
- display: inline;
89
- }
90
- }
91
- }
92
- }
93
- }
94
- }
1
+ .wxchtf-aside {
2
+ flex: none;
3
+ width: 300px;
4
+ border-right: $border;
5
+ display: flex;
6
+ flex-flow: column nowrap;
7
+
8
+ .wxchtf-chats.ant-menu {
9
+ flex: 1 1 auto;
10
+ height: 100px;
11
+ overflow-y: auto;
12
+
13
+ @include scrollbar();
14
+
15
+ .ant-menu-item {
16
+ padding: 0;
17
+ height: unset;
18
+ margin: 0;
19
+ width: 100%;
20
+ border-radius: 0;
21
+ line-height: 1.5;
22
+ border-top: $border;
23
+
24
+ &:first-child {
25
+ border-top: none;
26
+ }
27
+
28
+ &.ant-menu-item-selected .wxchtf-chat-name {
29
+ font-weight: 600;
30
+ }
31
+
32
+ .wxchtf-chat {
33
+ padding: 0.5rem 1rem;
34
+ position: relative;
35
+
36
+ &.--unread {
37
+ .wxchtf-chat-last {
38
+ font-weight: bold;
39
+ }
40
+ }
41
+
42
+ .wxchtf-chat-name {
43
+ font-weight: bold;
44
+ display: inline-block;
45
+ }
46
+
47
+ .wxchtf-unread-count {
48
+ display: inline-block;
49
+ padding: 0.2rem;
50
+ min-width: 1rem;
51
+ height: 1.2rem;
52
+ line-height: 0.7rem;
53
+ margin-left: 0.5rem;
54
+ border-radius: 50%;
55
+ text-align: center;
56
+ font-size: 0.7rem;
57
+ background: $unreadCountBackground;
58
+ }
59
+
60
+ .wxchtf-chat-last {
61
+ $size: 25px;
62
+
63
+ font-style: italic;
64
+ opacity: 0.75;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ white-space: nowrap;
68
+ line-height: $size;
69
+
70
+ .wxchtf-chat-last-author {
71
+ display: inline-block;
72
+ margin-right: 0.5rem;
73
+
74
+ .ant-avatar {
75
+ display: inline-block;
76
+ border: none;
77
+ margin-right: 5px;
78
+
79
+ @include avatarSize($size);
80
+ }
81
+
82
+ &::after {
83
+ content: ':';
84
+ }
85
+ }
86
+
87
+ .wxchtf-chat-last-message {
88
+ display: inline;
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
@@ -1,248 +1,248 @@
1
- @import './variables.scss';
2
- @import './mixins.scss';
3
- @import './keyframes.scss';
4
- @import './aside.scss';
5
-
6
- .wxchtf-chatify {
7
- border: $border;
8
- display: flex;
9
- flex-flow: column nowrap;
10
- background: $background;
11
- border-radius: $radius;
12
-
13
- .wxchtf-header {
14
- min-height: 2rem;
15
- border-bottom: $border;
16
- }
17
-
18
- .wxchtf-body {
19
- flex: 1 0;
20
- display: flex;
21
- flex-flow: row nowrap;
22
- }
23
-
24
- .wxchtf-footer {
25
- min-height: 2rem;
26
- border-top: $border;
27
- }
28
- }
29
-
30
- .wxchtf-main {
31
- flex: auto;
32
- display: flex;
33
- flex-flow: column nowrap;
34
-
35
- .wxchtf-chat {
36
- flex: auto;
37
- display: flex;
38
- flex-flow: column nowrap;
39
-
40
- .wxchtf-chat-header {
41
- border-bottom: $border;
42
- padding: 0.5rem 1rem;
43
-
44
- .wxchtf-chat-name {
45
- font-weight: 600;
46
- flex: none;
47
- }
48
- }
49
-
50
- .wxchtf-chat-body {
51
- flex: 1 1 auto;
52
- height: 100px;
53
- overflow-y: auto;
54
- background: $chatBodyBackground;
55
- padding: 2rem 1rem;
56
- display: flex;
57
- flex-flow: column-reverse nowrap;
58
-
59
- @include scrollbar();
60
-
61
- @media only screen and (min-width: 1120px) {
62
- padding-right: 30%;
63
- }
64
-
65
- .wxchtf-message,
66
- .wxchtf-sending-message {
67
- display: flex;
68
- flex-flow: row nowrap;
69
- width: 100%;
70
- align-items: flex-end;
71
-
72
- &.--my {
73
- direction: rtl;
74
- justify-content: flex-start;
75
-
76
- .wxchtf-message-author {
77
- margin-right: 0;
78
- margin-left: 15px;
79
- }
80
-
81
- .wxchtf-message-content,
82
- .wxchtf-sending-message-content {
83
- direction: ltr;
84
- border-bottom-left-radius: 10px;
85
- border-bottom-right-radius: 0;
86
- background-color: $myMessageBackground;
87
- }
88
- }
89
-
90
- .wxchtf-message-author {
91
- margin-right: 15px;
92
-
93
- .ant-avatar {
94
- @include avatarSize($avatarSize);
95
- box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
96
- }
97
- }
98
-
99
- .wxchtf-message-content,
100
- .wxchtf-sending-message-content {
101
- min-width: 300px;
102
- max-width: 70%;
103
- border-radius: $messageBorderRadius;
104
- padding: 0.75rem 1rem;
105
- background: white;
106
- border-bottom-left-radius: 0;
107
- background-color: $messageBackground;
108
- box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
109
- display: block;
110
- white-space: pre-wrap;
111
- overflow-wrap: break-word;
112
-
113
- .wxchtf-message-info-box,
114
- .wxchtf-sending-message-info-box {
115
- text-align: right;
116
-
117
- .wxchtf-message-sent-at,
118
- .wxchtf-message-read-box,
119
- .wxchtf-sending-message-sending-box {
120
- display: inline-block;
121
- font-style: italic;
122
- font-size: 0.75em;
123
- margin-top: 0.5rem;
124
- opacity: 0.5;
125
- }
126
-
127
- .wxchtf-message-read-box,
128
- .wxchtf-sending-message-sending-box {
129
- margin-left: 5px;
130
- }
131
- }
132
- }
133
- }
134
-
135
- .wxchtf-system-message {
136
- font-style: italic;
137
- position: relative;
138
- text-align: center;
139
-
140
- .wxchtf-text,
141
- .wxchtf-timestamp {
142
- display: inline-block;
143
- opacity: 0.9;
144
- font-size: 0.85em;
145
- }
146
-
147
- .wxchtf-timestamp {
148
- margin-left: 1rem;
149
- }
150
- }
151
-
152
- .wxchtf-message,
153
- .wxchtf-sending-message,
154
- .wxchtf-system-message,
155
- .wxchtf-message-skeleton {
156
- margin-bottom: 2rem;
157
-
158
- &:first-child {
159
- margin-bottom: 0;
160
- }
161
- }
162
-
163
- .wxchtf-message-skeleton {
164
- display: flex;
165
- flex-flow: row nowrap;
166
- align-items: flex-end;
167
-
168
- .wxchtf-avatar {
169
- margin-right: 15px;
170
- }
171
-
172
- .wxchtf-avatar .ant-skeleton-avatar {
173
- width: $avatarSize;
174
- height: $avatarSize;
175
- line-height: $avatarSize;
176
- }
177
-
178
- .wxchtf-content {
179
- width: 300px;
180
- height: 100px;
181
- border-radius: $messageBorderRadius;
182
- border-bottom-left-radius: 0;
183
- }
184
- }
185
- }
186
- }
187
-
188
- .wxchtf-input-form {
189
- flex: none;
190
- max-height: 300px;
191
- display: flex;
192
- flex-flow: column nowrap;
193
-
194
- .wxchtf-input-box {
195
- flex: none;
196
- display: flex;
197
- flex-flow: row nowrap;
198
- padding: 1rem 0;
199
- border-top: $border;
200
-
201
- @mixin iconBtn {
202
- flex: none;
203
- display: flex;
204
- padding: 0 1rem;
205
- align-items: flex-end;
206
-
207
- .ant-btn.ant-btn-icon-only .anticon {
208
- font-size: 1.5rem;
209
- }
210
- }
211
-
212
- .wxchtf-add-files-box {
213
- @include iconBtn();
214
- }
215
-
216
- .wxchtf-text-input-box {
217
- flex: auto;
218
-
219
- textarea {
220
- resize: none;
221
- border: none;
222
- outline: none;
223
- box-shadow: none;
224
-
225
- @include scrollbar();
226
- }
227
- }
228
-
229
- .wxchtf-submit-btn-box {
230
- @include iconBtn();
231
- }
232
- }
233
- }
234
-
235
- .wxchtf-add-chat {
236
- display: flex;
237
- flex-flow: column nowrap;
238
- justify-content: center;
239
- align-items: center;
240
- height: 100%;
241
-
242
- form {
243
- padding: 2rem;
244
- max-width: 700px;
245
- width: 100%;
246
- }
247
- }
248
- }
1
+ @import './variables.scss';
2
+ @import './mixins.scss';
3
+ @import './keyframes.scss';
4
+ @import './aside.scss';
5
+
6
+ .wxchtf-chatify {
7
+ border: $border;
8
+ display: flex;
9
+ flex-flow: column nowrap;
10
+ background: $background;
11
+ border-radius: $radius;
12
+
13
+ .wxchtf-header {
14
+ min-height: 2rem;
15
+ border-bottom: $border;
16
+ }
17
+
18
+ .wxchtf-body {
19
+ flex: 1 0;
20
+ display: flex;
21
+ flex-flow: row nowrap;
22
+ }
23
+
24
+ .wxchtf-footer {
25
+ min-height: 2rem;
26
+ border-top: $border;
27
+ }
28
+ }
29
+
30
+ .wxchtf-main {
31
+ flex: auto;
32
+ display: flex;
33
+ flex-flow: column nowrap;
34
+
35
+ .wxchtf-chat {
36
+ flex: auto;
37
+ display: flex;
38
+ flex-flow: column nowrap;
39
+
40
+ .wxchtf-chat-header {
41
+ border-bottom: $border;
42
+ padding: 0.5rem 1rem;
43
+
44
+ .wxchtf-chat-name {
45
+ font-weight: 600;
46
+ flex: none;
47
+ }
48
+ }
49
+
50
+ .wxchtf-chat-body {
51
+ flex: 1 1 auto;
52
+ height: 100px;
53
+ overflow-y: auto;
54
+ background: $chatBodyBackground;
55
+ padding: 2rem 1rem;
56
+ display: flex;
57
+ flex-flow: column-reverse nowrap;
58
+
59
+ @include scrollbar();
60
+
61
+ @media only screen and (min-width: 1120px) {
62
+ padding-right: 30%;
63
+ }
64
+
65
+ .wxchtf-message,
66
+ .wxchtf-sending-message {
67
+ display: flex;
68
+ flex-flow: row nowrap;
69
+ width: 100%;
70
+ align-items: flex-end;
71
+
72
+ &.--my {
73
+ direction: rtl;
74
+ justify-content: flex-start;
75
+
76
+ .wxchtf-message-author {
77
+ margin-right: 0;
78
+ margin-left: 15px;
79
+ }
80
+
81
+ .wxchtf-message-content,
82
+ .wxchtf-sending-message-content {
83
+ direction: ltr;
84
+ border-bottom-left-radius: 10px;
85
+ border-bottom-right-radius: 0;
86
+ background-color: $myMessageBackground;
87
+ }
88
+ }
89
+
90
+ .wxchtf-message-author {
91
+ margin-right: 15px;
92
+
93
+ .ant-avatar {
94
+ @include avatarSize($avatarSize);
95
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
96
+ }
97
+ }
98
+
99
+ .wxchtf-message-content,
100
+ .wxchtf-sending-message-content {
101
+ min-width: 300px;
102
+ max-width: 70%;
103
+ border-radius: $messageBorderRadius;
104
+ padding: 0.75rem 1rem;
105
+ background: white;
106
+ border-bottom-left-radius: 0;
107
+ background-color: $messageBackground;
108
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
109
+ display: block;
110
+ white-space: pre-wrap;
111
+ overflow-wrap: break-word;
112
+
113
+ .wxchtf-message-info-box,
114
+ .wxchtf-sending-message-info-box {
115
+ text-align: right;
116
+
117
+ .wxchtf-message-sent-at,
118
+ .wxchtf-message-read-box,
119
+ .wxchtf-sending-message-sending-box {
120
+ display: inline-block;
121
+ font-style: italic;
122
+ font-size: 0.75em;
123
+ margin-top: 0.5rem;
124
+ opacity: 0.5;
125
+ }
126
+
127
+ .wxchtf-message-read-box,
128
+ .wxchtf-sending-message-sending-box {
129
+ margin-left: 5px;
130
+ }
131
+ }
132
+ }
133
+ }
134
+
135
+ .wxchtf-system-message {
136
+ font-style: italic;
137
+ position: relative;
138
+ text-align: center;
139
+
140
+ .wxchtf-text,
141
+ .wxchtf-timestamp {
142
+ display: inline-block;
143
+ opacity: 0.9;
144
+ font-size: 0.85em;
145
+ }
146
+
147
+ .wxchtf-timestamp {
148
+ margin-left: 1rem;
149
+ }
150
+ }
151
+
152
+ .wxchtf-message,
153
+ .wxchtf-sending-message,
154
+ .wxchtf-system-message,
155
+ .wxchtf-message-skeleton {
156
+ margin-bottom: 2rem;
157
+
158
+ &:first-child {
159
+ margin-bottom: 0;
160
+ }
161
+ }
162
+
163
+ .wxchtf-message-skeleton {
164
+ display: flex;
165
+ flex-flow: row nowrap;
166
+ align-items: flex-end;
167
+
168
+ .wxchtf-avatar {
169
+ margin-right: 15px;
170
+ }
171
+
172
+ .wxchtf-avatar .ant-skeleton-avatar {
173
+ width: $avatarSize;
174
+ height: $avatarSize;
175
+ line-height: $avatarSize;
176
+ }
177
+
178
+ .wxchtf-content {
179
+ width: 300px;
180
+ height: 100px;
181
+ border-radius: $messageBorderRadius;
182
+ border-bottom-left-radius: 0;
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ .wxchtf-input-form {
189
+ flex: none;
190
+ max-height: 300px;
191
+ display: flex;
192
+ flex-flow: column nowrap;
193
+
194
+ .wxchtf-input-box {
195
+ flex: none;
196
+ display: flex;
197
+ flex-flow: row nowrap;
198
+ padding: 1rem 0;
199
+ border-top: $border;
200
+
201
+ @mixin iconBtn {
202
+ flex: none;
203
+ display: flex;
204
+ padding: 0 1rem;
205
+ align-items: flex-end;
206
+
207
+ .ant-btn.ant-btn-icon-only .anticon {
208
+ font-size: 1.5rem;
209
+ }
210
+ }
211
+
212
+ .wxchtf-add-files-box {
213
+ @include iconBtn();
214
+ }
215
+
216
+ .wxchtf-text-input-box {
217
+ flex: auto;
218
+
219
+ textarea {
220
+ resize: none;
221
+ border: none;
222
+ outline: none;
223
+ box-shadow: none;
224
+
225
+ @include scrollbar();
226
+ }
227
+ }
228
+
229
+ .wxchtf-submit-btn-box {
230
+ @include iconBtn();
231
+ }
232
+ }
233
+ }
234
+
235
+ .wxchtf-add-chat {
236
+ display: flex;
237
+ flex-flow: column nowrap;
238
+ justify-content: center;
239
+ align-items: center;
240
+ height: 100%;
241
+
242
+ form {
243
+ padding: 2rem;
244
+ max-width: 700px;
245
+ width: 100%;
246
+ }
247
+ }
248
+ }