@paro.io/expert-shared-components 1.12.4 → 1.12.6
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.
|
@@ -16,5 +16,5 @@ interface DiscussionSectionProps {
|
|
|
16
16
|
onCreateMessage: (variables: any) => Promise<any>;
|
|
17
17
|
isInternal?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare const DiscussionSection: ({ disputeId, currentUser, messages, onCreateMessage, isInternal }: DiscussionSectionProps) => JSX.Element;
|
|
19
|
+
export declare const DiscussionSection: ({ disputeId, currentUser, messages, onCreateMessage, isInternal, }: DiscussionSectionProps) => JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -39,7 +39,8 @@ exports.DiscussionSection = void 0;
|
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
const base_ui_1 = require("@paro.io/base-ui");
|
|
41
41
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
42
|
-
const
|
|
42
|
+
const base_icons_1 = require("@paro.io/base-icons");
|
|
43
|
+
const DiscussionSection = ({ disputeId, currentUser, messages, onCreateMessage, isInternal = false, }) => {
|
|
43
44
|
const [newMessage, setNewMessage] = (0, react_1.useState)('');
|
|
44
45
|
const [visibility, setVisibility] = (0, react_1.useState)('ALL');
|
|
45
46
|
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
@@ -50,7 +51,6 @@ const DiscussionSection = ({ disputeId, currentUser, messages, onCreateMessage,
|
|
|
50
51
|
return uniqueUsers;
|
|
51
52
|
}, [messages]);
|
|
52
53
|
const handleSendMessage = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
var _a;
|
|
54
54
|
if (!newMessage.trim())
|
|
55
55
|
return;
|
|
56
56
|
try {
|
|
@@ -61,7 +61,7 @@ const DiscussionSection = ({ disputeId, currentUser, messages, onCreateMessage,
|
|
|
61
61
|
disputeId,
|
|
62
62
|
messageText: newMessage,
|
|
63
63
|
visibility,
|
|
64
|
-
senderId:
|
|
64
|
+
senderId: currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId,
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
});
|
|
@@ -104,23 +104,32 @@ const DiscussionSection = ({ disputeId, currentUser, messages, onCreateMessage,
|
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
const getMessageAlignment = (userTypeId) => {
|
|
107
|
-
|
|
108
|
-
const userIndex = userSequence.indexOf(userTypeId);
|
|
109
|
-
return userIndex === 0 ? 'mr-auto' : 'ml-auto';
|
|
107
|
+
return userTypeId !== currentUser.userTypeId ? 'mr-auto' : 'ml-auto';
|
|
110
108
|
};
|
|
111
109
|
const getMessageOrder = (userTypeId) => {
|
|
112
|
-
|
|
113
|
-
const userIndex = userSequence.indexOf(userTypeId);
|
|
114
|
-
return userIndex === 0 ? 'flex-row' : 'flex-row-reverse';
|
|
110
|
+
return userTypeId !== currentUser.userTypeId ? 'flex-row' : 'flex-row-reverse';
|
|
115
111
|
};
|
|
116
112
|
const getHeaderAlignment = (userTypeId) => {
|
|
117
|
-
|
|
118
|
-
const userIndex = userSequence.indexOf(userTypeId);
|
|
119
|
-
return userIndex === 0 ? 'justify-start' : 'justify-end';
|
|
113
|
+
return userTypeId !== currentUser.userTypeId ? 'justify-start' : 'justify-end';
|
|
120
114
|
};
|
|
121
115
|
return (react_1.default.createElement("div", { className: "space-y-6" },
|
|
122
116
|
react_1.default.createElement("div", { className: "flex items-center justify-between" },
|
|
123
|
-
react_1.default.createElement("div", { className: "text-lg font-bold text-[#333333]" },
|
|
117
|
+
react_1.default.createElement("div", { className: "text-lg font-bold text-[#333333]" },
|
|
118
|
+
"Discussion Thread",
|
|
119
|
+
react_1.default.createElement("br", null),
|
|
120
|
+
react_1.default.createElement("div", { className: "flex items-center space-x-2 text-xs font-normal" },
|
|
121
|
+
react_1.default.createElement("div", { className: "flex items-center space-x-1" },
|
|
122
|
+
react_1.default.createElement("span", { className: "w-2 h-2 rounded-full", style: { backgroundColor: '#643E0C' } }),
|
|
123
|
+
react_1.default.createElement("span", null, "\u00A0Expert")),
|
|
124
|
+
react_1.default.createElement("div", { className: "flex items-center space-x-1" },
|
|
125
|
+
react_1.default.createElement("span", { className: "w-2 h-2 rounded-full", style: { backgroundColor: '#195C5C' } }),
|
|
126
|
+
react_1.default.createElement("span", null, "\u00A0Client")),
|
|
127
|
+
react_1.default.createElement("div", { className: "flex items-center space-x-1" },
|
|
128
|
+
react_1.default.createElement("span", { className: "w-2 h-2 rounded-full", style: { backgroundColor: '#2196F3' } }),
|
|
129
|
+
react_1.default.createElement("span", null, "\u00A0Paro Support")))),
|
|
130
|
+
react_1.default.createElement("div", { className: "flex flex-row justify-start mr-4 text-gray-600" },
|
|
131
|
+
react_1.default.createElement(base_icons_1.IconChat, { size: "sm", className: "text-blue-600 mr-2" }),
|
|
132
|
+
react_1.default.createElement("p", null, "This discussion applies to all projects in this dispute."))),
|
|
124
133
|
react_1.default.createElement("div", { className: "rounded" },
|
|
125
134
|
messages.length ? react_1.default.createElement("div", { className: "flex-1 max-h-[40vh] overflow-y-auto border rounded-md p-2 space-y-6" }, messages.map((message) => (react_1.default.createElement("div", { key: message.id, className: `flex ${getMessageAlignment(message.sender.userTypeId)}` },
|
|
126
135
|
react_1.default.createElement("div", { className: `flex space-x-4 ${getMessageOrder(message.sender.userTypeId)} ${getMessageAlignment(message.sender.userTypeId)}` },
|
|
@@ -130,7 +139,7 @@ const DiscussionSection = ({ disputeId, currentUser, messages, onCreateMessage,
|
|
|
130
139
|
}, className: "w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0" },
|
|
131
140
|
react_1.default.createElement("span", { className: "text-sm font-bold" }, getSenderInitial(message.sender))),
|
|
132
141
|
react_1.default.createElement("div", { className: "flex-1" },
|
|
133
|
-
react_1.default.createElement("div", { className: `flex items-center ${getHeaderAlignment(message.sender.userTypeId)} space-x-2` },
|
|
142
|
+
react_1.default.createElement("div", { className: `flex items-center ${getHeaderAlignment(message.sender.userTypeId)} space-x-2 mr-1` },
|
|
134
143
|
react_1.default.createElement("span", { className: "text-sm font-bold text-[#333333]" },
|
|
135
144
|
message.sender.firstName,
|
|
136
145
|
" ",
|