@webinex/chatify 1.0.0-rc3 → 1.0.2-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.
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/core/action.d.ts +10 -4
- package/dist/esm/types/core/state.d.ts +2 -1
- package/dist/esm/types/core/useGetAccountsQuery.d.ts +3 -1
- package/dist/esm/types/core/useGetChatListQuery.d.ts +3 -1
- package/dist/esm/types/core/useGetChatQuery.d.ts +3 -1
- package/dist/esm/types/ui/Icon.d.ts +8 -8
- package/dist/index.d.ts +21 -14
- package/package.json +92 -92
- package/src/ChatifyContext.tsx +41 -41
- package/src/core/action.tsx +421 -405
- package/src/core/client.ts +143 -143
- package/src/core/index.ts +17 -17
- package/src/core/models.tsx +82 -82
- package/src/core/reducer.tsx +87 -87
- package/src/core/state.ts +93 -92
- package/src/core/useAddChatMutation.tsx +22 -22
- package/src/core/useAddMemberMutation.tsx +25 -25
- package/src/core/useFetchNextMutation.tsx +28 -28
- package/src/core/useGetAccountsQuery.tsx +30 -33
- package/src/core/useGetChatListQuery.tsx +30 -33
- package/src/core/useGetChatQuery.tsx +31 -34
- package/src/core/useGetMessagesQuery.tsx +35 -35
- package/src/core/useReadMonitor.tsx +32 -32
- package/src/core/useRemoveMemberMutation.tsx +23 -23
- package/src/core/useSendMutation.tsx +24 -24
- package/src/core/useSignalRMonitor.tsx +66 -66
- package/src/core/useUpdateChatNameMutation.tsx +23 -23
- package/src/index.ts +3 -3
- package/src/styles/aside.scss +94 -94
- package/src/styles/chat.scss +222 -222
- package/src/styles/index.scss +79 -79
- package/src/styles/keyframes.scss +14 -14
- package/src/styles/mixins.scss +20 -20
- package/src/styles/settings.scss +5 -5
- package/src/styles/variables.scss +10 -10
- package/src/ui/AddChatButton.tsx +15 -15
- package/src/ui/Avatar.tsx +18 -18
- package/src/ui/ChatList/ChatList.tsx +42 -42
- package/src/ui/ChatList/ChatListItemBox.tsx +22 -22
- package/src/ui/ChatList/ChatListItemLastMessage.tsx +13 -13
- package/src/ui/ChatList/ChatListItemLastMessageAuthor.tsx +20 -20
- package/src/ui/ChatList/ChatListItemLastMessageContent.tsx +21 -21
- package/src/ui/ChatList/ChatListItemName.tsx +13 -13
- package/src/ui/ChatList/ChatListItemUnreadCount.tsx +12 -12
- package/src/ui/ChatList/index.ts +7 -7
- package/src/ui/ChatName.tsx +10 -10
- package/src/ui/ChatPanel/ChatBody.tsx +44 -44
- package/src/ui/ChatPanel/ChatHeader.tsx +33 -33
- package/src/ui/ChatPanel/ChatHeaderMembers.tsx +26 -26
- package/src/ui/ChatPanel/ChatHeaderName.tsx +67 -67
- package/src/ui/ChatPanel/ChatMembersButton.tsx +21 -21
- package/src/ui/ChatPanel/ChatMembersPanel.tsx +117 -117
- package/src/ui/ChatPanel/ChatPanel.tsx +27 -27
- package/src/ui/ChatPanel/index.ts +6 -6
- package/src/ui/Chatify.tsx +148 -148
- package/src/ui/CreateChatPanel/CreateChatForm.tsx +36 -36
- package/src/ui/CreateChatPanel/CreateChatMemberInput.tsx +66 -66
- package/src/ui/CreateChatPanel/CreateChatNameInput.tsx +25 -25
- package/src/ui/CreateChatPanel/CreateChatPanel.tsx +33 -33
- package/src/ui/CreateChatPanel/index.ts +4 -4
- package/src/ui/Icon.tsx +33 -33
- package/src/ui/InputBox/InputBox.tsx +38 -38
- package/src/ui/InputBox/InputFilesBox.tsx +9 -9
- package/src/ui/InputBox/InputSubmitButtonBox.tsx +17 -17
- package/src/ui/InputBox/InputTextBox.tsx +50 -50
- package/src/ui/InputBox/index.ts +4 -4
- package/src/ui/Layout/Aside.tsx +10 -10
- package/src/ui/Layout/Body.tsx +10 -10
- package/src/ui/Layout/Footer.tsx +3 -3
- package/src/ui/Layout/Header.tsx +10 -10
- package/src/ui/Layout/Main.tsx +15 -15
- package/src/ui/Layout/index.ts +5 -5
- package/src/ui/Message/MessageAuthor.tsx +13 -13
- package/src/ui/Message/MessageBox.tsx +20 -20
- package/src/ui/Message/MessageContent.tsx +13 -13
- package/src/ui/Message/MessageInfoBox.tsx +25 -25
- package/src/ui/Message/MessageRow.tsx +24 -24
- package/src/ui/Message/MessageText.tsx +7 -7
- package/src/ui/Message/index.ts +6 -6
- package/src/ui/MessageReadObserver.tsx +45 -45
- package/src/ui/MessageSkeleton.tsx +19 -19
- package/src/ui/Next.tsx +48 -48
- package/src/ui/SendingMessage/SendingMessageBox.tsx +16 -16
- package/src/ui/SendingMessage/SendingMessageContent.tsx +13 -13
- package/src/ui/SendingMessage/SendingMessageInfoBox.tsx +13 -13
- package/src/ui/SendingMessage/SendingMessageText.tsx +7 -7
- package/src/ui/SendingMessage/index.ts +4 -4
- package/src/ui/SystemMessage/SystemMessageBox.tsx +20 -20
- package/src/ui/SystemMessage/SystemMessageRow.tsx +43 -43
- package/src/ui/SystemMessage/index.ts +2 -2
- package/src/ui/customize.tsx +45 -45
- package/src/ui/index.ts +11 -11
- package/src/ui/localizer.tsx +80 -80
- package/src/util/index.ts +2 -2
- package/src/util/uniqBy.tsx +17 -17
- package/src/util/uniqId.tsx +3 -3
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { useClient } from '../ChatifyContext';
|
|
3
|
-
import { useDispatch, useSelect } from './reducer';
|
|
4
|
-
|
|
5
|
-
export function useReadMonitor() {
|
|
6
|
-
const client = useClient();
|
|
7
|
-
const [queued, timestamp] = useSelect((x) => [x.queue.read.queued, x.queue.read.timestamp], []);
|
|
8
|
-
const dispatch = useDispatch();
|
|
9
|
-
const timer = useRef<NodeJS.Timeout | null>(null);
|
|
10
|
-
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (queued.length === 0) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (timer.current) {
|
|
17
|
-
clearTimeout(timer.current);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
timer.current = setTimeout(() => {
|
|
21
|
-
for (const id of queued) {
|
|
22
|
-
dispatch({ type: 'read_send', data: { id } });
|
|
23
|
-
|
|
24
|
-
client
|
|
25
|
-
.read({ id })
|
|
26
|
-
.catch(() => dispatch({ type: 'read_reject', data: { id, timestamp: new Date().getTime() } }));
|
|
27
|
-
}
|
|
28
|
-
}, 100);
|
|
29
|
-
|
|
30
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
-
}, [timestamp]);
|
|
32
|
-
}
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useClient } from '../ChatifyContext';
|
|
3
|
+
import { useDispatch, useSelect } from './reducer';
|
|
4
|
+
|
|
5
|
+
export function useReadMonitor() {
|
|
6
|
+
const client = useClient();
|
|
7
|
+
const [queued, timestamp] = useSelect((x) => [x.queue.read.queued, x.queue.read.timestamp], []);
|
|
8
|
+
const dispatch = useDispatch();
|
|
9
|
+
const timer = useRef<NodeJS.Timeout | null>(null);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (queued.length === 0) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (timer.current) {
|
|
17
|
+
clearTimeout(timer.current);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
timer.current = setTimeout(() => {
|
|
21
|
+
for (const id of queued) {
|
|
22
|
+
dispatch({ type: 'read_send', data: { id } });
|
|
23
|
+
|
|
24
|
+
client
|
|
25
|
+
.read({ id })
|
|
26
|
+
.catch(() => dispatch({ type: 'read_reject', data: { id, timestamp: new Date().getTime() } }));
|
|
27
|
+
}
|
|
28
|
+
}, 100);
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
+
}, [timestamp]);
|
|
32
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { useClient } from '../ChatifyContext';
|
|
3
|
-
import { RemoveMemberRequest } from './models';
|
|
4
|
-
import { useDispatch, useSelect, useStateRef } from './reducer';
|
|
5
|
-
|
|
6
|
-
export function useRemoveMemberMutation() {
|
|
7
|
-
const stateRef = useStateRef();
|
|
8
|
-
useSelect((x) => x.mutation.removeMember, []);
|
|
9
|
-
const dispatch = useDispatch();
|
|
10
|
-
const client = useClient();
|
|
11
|
-
|
|
12
|
-
const invoke = useCallback((args: RemoveMemberRequest) => {
|
|
13
|
-
dispatch({ type: 'removeMember_fetch', data: void 0 });
|
|
14
|
-
client
|
|
15
|
-
.removeMember(args)
|
|
16
|
-
.then(() => dispatch({ type: 'removeMember_fulfilled', data: void 0 }))
|
|
17
|
-
.catch((error) => dispatch({ type: 'removeMember_rejected', data: { error } }));
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
-
}, []);
|
|
21
|
-
|
|
22
|
-
return [invoke, stateRef.current.mutation.removeMember] as const;
|
|
23
|
-
}
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useClient } from '../ChatifyContext';
|
|
3
|
+
import { RemoveMemberRequest } from './models';
|
|
4
|
+
import { useDispatch, useSelect, useStateRef } from './reducer';
|
|
5
|
+
|
|
6
|
+
export function useRemoveMemberMutation() {
|
|
7
|
+
const stateRef = useStateRef();
|
|
8
|
+
useSelect((x) => x.mutation.removeMember, []);
|
|
9
|
+
const dispatch = useDispatch();
|
|
10
|
+
const client = useClient();
|
|
11
|
+
|
|
12
|
+
const invoke = useCallback((args: RemoveMemberRequest) => {
|
|
13
|
+
dispatch({ type: 'removeMember_fetch', data: void 0 });
|
|
14
|
+
client
|
|
15
|
+
.removeMember(args)
|
|
16
|
+
.then(() => dispatch({ type: 'removeMember_fulfilled', data: void 0 }))
|
|
17
|
+
.catch((error) => dispatch({ type: 'removeMember_rejected', data: { error } }));
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
return [invoke, stateRef.current.mutation.removeMember] as const;
|
|
23
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { useClient } from '../ChatifyContext';
|
|
3
|
-
import { SendMessageRequest } from './models';
|
|
4
|
-
import { useDispatch, useSelect, useStateRef } from './reducer';
|
|
5
|
-
|
|
6
|
-
export function useSendMutation() {
|
|
7
|
-
const stateRef = useStateRef();
|
|
8
|
-
useSelect((x) => x.mutation.send, []);
|
|
9
|
-
const dispatch = useDispatch();
|
|
10
|
-
const client = useClient();
|
|
11
|
-
|
|
12
|
-
const invoke = useCallback((args: SendMessageRequest) => {
|
|
13
|
-
const { chatId, requestId, files, text } = args;
|
|
14
|
-
dispatch({ type: 'send_fetch', data: { chatId, requestId, files, text } });
|
|
15
|
-
client
|
|
16
|
-
.send(args)
|
|
17
|
-
.then(() => dispatch({ type: 'send_fulfilled', data: { chatId, requestId } }))
|
|
18
|
-
.catch((error) => dispatch({ type: 'send_rejected', data: { chatId, requestId, error } }));
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
-
}, []);
|
|
22
|
-
|
|
23
|
-
return [invoke, stateRef.current.mutation.send] as const;
|
|
24
|
-
}
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useClient } from '../ChatifyContext';
|
|
3
|
+
import { SendMessageRequest } from './models';
|
|
4
|
+
import { useDispatch, useSelect, useStateRef } from './reducer';
|
|
5
|
+
|
|
6
|
+
export function useSendMutation() {
|
|
7
|
+
const stateRef = useStateRef();
|
|
8
|
+
useSelect((x) => x.mutation.send, []);
|
|
9
|
+
const dispatch = useDispatch();
|
|
10
|
+
const client = useClient();
|
|
11
|
+
|
|
12
|
+
const invoke = useCallback((args: SendMessageRequest) => {
|
|
13
|
+
const { chatId, requestId, files, text } = args;
|
|
14
|
+
dispatch({ type: 'send_fetch', data: { chatId, requestId, files, text } });
|
|
15
|
+
client
|
|
16
|
+
.send(args)
|
|
17
|
+
.then(() => dispatch({ type: 'send_fulfilled', data: { chatId, requestId } }))
|
|
18
|
+
.catch((error) => dispatch({ type: 'send_rejected', data: { chatId, requestId, error } }));
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return [invoke, stateRef.current.mutation.send] as const;
|
|
24
|
+
}
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { useDispatch } from './reducer';
|
|
3
|
-
import { Account, ChatListItem, Message, ReadEvent } from './models';
|
|
4
|
-
import { ChatifyClient } from './client';
|
|
5
|
-
|
|
6
|
-
export function useSignalRMonitor(me: string, client: ChatifyClient) {
|
|
7
|
-
const dispatch = useDispatch();
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
let unsubscribes: Array<() => void> = [];
|
|
11
|
-
|
|
12
|
-
client.connect().then(() => {
|
|
13
|
-
unsubscribes.push(
|
|
14
|
-
client.subscribe('chatify://new-message', ([message, requestId]: [Message, string]) => {
|
|
15
|
-
dispatch({ type: 'message_received', data: { message, requestId, me } });
|
|
16
|
-
}),
|
|
17
|
-
);
|
|
18
|
-
unsubscribes.push(
|
|
19
|
-
client.subscribe('chatify://chat-created', ([chat, requestId]: [ChatListItem, string]) => {
|
|
20
|
-
dispatch({ type: 'chat_created', data: { chat, requestId } });
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
23
|
-
unsubscribes.push(
|
|
24
|
-
client.subscribe('chatify://read', ([events]: [ReadEvent[]]) => {
|
|
25
|
-
dispatch({ type: 'read_received', data: { events } });
|
|
26
|
-
}),
|
|
27
|
-
);
|
|
28
|
-
unsubscribes.push(
|
|
29
|
-
client.subscribe(
|
|
30
|
-
'chatify://member-added',
|
|
31
|
-
([chatId, chatName, account, message, withHistory]: [
|
|
32
|
-
string,
|
|
33
|
-
string,
|
|
34
|
-
Account,
|
|
35
|
-
Message,
|
|
36
|
-
boolean,
|
|
37
|
-
]) => {
|
|
38
|
-
dispatch({ type: 'member_added', data: { chatId, chatName, account, me, message, withHistory } });
|
|
39
|
-
},
|
|
40
|
-
),
|
|
41
|
-
);
|
|
42
|
-
unsubscribes.push(
|
|
43
|
-
client.subscribe(
|
|
44
|
-
'chatify://member-removed',
|
|
45
|
-
([chatId, accountId, deleteHistory, message]: [string, string, boolean, Message]) => {
|
|
46
|
-
dispatch({ type: 'member_removed', data: { chatId, accountId, deleteHistory, me, message } });
|
|
47
|
-
},
|
|
48
|
-
),
|
|
49
|
-
);
|
|
50
|
-
unsubscribes.push(
|
|
51
|
-
client.subscribe(
|
|
52
|
-
'chatify://chat-name-changed',
|
|
53
|
-
([chatId, newName, message]: [string, string, Message]) => {
|
|
54
|
-
dispatch({ type: 'chatNameChanged_received', data: { chatId, newName, message } });
|
|
55
|
-
},
|
|
56
|
-
),
|
|
57
|
-
);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return () => {
|
|
61
|
-
unsubscribes.forEach((x) => x());
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
|
-
}, []);
|
|
66
|
-
}
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useDispatch } from './reducer';
|
|
3
|
+
import { Account, ChatListItem, Message, ReadEvent } from './models';
|
|
4
|
+
import { ChatifyClient } from './client';
|
|
5
|
+
|
|
6
|
+
export function useSignalRMonitor(me: string, client: ChatifyClient) {
|
|
7
|
+
const dispatch = useDispatch();
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
let unsubscribes: Array<() => void> = [];
|
|
11
|
+
|
|
12
|
+
client.connect().then(() => {
|
|
13
|
+
unsubscribes.push(
|
|
14
|
+
client.subscribe('chatify://new-message', ([message, requestId]: [Message, string]) => {
|
|
15
|
+
dispatch({ type: 'message_received', data: { message, requestId, me } });
|
|
16
|
+
}),
|
|
17
|
+
);
|
|
18
|
+
unsubscribes.push(
|
|
19
|
+
client.subscribe('chatify://chat-created', ([chat, requestId]: [ChatListItem, string]) => {
|
|
20
|
+
dispatch({ type: 'chat_created', data: { chat, requestId } });
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
unsubscribes.push(
|
|
24
|
+
client.subscribe('chatify://read', ([events]: [ReadEvent[]]) => {
|
|
25
|
+
dispatch({ type: 'read_received', data: { events } });
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
unsubscribes.push(
|
|
29
|
+
client.subscribe(
|
|
30
|
+
'chatify://member-added',
|
|
31
|
+
([chatId, chatName, account, message, withHistory]: [
|
|
32
|
+
string,
|
|
33
|
+
string,
|
|
34
|
+
Account,
|
|
35
|
+
Message,
|
|
36
|
+
boolean,
|
|
37
|
+
]) => {
|
|
38
|
+
dispatch({ type: 'member_added', data: { chatId, chatName, account, me, message, withHistory } });
|
|
39
|
+
},
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
unsubscribes.push(
|
|
43
|
+
client.subscribe(
|
|
44
|
+
'chatify://member-removed',
|
|
45
|
+
([chatId, accountId, deleteHistory, message]: [string, string, boolean, Message]) => {
|
|
46
|
+
dispatch({ type: 'member_removed', data: { chatId, accountId, deleteHistory, me, message } });
|
|
47
|
+
},
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
unsubscribes.push(
|
|
51
|
+
client.subscribe(
|
|
52
|
+
'chatify://chat-name-changed',
|
|
53
|
+
([chatId, newName, message]: [string, string, Message]) => {
|
|
54
|
+
dispatch({ type: 'chatNameChanged_received', data: { chatId, newName, message } });
|
|
55
|
+
},
|
|
56
|
+
),
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return () => {
|
|
61
|
+
unsubscribes.forEach((x) => x());
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
|
+
}, []);
|
|
66
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { useClient } from '../ChatifyContext';
|
|
3
|
-
import { UpdateChatNameRequest } from './models';
|
|
4
|
-
import { useDispatch, useSelect, useStateRef } from './reducer';
|
|
5
|
-
|
|
6
|
-
export function useUpdateChatNameMutation() {
|
|
7
|
-
const stateRef = useStateRef();
|
|
8
|
-
useSelect((x) => x.mutation.updateChatName, []);
|
|
9
|
-
const dispatch = useDispatch();
|
|
10
|
-
const client = useClient();
|
|
11
|
-
|
|
12
|
-
const invoke = useCallback((args: UpdateChatNameRequest) => {
|
|
13
|
-
dispatch({ type: 'updateChatName_fetch', data: void 0 });
|
|
14
|
-
client
|
|
15
|
-
.updateChatName(args)
|
|
16
|
-
.then(() => dispatch({ type: 'updateChatName_fulfilled', data: void 0 }))
|
|
17
|
-
.catch((error) => dispatch({ type: 'updateChatName_rejected', data: { error } }));
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
-
}, []);
|
|
21
|
-
|
|
22
|
-
return [invoke, stateRef.current.mutation.updateChatName] as const;
|
|
23
|
-
}
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useClient } from '../ChatifyContext';
|
|
3
|
+
import { UpdateChatNameRequest } from './models';
|
|
4
|
+
import { useDispatch, useSelect, useStateRef } from './reducer';
|
|
5
|
+
|
|
6
|
+
export function useUpdateChatNameMutation() {
|
|
7
|
+
const stateRef = useStateRef();
|
|
8
|
+
useSelect((x) => x.mutation.updateChatName, []);
|
|
9
|
+
const dispatch = useDispatch();
|
|
10
|
+
const client = useClient();
|
|
11
|
+
|
|
12
|
+
const invoke = useCallback((args: UpdateChatNameRequest) => {
|
|
13
|
+
dispatch({ type: 'updateChatName_fetch', data: void 0 });
|
|
14
|
+
client
|
|
15
|
+
.updateChatName(args)
|
|
16
|
+
.then(() => dispatch({ type: 'updateChatName_fulfilled', data: void 0 }))
|
|
17
|
+
.catch((error) => dispatch({ type: 'updateChatName_rejected', data: { error } }));
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
return [invoke, stateRef.current.mutation.updateChatName] as const;
|
|
23
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './ui';
|
|
2
|
-
export * from './core';
|
|
3
|
-
export * from './ChatifyContext';
|
|
1
|
+
export * from './ui';
|
|
2
|
+
export * from './core';
|
|
3
|
+
export * from './ChatifyContext';
|
package/src/styles/aside.scss
CHANGED
|
@@ -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-chat-list.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-chat-list.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
|
+
}
|