@droppii-org/chat-sdk 0.2.0 → 0.3.0
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/assets/images/muteNotificationWarning.png +0 -0
- package/dist/components/conversation/ConversationByGroupItem.d.ts +5 -3
- package/dist/components/conversation/ConversationByGroupItem.d.ts.map +1 -1
- package/dist/components/conversation/ConversationByGroupItem.js +23 -33
- package/dist/components/conversation/DeskConversationList.d.ts.map +1 -1
- package/dist/components/conversation/DeskConversationList.js +4 -3
- package/dist/components/conversation/SwipeActionButton.d.ts +11 -0
- package/dist/components/conversation/SwipeActionButton.d.ts.map +1 -0
- package/dist/components/conversation/SwipeActionButton.js +7 -0
- package/dist/components/conversation/SwipeableRow.d.ts +10 -0
- package/dist/components/conversation/SwipeableRow.d.ts.map +1 -0
- package/dist/components/conversation/SwipeableRow.js +62 -0
- package/dist/components/conversation/ThreadCard.d.ts +2 -1
- package/dist/components/conversation/ThreadCard.d.ts.map +1 -1
- package/dist/components/conversation/ThreadCard.js +2 -2
- package/dist/components/conversation-detail/ConversationMessageList.d.ts.map +1 -1
- package/dist/components/conversation-detail/ConversationMessageList.js +4 -1
- package/dist/components/conversation-inbox/ConversationInboxItem.d.ts.map +1 -1
- package/dist/components/conversation-inbox/ConversationInboxItem.js +14 -1
- package/dist/components/conversation-inbox/ConversationMuteSwipeAction.d.ts +8 -0
- package/dist/components/conversation-inbox/ConversationMuteSwipeAction.d.ts.map +1 -0
- package/dist/components/conversation-inbox/ConversationMuteSwipeAction.js +31 -0
- package/dist/components/conversation-inbox/MuteConversationConfirmModal.d.ts +9 -0
- package/dist/components/conversation-inbox/MuteConversationConfirmModal.d.ts.map +1 -0
- package/dist/components/conversation-inbox/MuteConversationConfirmModal.js +13 -0
- package/dist/components/conversation-inbox/index.d.ts +4 -0
- package/dist/components/conversation-inbox/index.d.ts.map +1 -1
- package/dist/components/conversation-inbox/index.js +2 -0
- package/dist/components/group/AddMemberModal.d.ts +1 -2
- package/dist/components/group/AddMemberModal.d.ts.map +1 -1
- package/dist/components/group/AddMemberModal.js +2 -2
- package/dist/components/message/GroupMembersDrawer.d.ts.map +1 -1
- package/dist/components/message/GroupMembersDrawer.js +22 -15
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +31 -2
- package/dist/constants/im.d.ts +13 -0
- package/dist/constants/im.d.ts.map +1 -1
- package/dist/constants/im.js +16 -0
- package/dist/constants/images.d.ts +1 -0
- package/dist/constants/images.d.ts.map +1 -1
- package/dist/constants/images.js +2 -0
- package/dist/hooks/global/useGlobalEvent.d.ts.map +1 -1
- package/dist/hooks/global/useGlobalEvent.js +10 -2
- package/dist/hooks/group/useConversationGroups.d.ts +20 -0
- package/dist/hooks/group/useConversationGroups.d.ts.map +1 -0
- package/dist/hooks/group/useConversationGroups.js +116 -0
- package/dist/hooks/group/useCreateGroup.d.ts.map +1 -1
- package/dist/hooks/group/useCreateGroup.js +34 -5
- package/dist/hooks/group/useEligibleAccountsForGroup.d.ts +1 -1
- package/dist/hooks/group/useEligibleAccountsForGroup.d.ts.map +1 -1
- package/dist/hooks/group/useEligibleAccountsForGroup.js +6 -9
- package/dist/hooks/group/useGetGroupCandidates.d.ts +2 -1
- package/dist/hooks/group/useGetGroupCandidates.d.ts.map +1 -1
- package/dist/hooks/group/useGetGroupCandidates.js +3 -2
- package/dist/hooks/group/useGroupMemberActions.d.ts +6 -0
- package/dist/hooks/group/useGroupMemberActions.d.ts.map +1 -1
- package/dist/hooks/group/useGroupMemberActions.js +12 -0
- package/dist/hooks/group/useGroupPermission.d.ts +3 -1
- package/dist/hooks/group/useGroupPermission.d.ts.map +1 -1
- package/dist/hooks/group/useGroupPermission.js +33 -37
- package/dist/hooks/session/useMuteConversation.d.ts +8 -0
- package/dist/hooks/session/useMuteConversation.d.ts.map +1 -0
- package/dist/hooks/session/useMuteConversation.js +37 -0
- package/dist/hooks/session/useSessionLatestPreview.d.ts +6 -2
- package/dist/hooks/session/useSessionLatestPreview.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/locales/vi/common.json +14 -0
- package/dist/locales/vi/conversation-inbox.json +16 -0
- package/dist/services/query.d.ts +1 -1
- package/dist/services/query.js +1 -1
- package/dist/services/routes.d.ts +1 -0
- package/dist/services/routes.d.ts.map +1 -1
- package/dist/services/routes.js +1 -0
- package/dist/store/conversation.d.ts.map +1 -1
- package/dist/store/conversation.js +25 -1
- package/dist/store/type.d.ts +1 -0
- package/dist/store/type.d.ts.map +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/types/dto.d.ts +8 -0
- package/dist/types/dto.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/common.js +20 -2
- package/dist/utils/imCommon.d.ts +1 -0
- package/dist/utils/imCommon.d.ts.map +1 -1
- package/dist/utils/messageLog.d.ts +4 -0
- package/dist/utils/messageLog.d.ts.map +1 -1
- package/dist/utils/messageLog.js +113 -0
- package/package.json +3 -2
- package/dist/hooks/group/useJoinedGroups.d.ts +0 -13
- package/dist/hooks/group/useJoinedGroups.d.ts.map +0 -1
- package/dist/hooks/group/useJoinedGroups.js +0 -33
|
Binary file
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LatestPreview } from "../../hooks/session/useSessionLatestPreview";
|
|
2
|
+
import type { ConversationGroupDisplayItem } from "../../hooks/group/useConversationGroups";
|
|
2
3
|
interface ConversationByGroupItemProps {
|
|
3
|
-
group:
|
|
4
|
+
group: ConversationGroupDisplayItem;
|
|
5
|
+
latestPreview?: LatestPreview;
|
|
4
6
|
}
|
|
5
|
-
declare const ConversationByGroupItem: ({ group }: ConversationByGroupItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const ConversationByGroupItem: ({ group, latestPreview, }: ConversationByGroupItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export default ConversationByGroupItem;
|
|
7
9
|
//# sourceMappingURL=ConversationByGroupItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationByGroupItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationByGroupItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConversationByGroupItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationByGroupItem.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAMxF,UAAU,4BAA4B;IACpC,KAAK,EAAE,4BAA4B,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,uBAAuB,GAAI,2BAG9B,4BAA4B,4CA2D9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,50 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
3
|
import { Avatar } from "antd";
|
|
5
4
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
6
5
|
import { useTranslation } from "react-i18next";
|
|
7
|
-
import { SessionType } from "@droppii-org/wasm-client-sdk";
|
|
8
6
|
import useConversationStore from "../../store/conversation";
|
|
9
|
-
import {
|
|
10
|
-
import { formatTimestamp } from "../../utils/common";
|
|
7
|
+
import { useChatContext } from "../../context/ChatContext";
|
|
8
|
+
import { formatTimestamp, parseLatestMessage } from "../../utils/common";
|
|
11
9
|
import ThreadCard from "./ThreadCard";
|
|
12
|
-
const ConversationByGroupItem = ({ group }) => {
|
|
10
|
+
const ConversationByGroupItem = ({ group, latestPreview, }) => {
|
|
13
11
|
var _a;
|
|
14
12
|
const { t } = useTranslation();
|
|
15
|
-
const
|
|
13
|
+
const user = useChatContext().user;
|
|
16
14
|
const router = useRouter();
|
|
17
15
|
const pathname = usePathname();
|
|
18
16
|
const searchParams = useSearchParams();
|
|
19
17
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
20
18
|
const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const handleClick =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
setConversationData(conversation);
|
|
33
|
-
updateConversationList([conversation], "filter");
|
|
34
|
-
setSelectedConversationId(conversation.conversationID);
|
|
35
|
-
const newSearchParams = new URLSearchParams(searchParams);
|
|
36
|
-
newSearchParams.set("threadId", conversation.conversationID);
|
|
37
|
-
newSearchParams.delete("userId");
|
|
38
|
-
newSearchParams.delete("groupId");
|
|
39
|
-
newSearchParams.delete("botId");
|
|
40
|
-
router.push(`${pathname}?${newSearchParams.toString()}`);
|
|
41
|
-
}
|
|
42
|
-
finally {
|
|
43
|
-
setIsOpening(false);
|
|
44
|
-
}
|
|
19
|
+
const isSelected = useConversationStore((state) => state.selectedConversationId === group.conversationId);
|
|
20
|
+
const { conversation } = group;
|
|
21
|
+
const handleClick = () => {
|
|
22
|
+
setConversationData(conversation);
|
|
23
|
+
setSelectedConversationId(conversation.conversationID);
|
|
24
|
+
const newSearchParams = new URLSearchParams(searchParams);
|
|
25
|
+
newSearchParams.set("threadId", conversation.conversationID);
|
|
26
|
+
newSearchParams.delete("userId");
|
|
27
|
+
newSearchParams.delete("groupId");
|
|
28
|
+
newSearchParams.delete("botId");
|
|
29
|
+
router.push(`${pathname}?${newSearchParams.toString()}`);
|
|
45
30
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
const latestMsg = (latestPreview === null || latestPreview === void 0 ? void 0 : latestPreview.latestMsg) || "";
|
|
32
|
+
const latestMsgSendTime = (latestPreview === null || latestPreview === void 0 ? void 0 : latestPreview.latestMsgSendTime) || 0;
|
|
33
|
+
return (_jsx(ThreadCard, { onClick: handleClick, isSelected: isSelected, unreadCount: conversation.unreadCount, preview: parseLatestMessage(latestMsg, user === null || user === void 0 ? void 0 : user.userID, t, {
|
|
34
|
+
peerType: conversation.peerType,
|
|
35
|
+
showName: conversation.showName,
|
|
36
|
+
}), time: latestMsgSendTime > 0
|
|
37
|
+
? formatTimestamp(latestMsgSendTime, { hasTime: true })
|
|
38
|
+
: undefined, avatar: _jsx(Avatar, { size: 48, src: conversation.faceURL, children: ((_a = conversation.showName) === null || _a === void 0 ? void 0 : _a.charAt(0)) || "G" }), title: _jsx("h3", { className: "truncate text-sm font-semibold text-gray-900", children: conversation.showName }) }));
|
|
49
39
|
};
|
|
50
40
|
export default ConversationByGroupItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeskConversationList.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/DeskConversationList.tsx"],"names":[],"mappings":"AA4BA,QAAA,MAAM,oBAAoB,+
|
|
1
|
+
{"version":3,"file":"DeskConversationList.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/DeskConversationList.tsx"],"names":[],"mappings":"AA4BA,QAAA,MAAM,oBAAoB,+CA+RzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -16,7 +16,7 @@ import { useGetSession } from "../../hooks/session/useGetSession";
|
|
|
16
16
|
import { useSortedSessions } from "../../hooks/session/useSortedSessions";
|
|
17
17
|
import { useSessionLatestPreview } from "../../hooks/session/useSessionLatestPreview";
|
|
18
18
|
import { useGetTeamSessionSummary } from "../../hooks/session/useGetTeamSessionSummary";
|
|
19
|
-
import {
|
|
19
|
+
import { useConversationGroups } from "../../hooks/group/useConversationGroups";
|
|
20
20
|
import { DChatSDK } from "../../constants/sdk";
|
|
21
21
|
import emitter from "../../utils/events";
|
|
22
22
|
import { ALL_GROUPS_KEY, getFilterConfig, } from "../../components/session/sessionMenuItems";
|
|
@@ -38,9 +38,10 @@ const DeskConversationList = () => {
|
|
|
38
38
|
const isAllGroupsView = viewMode === "allGroups";
|
|
39
39
|
const { data: teamSummaries } = useGetTeamSessionSummary();
|
|
40
40
|
const { dataFlatten: rawSessions, hasNextPage, fetchNextPage, refetch, } = useGetSession({ filter: filterSummary, options: { isEnabled: !isAllGroupsView } });
|
|
41
|
-
const { groups:
|
|
41
|
+
const { groups: conversationGroups, fetchNextPage: fetchNextGroupsPage, hasNextPage: hasNextGroupsPage, isLoading: isConversationGroupsLoading, } = useConversationGroups({ enabled: isAllGroupsView });
|
|
42
42
|
const latestPreviewMap = useSessionLatestPreview(rawSessions);
|
|
43
43
|
const sessions = useSortedSessions(rawSessions, latestPreviewMap);
|
|
44
|
+
const groupLatestPreviewMap = useSessionLatestPreview(conversationGroups);
|
|
44
45
|
const currentFilterKey = isAllGroupsView
|
|
45
46
|
? ALL_GROUPS_KEY
|
|
46
47
|
: filterSummary.status || filterSummary.tag || "";
|
|
@@ -104,7 +105,7 @@ const DeskConversationList = () => {
|
|
|
104
105
|
height: "100%",
|
|
105
106
|
overflow: showSearch ? "hidden" : "auto",
|
|
106
107
|
position: "relative",
|
|
107
|
-
}, children: [isAllGroupsView ? (
|
|
108
|
+
}, children: [isAllGroupsView ? (isConversationGroupsLoading ? (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Spin, {}) })) : !(conversationGroups === null || conversationGroups === void 0 ? void 0 : conversationGroups.length) ? (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Empty, { image: _jsx(Icon, { icon: "chat-square-b", size: 80, className: "text-gray-300" }), description: t("no_conversation") }) })) : (_jsx(InfiniteScroll, { dataLength: conversationGroups.length, next: fetchNextGroupsPage, hasMore: !!hasNextGroupsPage, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableConversationsDiv", children: conversationGroups.map((group) => (_jsx(ConversationByGroupItem, { group: group, latestPreview: groupLatestPreviewMap.get(group.conversationId) }, group.groupId))) }))) : (_jsx(InfiniteScroll, { dataLength: (sessions === null || sessions === void 0 ? void 0 : sessions.length) || 0, next: fetchNextPage, hasMore: hasNextPage, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableConversationsDiv", children: (sessions === null || sessions === void 0 ? void 0 : sessions.length) === 0 ? (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Empty, { image: _jsx(Icon, { icon: "chat-square-b", size: 80, className: "text-gray-300" }), description: t("no_conversation") }) })) : ((_b = sessions === null || sessions === void 0 ? void 0 : sessions.map) === null || _b === void 0 ? void 0 : _b.call(sessions, (session) => (_jsx(ConversationBySessionItem, { sessionItem: session, latestPreview: latestPreviewMap.get(session.conversationId) }, session.conversationId)))) })), _jsx(Drawer, { open: showSearch, mask: false, closeIcon: false, styles: {
|
|
108
109
|
body: {
|
|
109
110
|
padding: 0,
|
|
110
111
|
},
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const SWIPE_ACTION_WIDTH = 76;
|
|
2
|
+
export interface SwipeActionButtonProps {
|
|
3
|
+
icon: string;
|
|
4
|
+
label: string;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
testId?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const SwipeActionButton: ({ icon, label, onClick, className, testId, }: SwipeActionButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default SwipeActionButton;
|
|
11
|
+
//# sourceMappingURL=SwipeActionButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwipeActionButton.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/SwipeActionButton.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,iBAAiB,GAAI,8CAMxB,sBAAsB,4CAgBxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { Icon } from "../../components/icon";
|
|
5
|
+
export const SWIPE_ACTION_WIDTH = 76;
|
|
6
|
+
const SwipeActionButton = ({ icon, label, onClick, className, testId, }) => (_jsxs("button", { type: "button", onClick: onClick, "data-testid": testId, className: clsx("flex h-full shrink-0 flex-col items-center justify-center gap-1 p-2 text-white", className), style: { width: SWIPE_ACTION_WIDTH }, children: [_jsx(Icon, { icon: icon, size: 16 }), _jsx("span", { className: "text-center text-[10px] font-[510] leading-[1.6]", children: label })] }));
|
|
7
|
+
export default SwipeActionButton;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface SwipeableRowProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
actions: (close: () => void) => ReactNode;
|
|
5
|
+
actionsWidth: number;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const SwipeableRow: ({ children, actions, actionsWidth, disabled, }: SwipeableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default SwipeableRow;
|
|
10
|
+
//# sourceMappingURL=SwipeableRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwipeableRow.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/SwipeableRow.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAOnD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,YAAY,GAAI,gDAKnB,iBAAiB,4CA4FnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useDrag } from "@use-gesture/react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
const OPEN_THRESHOLD_RATIO = 0.5;
|
|
7
|
+
const DIRECTION_LOCK_DISTANCE = 8;
|
|
8
|
+
const SwipeableRow = ({ children, actions, actionsWidth, disabled = false, }) => {
|
|
9
|
+
const [offset, setOffset] = useState(0);
|
|
10
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
11
|
+
const containerRef = useRef(null);
|
|
12
|
+
const shouldSuppressClickRef = useRef(false);
|
|
13
|
+
const close = () => setOffset(0);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (offset === 0)
|
|
16
|
+
return;
|
|
17
|
+
const handleOutsidePointerDown = (event) => {
|
|
18
|
+
const container = containerRef.current;
|
|
19
|
+
if (!container)
|
|
20
|
+
return;
|
|
21
|
+
if (container.contains(event.target))
|
|
22
|
+
return;
|
|
23
|
+
close();
|
|
24
|
+
};
|
|
25
|
+
document.addEventListener("pointerdown", handleOutsidePointerDown);
|
|
26
|
+
return () => document.removeEventListener("pointerdown", handleOutsidePointerDown);
|
|
27
|
+
}, [offset, close]);
|
|
28
|
+
const bind = useDrag(({ active, offset: [ox], last, tap }) => {
|
|
29
|
+
if (tap)
|
|
30
|
+
return;
|
|
31
|
+
setOffset(-ox);
|
|
32
|
+
if (active) {
|
|
33
|
+
setIsDragging(true);
|
|
34
|
+
shouldSuppressClickRef.current = true;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
setIsDragging(false);
|
|
38
|
+
if (last) {
|
|
39
|
+
setOffset((current) => current > actionsWidth * OPEN_THRESHOLD_RATIO ? actionsWidth : 0);
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
enabled: !disabled,
|
|
43
|
+
axis: "lock",
|
|
44
|
+
axisThreshold: { mouse: DIRECTION_LOCK_DISTANCE, touch: DIRECTION_LOCK_DISTANCE },
|
|
45
|
+
bounds: { left: -actionsWidth, right: 0 },
|
|
46
|
+
from: () => [-offset, 0],
|
|
47
|
+
filterTaps: true,
|
|
48
|
+
});
|
|
49
|
+
const isOpen = offset > 0;
|
|
50
|
+
const handleContentClickCapture = (event) => {
|
|
51
|
+
const wasDragging = shouldSuppressClickRef.current;
|
|
52
|
+
shouldSuppressClickRef.current = false;
|
|
53
|
+
if (!wasDragging && !isOpen)
|
|
54
|
+
return;
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
if (!wasDragging)
|
|
58
|
+
close();
|
|
59
|
+
};
|
|
60
|
+
return (_jsxs("div", Object.assign({ ref: containerRef }, bind(), { className: "relative w-full touch-pan-y overflow-hidden", children: [_jsx("div", { "aria-hidden": !isOpen, className: "absolute inset-y-0 right-0 flex", style: { width: actionsWidth }, children: actions(close) }), _jsx("div", { className: clsx("relative bg-white transition-transform duration-200 ease-out", isDragging && "select-none transition-none"), style: { transform: `translate3d(-${offset}px, 0, 0)` }, onClickCapture: handleContentClickCapture, children: children })] })));
|
|
61
|
+
};
|
|
62
|
+
export default SwipeableRow;
|
|
@@ -8,7 +8,8 @@ export interface ThreadCardProps {
|
|
|
8
8
|
isSelected?: boolean;
|
|
9
9
|
onClick: () => void;
|
|
10
10
|
testId?: string;
|
|
11
|
+
muteIndicator?: ReactNode;
|
|
11
12
|
}
|
|
12
|
-
declare const ThreadCard: ({ avatar, title, preview, time, unreadCount, isSelected, onClick, testId, }: ThreadCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const ThreadCard: ({ avatar, title, preview, time, unreadCount, isSelected, onClick, testId, muteIndicator, }: ThreadCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default ThreadCard;
|
|
14
15
|
//# sourceMappingURL=ThreadCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadCard.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ThreadCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAoBvC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ThreadCard.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ThreadCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAoBvC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,QAAA,MAAM,UAAU,GAAI,4FAUjB,eAAe,4CA6CjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -7,9 +7,9 @@ const UnreadBadge = ({ count }) => {
|
|
|
7
7
|
const isWide = label.length > 1;
|
|
8
8
|
return (_jsx("span", { className: clsx("inline-flex h-5 shrink-0 items-center justify-center rounded-[32px] border-2 border-white bg-gradient-danger-light px-[3px] text-center text-[12px] font-semibold leading-[160%] text-white", isWide ? "min-w-8" : "min-w-5"), children: label }));
|
|
9
9
|
};
|
|
10
|
-
const ThreadCard = ({ avatar, title, preview, time, unreadCount = 0, isSelected = false, onClick, testId, }) => {
|
|
10
|
+
const ThreadCard = ({ avatar, title, preview, time, unreadCount = 0, isSelected = false, onClick, testId, muteIndicator, }) => {
|
|
11
11
|
const hasUnread = unreadCount > 0;
|
|
12
|
-
return (_jsxs("button", { type: "button", onClick: onClick, "data-testid": testId, className: clsx("relative flex w-full shrink-0 items-start gap-2 border-b border-gray-25 p-3 text-left transition-colors hover:bg-[#f5f5f5] focus:outline-none focus-visible:ring-2 focus-visible:ring-chat-ring", isSelected ? "bg-blue-50" : "bg-white"), children: [isSelected && (_jsx("span", { className: "absolute bottom-0 left-0 top-0 w-1 bg-blue-500" })), avatar, _jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsxs("div", { className: "flex min-h-[25.6px] items-center justify-between gap-1", children: [_jsx("div", { className: "min-w-0 flex-1", children: title }), time && (_jsx("span", { className: "shrink-0 text-[12px] font-normal leading-[160%] text-gray-400 [font-feature-settings:'liga'_off,'clig'_off]", children: time }))] }), _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("p", { className: clsx("min-w-0 flex-1 truncate text-[14px] leading-[160%] [font-feature-settings:'liga'_off,'clig'_off]", hasUnread
|
|
12
|
+
return (_jsxs("button", { type: "button", onClick: onClick, "data-testid": testId, className: clsx("relative flex w-full shrink-0 items-start gap-2 border-b border-gray-25 p-3 text-left transition-colors hover:bg-[#f5f5f5] focus:outline-none focus-visible:ring-2 focus-visible:ring-chat-ring", isSelected ? "bg-blue-50" : "bg-white"), children: [isSelected && (_jsx("span", { className: "absolute bottom-0 left-0 top-0 w-1 bg-blue-500" })), avatar, _jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsxs("div", { className: "flex min-h-[25.6px] items-center justify-between gap-1", children: [_jsx("div", { className: "min-w-0 flex-1", children: title }), muteIndicator, time && (_jsx("span", { className: "shrink-0 text-[12px] font-normal leading-[160%] text-gray-400 [font-feature-settings:'liga'_off,'clig'_off]", children: time }))] }), _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("p", { className: clsx("min-w-0 flex-1 truncate text-[14px] leading-[160%] [font-feature-settings:'liga'_off,'clig'_off]", hasUnread
|
|
13
13
|
? "font-[510] text-black"
|
|
14
14
|
: "font-normal tracking-[0.14px] text-gray-600"), children: preview }), hasUnread && _jsx(UnreadBadge, { count: unreadCount })] })] })] }));
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationMessageList.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-detail/ConversationMessageList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationMessageList.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-detail/ConversationMessageList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAmBzE,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,QAAA,MAAM,uBAAuB,GAAI,gBAAgB,4BAA4B,4CAyL5E,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -10,6 +10,7 @@ import { useMessage } from "../../hooks/message/useMessage";
|
|
|
10
10
|
import { useMessageListScroll } from "../../hooks/message/useMessageListScroll";
|
|
11
11
|
import { usePinMessage } from "../../hooks/message/usePinMessage";
|
|
12
12
|
import { useRevokeMessage } from "../../hooks/message/useRevokeMessage";
|
|
13
|
+
import { useGroupPermission } from "../../hooks/group/useGroupPermission";
|
|
13
14
|
import useConversationStore from "../../store/conversation";
|
|
14
15
|
import useAuthStore from "../../store/auth";
|
|
15
16
|
import { isGroupChat as resolveIsGroupChat } from "../../utils/conversation";
|
|
@@ -28,6 +29,8 @@ const ConversationMessageList = ({ bottomSlot }) => {
|
|
|
28
29
|
const setSearchClientMsgID = useConversationStore((state) => state.setSearchClientMsgID);
|
|
29
30
|
const conversationId = selectedConversationId || (conversation === null || conversation === void 0 ? void 0 : conversation.conversationID) || "";
|
|
30
31
|
const isGroupChat = conversation ? resolveIsGroupChat(conversation) : false;
|
|
32
|
+
const permissions = useGroupPermission(conversation === null || conversation === void 0 ? void 0 : conversation.groupID);
|
|
33
|
+
const canPinMessage = !isGroupChat || permissions.pinMessage;
|
|
31
34
|
const messageController = useMessage(conversationId, searchClientMsgID, true, true);
|
|
32
35
|
const { scrollRef, loadMoreOldMessage, handleInfiniteScroll, scrollToBottomIfAtBottom, scrollToMessage, } = useMessageListScroll(Object.assign({ conversationId, userId: (user === null || user === void 0 ? void 0 : user.userID) || authUserID }, messageController));
|
|
33
36
|
const { loadState, moreOldLoading } = messageController;
|
|
@@ -92,6 +95,6 @@ const ConversationMessageList = ({ bottomSlot }) => {
|
|
|
92
95
|
target: scrollRef,
|
|
93
96
|
enable: !!openToolboxMessageId,
|
|
94
97
|
});
|
|
95
|
-
return (_jsxs("div", { "data-testid": "conversation-message-list", className: "relative flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-white", children: [isMessageLoading ? (_jsx("div", { className: "flex flex-1 items-center justify-center py-12", children: _jsx(Spin, {}) })) : (_jsxs(MessageInfiniteScroll, { scrollRef: scrollRef, scrollableTargetId: "scrollableConversationMessagesDiv", loadState: loadState, moreOldLoading: moreOldLoading, onLoadMoreOld: loadMoreOldMessage, onScroll: handleInfiniteScroll, containerClassName: "h-full", empty: _jsx("div", { className: "flex flex-1 items-center justify-center py-12", children: _jsx(Empty, { description: t("empty.no_messages") }) }), children: [bottomSlot, loadState.messageList.map((message, index, array) => (_jsx(MessageItem, { message: message, allMessages: array, isGroupChat: isGroupChat, forceHideTip: index === 0 && !!bottomSlot, contextMenuOpen: openToolboxMessageId === message.clientMsgID, onContextMenuOpenChange: (open) => setOpenToolboxMessageId(open ? message.clientMsgID : null), onQuoteMessage: setQuotedMessage, onRevokeMessage: handleRevokeMessage, onPressQuoteMessage: onPressQuoteMessage, onPinMessage: handlePinMessage, onUnpinMessage: handleUnpinMessage, enableLongPress: true }, message.clientMsgID)))] })), _jsx(PinLimitModal, { open: pinLimitModalOpen, max: pinnedTotalCount, onClose: () => setPinLimitModalOpen(false) })] }));
|
|
98
|
+
return (_jsxs("div", { "data-testid": "conversation-message-list", className: "relative flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-white", children: [isMessageLoading ? (_jsx("div", { className: "flex flex-1 items-center justify-center py-12", children: _jsx(Spin, {}) })) : (_jsxs(MessageInfiniteScroll, { scrollRef: scrollRef, scrollableTargetId: "scrollableConversationMessagesDiv", loadState: loadState, moreOldLoading: moreOldLoading, onLoadMoreOld: loadMoreOldMessage, onScroll: handleInfiniteScroll, containerClassName: "h-full", empty: _jsx("div", { className: "flex flex-1 items-center justify-center py-12", children: _jsx(Empty, { description: t("empty.no_messages") }) }), children: [bottomSlot, loadState.messageList.map((message, index, array) => (_jsx(MessageItem, { message: message, allMessages: array, isGroupChat: isGroupChat, forceHideTip: index === 0 && !!bottomSlot, contextMenuOpen: openToolboxMessageId === message.clientMsgID, onContextMenuOpenChange: (open) => setOpenToolboxMessageId(open ? message.clientMsgID : null), onQuoteMessage: setQuotedMessage, onRevokeMessage: handleRevokeMessage, onPressQuoteMessage: onPressQuoteMessage, onPinMessage: canPinMessage ? handlePinMessage : undefined, onUnpinMessage: canPinMessage ? handleUnpinMessage : undefined, enableLongPress: true }, message.clientMsgID)))] })), _jsx(PinLimitModal, { open: pinLimitModalOpen, max: pinnedTotalCount, onClose: () => setPinLimitModalOpen(false) })] }));
|
|
96
99
|
};
|
|
97
100
|
export default ConversationMessageList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationInboxItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/ConversationInboxItem.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationInboxItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/ConversationInboxItem.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAkBjE,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC/C;AAQD,QAAA,MAAM,qBAAqB,GAAI,mBAAmB,0BAA0B,4CA4E3E,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -6,9 +6,15 @@ import useAuthStore from "../../store/auth";
|
|
|
6
6
|
import { formatTimestamp, parseLatestMessage } from "../../utils/common";
|
|
7
7
|
import { resolvePeerBadgeLabel, resolveConversationDisplayName, } from "../../utils/conversation";
|
|
8
8
|
import { useConversationAvatarUrl } from "../../hooks/conversation/useConversationAvatarUrl";
|
|
9
|
+
import { useIsJoinedGroup } from "../../hooks/session/useIsJoinedGroup";
|
|
10
|
+
import { isConversationMuted } from "../../hooks/session/useMuteConversation";
|
|
9
11
|
import ThreadCard from "../../components/conversation/ThreadCard";
|
|
12
|
+
import SwipeableRow from "../../components/conversation/SwipeableRow";
|
|
13
|
+
import { SWIPE_ACTION_WIDTH } from "../../components/conversation/SwipeActionButton";
|
|
14
|
+
import { Icon } from "../../components/icon";
|
|
10
15
|
import ConversationPeerAvatar from "./ConversationPeerAvatar";
|
|
11
16
|
import ConversationInboxTitle from "./ConversationInboxTitle";
|
|
17
|
+
import ConversationMuteSwipeAction from "./ConversationMuteSwipeAction";
|
|
12
18
|
const formatLatestMessageTime = (sendTime) => {
|
|
13
19
|
if (!sendTime)
|
|
14
20
|
return "";
|
|
@@ -26,6 +32,13 @@ const ConversationInboxItem = ({ item, onClick }) => {
|
|
|
26
32
|
const latestMessagePreview = parseLatestMessage(item.latestMsg, currentUserId, tCommon, { peerType: item.peerType, showName: item.showName });
|
|
27
33
|
const latestMessageTime = formatLatestMessageTime(item.latestMsgSendTime || null);
|
|
28
34
|
const unreadCount = (_a = item.unreadCount) !== null && _a !== void 0 ? _a : 0;
|
|
29
|
-
|
|
35
|
+
const isMuted = isConversationMuted(item.recvMsgOpt);
|
|
36
|
+
const { isJoined } = useIsJoinedGroup(item.groupID);
|
|
37
|
+
const hasLostGroupAccess = Boolean(item.groupID) && isJoined !== true;
|
|
38
|
+
const threadCard = (_jsx(ThreadCard, { testId: "conversation-inbox-thread-card", onClick: () => onClick(item), unreadCount: unreadCount, time: latestMessageTime, preview: latestMessagePreview, muteIndicator: isMuted ? (_jsx(Icon, { icon: "bell-off-b", size: 16, "aria-label": t("thread_card.mute.muted_icon_label"), className: "shrink-0 text-gray-400" })) : null, avatar: _jsx(ConversationPeerAvatar, { peerType: item.peerType, displayName: displayName, avatarUrl: avatarUrl, badgeLabel: badgeLabel }), title: _jsx(ConversationInboxTitle, { peerType: item.peerType, displayName: displayName, hasUnread: unreadCount > 0 }) }));
|
|
39
|
+
if (hasLostGroupAccess) {
|
|
40
|
+
return threadCard;
|
|
41
|
+
}
|
|
42
|
+
return (_jsx(SwipeableRow, { actionsWidth: SWIPE_ACTION_WIDTH, actions: (closeSwipe) => (_jsx(ConversationMuteSwipeAction, { conversationID: item.conversationID, isMuted: isMuted, onClose: closeSwipe })), children: threadCard }));
|
|
30
43
|
};
|
|
31
44
|
export default ConversationInboxItem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ConversationMuteSwipeActionProps {
|
|
2
|
+
conversationID: string;
|
|
3
|
+
isMuted: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
declare const ConversationMuteSwipeAction: ({ conversationID, isMuted, onClose, }: ConversationMuteSwipeActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default ConversationMuteSwipeAction;
|
|
8
|
+
//# sourceMappingURL=ConversationMuteSwipeAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationMuteSwipeAction.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/ConversationMuteSwipeAction.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,gCAAgC;IAC/C,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,2BAA2B,GAAI,uCAIlC,gCAAgC,4CAwDlC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import SwipeActionButton from "../../components/conversation/SwipeActionButton";
|
|
6
|
+
import { useMuteConversation } from "../../hooks/session/useMuteConversation";
|
|
7
|
+
import MuteConversationConfirmModal from "./MuteConversationConfirmModal";
|
|
8
|
+
const ConversationMuteSwipeAction = ({ conversationID, isMuted, onClose, }) => {
|
|
9
|
+
const { t } = useTranslation("conversation-inbox");
|
|
10
|
+
const { muteConversation, unmuteConversation, isPending } = useMuteConversation();
|
|
11
|
+
const [isConfirmOpen, setIsConfirmOpen] = useState(false);
|
|
12
|
+
const stopPropagation = (event) => {
|
|
13
|
+
event.stopPropagation();
|
|
14
|
+
};
|
|
15
|
+
const handleClick = () => {
|
|
16
|
+
onClose();
|
|
17
|
+
if (isMuted) {
|
|
18
|
+
unmuteConversation(conversationID);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
setIsConfirmOpen(true);
|
|
22
|
+
};
|
|
23
|
+
const handleConfirmMute = () => {
|
|
24
|
+
setIsConfirmOpen(false);
|
|
25
|
+
muteConversation(conversationID);
|
|
26
|
+
};
|
|
27
|
+
return (_jsxs(_Fragment, { children: [_jsx(SwipeActionButton, { testId: "conversation-inbox-mute-action", icon: isMuted ? "bell-b" : "bell-off-b", label: t(isMuted
|
|
28
|
+
? "thread_card.mute.unmute_action"
|
|
29
|
+
: "thread_card.mute.mute_action"), onClick: handleClick, className: "bg-gray-400" }), _jsx("span", { role: "presentation", onPointerDown: stopPropagation, onPointerMove: stopPropagation, onPointerUp: stopPropagation, onClick: stopPropagation, children: _jsx(MuteConversationConfirmModal, { open: isConfirmOpen, loading: isPending, onCancel: () => setIsConfirmOpen(false), onConfirm: handleConfirmMute }) })] }));
|
|
30
|
+
};
|
|
31
|
+
export default ConversationMuteSwipeAction;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface MuteConversationConfirmModalProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
loading: boolean;
|
|
4
|
+
onCancel: () => void;
|
|
5
|
+
onConfirm: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const MuteConversationConfirmModal: ({ open, loading, onCancel, onConfirm, }: MuteConversationConfirmModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default MuteConversationConfirmModal;
|
|
9
|
+
//# sourceMappingURL=MuteConversationConfirmModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MuteConversationConfirmModal.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/MuteConversationConfirmModal.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,QAAA,MAAM,4BAA4B,GAAI,yCAKnC,iCAAiC,4CAmEnC,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Modal, Button } from "antd";
|
|
4
|
+
import { Trans, useTranslation } from "react-i18next";
|
|
5
|
+
import { images } from "../../constants/images";
|
|
6
|
+
const MuteConversationConfirmModal = ({ open, loading, onCancel, onConfirm, }) => {
|
|
7
|
+
const { t } = useTranslation("conversation-inbox");
|
|
8
|
+
return (_jsx(Modal, { open: open, onCancel: onCancel, footer: null, closable: false, centered: true, width: 400, maskClosable: !loading, keyboard: !loading, styles: {
|
|
9
|
+
content: { padding: 0, overflow: "hidden" },
|
|
10
|
+
body: { padding: 0 },
|
|
11
|
+
}, children: _jsxs("div", { role: "alertdialog", "aria-label": t("thread_card.mute.confirm_title"), className: "flex flex-col", children: [_jsx("div", { className: "border-b border-gray-25 p-4", children: _jsx("p", { className: "text-center text-[18px] font-bold leading-[1.6] text-gray-900", children: t("thread_card.mute.confirm_title") }) }), _jsx("div", { className: "flex items-center justify-center p-4", children: _jsx("img", { src: images.muteNotificationWarning, alt: "", "aria-hidden": "true", className: "h-[144px] w-[120px]" }) }), _jsx("p", { className: "px-4 pb-4 text-[16px] leading-[1.6] text-gray-900", children: _jsx(Trans, { t: t, i18nKey: "thread_card.mute.confirm_desc", components: { bold: _jsx("strong", { className: "font-bold" }) } }) }), _jsx("div", { className: "border-t border-gray-25" }), _jsxs("div", { className: "flex gap-2 p-4", children: [_jsx(Button, { className: "h-12 flex-1 !rounded-lg !border-gray-25 !bg-gray-25 !text-[16px] !font-medium !text-gray-900", onClick: onCancel, disabled: loading, children: t("thread_card.mute.confirm_secondary") }), _jsx(Button, { type: "primary", className: "h-12 flex-1 !rounded-lg !border-primary-400 !bg-primary-400 !text-[16px] !font-medium !text-white hover:!border-primary-300 hover:!bg-primary-300", onClick: onConfirm, loading: loading, children: t("thread_card.mute.confirm_primary") })] })] }) }));
|
|
12
|
+
};
|
|
13
|
+
export default MuteConversationConfirmModal;
|
|
@@ -7,4 +7,8 @@ export { default as ConversationInboxItem } from "./ConversationInboxItem";
|
|
|
7
7
|
export type { ConversationInboxItemProps } from "./ConversationInboxItem";
|
|
8
8
|
export { default as ConversationInboxList } from "./ConversationInboxList";
|
|
9
9
|
export type { ConversationInboxListProps } from "./ConversationInboxList";
|
|
10
|
+
export { default as ConversationMuteSwipeAction } from "./ConversationMuteSwipeAction";
|
|
11
|
+
export type { ConversationMuteSwipeActionProps } from "./ConversationMuteSwipeAction";
|
|
12
|
+
export { default as MuteConversationConfirmModal } from "./MuteConversationConfirmModal";
|
|
13
|
+
export type { MuteConversationConfirmModalProps } from "./MuteConversationConfirmModal";
|
|
10
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-inbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACvF,YAAY,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAEtF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACzF,YAAY,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -3,3 +3,5 @@ export { default as ConversationPeerAvatar } from "./ConversationPeerAvatar";
|
|
|
3
3
|
export { default as ConversationInboxTitle } from "./ConversationInboxTitle";
|
|
4
4
|
export { default as ConversationInboxItem } from "./ConversationInboxItem";
|
|
5
5
|
export { default as ConversationInboxList } from "./ConversationInboxList";
|
|
6
|
+
export { default as ConversationMuteSwipeAction } from "./ConversationMuteSwipeAction";
|
|
7
|
+
export { default as MuteConversationConfirmModal } from "./MuteConversationConfirmModal";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
interface AddMemberModalProps {
|
|
2
2
|
open: boolean;
|
|
3
3
|
groupID: string;
|
|
4
|
-
existingMemberIDs: string[];
|
|
5
4
|
onClose: () => void;
|
|
6
5
|
}
|
|
7
|
-
declare const AddMemberModal: ({ open, groupID,
|
|
6
|
+
declare const AddMemberModal: ({ open, groupID, onClose, }: AddMemberModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export default AddMemberModal;
|
|
9
8
|
//# sourceMappingURL=AddMemberModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddMemberModal.d.ts","sourceRoot":"","sources":["../../../src/components/group/AddMemberModal.tsx"],"names":[],"mappings":"AAYA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,
|
|
1
|
+
{"version":3,"file":"AddMemberModal.d.ts","sourceRoot":"","sources":["../../../src/components/group/AddMemberModal.tsx"],"names":[],"mappings":"AAYA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,cAAc,GAAI,6BAIrB,mBAAmB,4CA2LrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -8,13 +8,13 @@ import { useTranslation } from "react-i18next";
|
|
|
8
8
|
import { Icon } from "../../components/icon";
|
|
9
9
|
import { useEligibleAccountsForGroup } from "../../hooks/group/useEligibleAccountsForGroup";
|
|
10
10
|
import { useAddGroupMember } from "../../hooks/group/useAddGroupMember";
|
|
11
|
-
const AddMemberModal = ({ open, groupID,
|
|
11
|
+
const AddMemberModal = ({ open, groupID, onClose, }) => {
|
|
12
12
|
const { t } = useTranslation("conversation-inbox");
|
|
13
13
|
const { t: tCommon } = useTranslation();
|
|
14
14
|
const [search, setSearch] = useState("");
|
|
15
15
|
const [selectedMembers, setSelectedMembers] = useState([]);
|
|
16
16
|
const debouncedSearch = useDebounce(search, { wait: 300 });
|
|
17
|
-
const { accounts, isLoading, fetchNextPage, hasNextPage, isFetchingNextPage } = useEligibleAccountsForGroup(debouncedSearch,
|
|
17
|
+
const { accounts, isLoading, fetchNextPage, hasNextPage, isFetchingNextPage } = useEligibleAccountsForGroup(debouncedSearch, groupID, open);
|
|
18
18
|
const { mutateAsync: addGroupMember, isPending: isSubmitting } = useAddGroupMember();
|
|
19
19
|
const selectedIds = new Set(selectedMembers.map((member) => member.userID));
|
|
20
20
|
const toggleMember = (account) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupMembersDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/message/GroupMembersDrawer.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"GroupMembersDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/message/GroupMembersDrawer.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAgB/C,UAAU,uBAAuB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA0CD,QAAA,MAAM,kBAAkB,GAAI,wDAKzB,uBAAuB,4CA6ezB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|