Merge remote-tracking branch 'origin/ui' into main-demo
This commit is contained in:
@@ -55,6 +55,7 @@ interface ShortcutHelperProps {
|
||||
const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
|
||||
setShowShortcuts,
|
||||
}) => {
|
||||
|
||||
const shortcuts: ShortcutGroup[] = [
|
||||
// Essential
|
||||
{
|
||||
@@ -310,6 +311,7 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
|
||||
>
|
||||
<CloseIcon />
|
||||
</button>
|
||||
|
||||
<div className="header">
|
||||
<div className="header-wrapper">
|
||||
{shortcuts.map((group) => (
|
||||
@@ -326,9 +328,8 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`shortcut-wrapper ${
|
||||
activeShortcuts.length === 1 ? "single-item" : ""
|
||||
}`}
|
||||
className={`shortcut-wrapper ${activeShortcuts.length === 1 ? "single-item" : ""
|
||||
}`}
|
||||
>
|
||||
{activeShortcuts.map((item) => (
|
||||
<div
|
||||
|
||||
@@ -212,7 +212,11 @@ function MainScene() {
|
||||
{activeModule !== "market" && !selectedUser && <Footer />}
|
||||
|
||||
<VersionSaved />
|
||||
{(commentPositionState !== null || selectedComment !== null) && <ThreadChat />}
|
||||
|
||||
{
|
||||
(commentPositionState !== null || selectedComment !== null) &&
|
||||
<ThreadChat />
|
||||
}
|
||||
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -231,7 +231,10 @@ const Messages: React.FC<MessageProps> = ({ val, i, setMessages, mode, setIsEdit
|
||||
<div className="time">{isEditableThread ? getRelativeTime(val.createdAt) : val.createdAt}</div>
|
||||
</div>
|
||||
{(val as Reply).creatorId === userId && (
|
||||
<div className="more-options">
|
||||
<div
|
||||
className="more-options"
|
||||
onMouseLeave={() => setOpenOptions(false)}
|
||||
>
|
||||
<button
|
||||
className="more-options-button"
|
||||
onClick={() => {
|
||||
@@ -240,35 +243,41 @@ const Messages: React.FC<MessageProps> = ({ val, i, setMessages, mode, setIsEdit
|
||||
>
|
||||
<KebabIcon />
|
||||
</button>
|
||||
|
||||
{openOptions && (
|
||||
<div className="options-list">
|
||||
<button
|
||||
className="option"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
setMode && setMode("edit")
|
||||
setMode && setMode("edit");
|
||||
setOpenOptions(false);
|
||||
setEditedThread && setEditedThread(true);
|
||||
setIsEditComment(true)
|
||||
setIsEditComment(true);
|
||||
}}
|
||||
>
|
||||
Edit
|
||||
</button>
|
||||
{!(isEditableThread) && <button
|
||||
className="option"
|
||||
onClick={() => {
|
||||
handleDeleteAction((val as Reply).replyId);
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</button>}
|
||||
|
||||
{!isEditableThread && (
|
||||
<button
|
||||
className="option"
|
||||
onClick={() => {
|
||||
handleDeleteAction((val as Reply).replyId);
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="message">
|
||||
{"comment" in val ? val.comment : val.threadTitle}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div >
|
||||
)}
|
||||
|
||||
@@ -131,9 +131,10 @@ const ThreadChat: React.FC = () => {
|
||||
if (dragging) updatePosition(e, true);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
updatePosition({ clientX: position.x, clientY: position.y }, true);
|
||||
}, [selectedComment]);
|
||||
// Commented this useEffect to prevent offset after user saved the comment
|
||||
// useEffect(() => {
|
||||
// updatePosition({ clientX: position.x, clientY: position.y }, true);
|
||||
// }, [selectedComment]);
|
||||
|
||||
|
||||
const handlePointerUp = (event: React.PointerEvent<HTMLDivElement>) => {
|
||||
@@ -144,6 +145,10 @@ const ThreadChat: React.FC = () => {
|
||||
};
|
||||
|
||||
const handleCreateComments = async (e: any) => {
|
||||
// Continue send or create message only there is only value avalibale
|
||||
// To prevent empty value
|
||||
|
||||
if (!value) return;
|
||||
e.preventDefault();
|
||||
try {
|
||||
// const createComments = await addCommentsApi(projectId, value, selectedComment?.threadId, selectedVersion?.versionId || "")/
|
||||
@@ -163,6 +168,7 @@ const ThreadChat: React.FC = () => {
|
||||
|
||||
// }
|
||||
|
||||
|
||||
if (threadSocket && mode === "create") {
|
||||
const addComment = {
|
||||
versionId: selectedVersion?.versionId || "",
|
||||
@@ -190,7 +196,7 @@ const ThreadChat: React.FC = () => {
|
||||
// removeComment(selectedComment?.threadId)
|
||||
// setSelectedComment([])
|
||||
// }
|
||||
console.log('threadSocket:threadChat ', threadSocket);
|
||||
|
||||
if (threadSocket) {
|
||||
// projectId, userId, organization, threadId
|
||||
const deleteThread = {
|
||||
@@ -258,7 +264,7 @@ const ThreadChat: React.FC = () => {
|
||||
};
|
||||
|
||||
if (threadSocket) {
|
||||
console.log('createThread: ', createThread);
|
||||
|
||||
|
||||
setInputActive(false);
|
||||
threadSocket.emit("v1:thread:create", createThread);
|
||||
|
||||
Reference in New Issue
Block a user