Merge branch 'main-demo' into dev-resourceManagement

This commit is contained in:
2025-08-26 09:36:42 +05:30
18 changed files with 465 additions and 259 deletions

View File

@@ -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

View File

@@ -212,7 +212,11 @@ function MainScene() {
{activeModule !== "market" && !selectedUser && <Footer />}
<VersionSaved />
{(commentPositionState !== null || selectedComment !== null) && <ThreadChat />}
{
(commentPositionState !== null || selectedComment !== null) &&
<ThreadChat />
}
</>
);

View File

@@ -78,8 +78,8 @@ const AssetProperties: React.FC = () => {
<section>
<div className="header">User Data</div>
{userData.map((data) => (
<div className="input-container">
{userData.map((data, i) => (
<div className="input-container" key={i}>
<InputWithDropDown
key={data.id}
label={data.label}
@@ -103,9 +103,16 @@ const AssetProperties: React.FC = () => {
</section>
<div className="header">Animations</div>
<section className="animations-lists">
{assets.map((asset) => {
{assets.map((asset, i) => {
if (asset.modelUuid !== selectedFloorItem.uuid || !asset.animations)
return null;
return (
i === 0 && (
<div className="no-animation">
Looks like there are no preset animations yet. Stay tuned for
future additions!
</div>
)
);
return asset.animations.map((animation, index) => (
<div key={index} className="animations-list-wrapper">

View File

@@ -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 >
)}

View File

@@ -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);