Merge remote-tracking branch 'origin/v2-ui' into v2

This commit is contained in:
Jerald-Golden-B 2025-05-22 15:46:01 +05:30
commit 56363a0370
16 changed files with 236 additions and 78 deletions

View File

@ -30,7 +30,7 @@ import {
DuplicateInstanceIcon, DuplicateInstanceIcon,
PlayIcon, PlayIcon,
} from "../icons/ShortcutIcons"; } from "../icons/ShortcutIcons";
import { CloseIcon } from "../icons/ExportCommonIcons"; import { CloseIcon, EyeCloseIcon } from "../icons/ExportCommonIcons";
interface ShortcutItem { interface ShortcutItem {
keys: string[]; keys: string[];
@ -52,6 +52,7 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
setShowShortcuts, setShowShortcuts,
}) => { }) => {
const shortcuts: ShortcutGroup[] = [ const shortcuts: ShortcutGroup[] = [
// Essential
{ {
category: "Essential", category: "Essential",
items: [ items: [
@ -86,13 +87,20 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
icon: <FindIcon />, icon: <FindIcon />,
}, },
{ {
keys: ["CTRL", "+", "?"], keys: ["CTRL", "+", "SHIFT", "+", "?"],
name: "Info", name: "Info",
description: "Show Shortcut Info", description: "Show Shortcut Info",
icon: <InfoIcon />, icon: <InfoIcon />,
}, },
{
keys: ["L"],
name: "Log",
description: "Show Log list",
icon: <InfoIcon />,
},
], ],
}, },
// Tools
{ {
category: "Tools", category: "Tools",
items: [ items: [
@ -158,6 +166,7 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
}, },
], ],
}, },
// View & Navigation
{ {
category: "View & Navigation", category: "View & Navigation",
items: [ items: [
@ -193,6 +202,7 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
}, },
], ],
}, },
// Module Switching
{ {
category: "Module Switching", category: "Module Switching",
items: [ items: [
@ -222,6 +232,7 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
}, },
], ],
}, },
// Selection
{ {
category: "Selection", category: "Selection",
items: [ items: [
@ -251,6 +262,7 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
}, },
], ],
}, },
// Simulation
{ {
category: "Simulation", category: "Simulation",
items: [ items: [
@ -260,6 +272,12 @@ const ShortcutHelper: React.FC<ShortcutHelperProps> = ({
description: "Play Simulation", description: "Play Simulation",
icon: <PlayIcon />, icon: <PlayIcon />,
}, },
{
keys: ["H"],
name: "Hide Player",
description: "Hide Simulation Player",
icon: <EyeCloseIcon />,
},
], ],
}, },
]; ];

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react"; import React, { useEffect } from "react";
import useCameraModeStore, { import useCameraModeStore, {
usePlayButtonStore, usePlayButtonStore,
} from "../../../store/usePlayButtonStore"; } from "../../../store/usePlayButtonStore";
@ -8,12 +8,13 @@ import InputToggle from "../../ui/inputs/InputToggle";
import { EyeCloseIcon, WalkIcon } from "../../icons/ExportCommonIcons"; import { EyeCloseIcon, WalkIcon } from "../../icons/ExportCommonIcons";
import { ExitIcon } from "../../icons/SimulationIcons"; import { ExitIcon } from "../../icons/SimulationIcons";
import { useCamMode } from "../../../store/builder/store"; import { useCamMode } from "../../../store/builder/store";
import { usePlayerStore } from "../../../store/useUIToggleStore";
const ControlsPlayer: React.FC = () => { const ControlsPlayer: React.FC = () => {
const { setIsPlaying } = usePlayButtonStore(); const { setIsPlaying } = usePlayButtonStore();
const { activeModule } = useModuleStore(); const { activeModule } = useModuleStore();
const { walkMode, toggleWalkMode } = useCameraModeStore(); const { walkMode, toggleWalkMode } = useCameraModeStore();
const [hidePlayer, setHidePlayer] = useState(false); const { hidePlayer, setHidePlayer } = usePlayerStore();
const { camMode } = useCamMode(); const { camMode } = useCamMode();
const changeCamMode = () => { const changeCamMode = () => {

View File

@ -2,7 +2,7 @@ import React from "react";
import { ToggleSidebarIcon } from "../../icons/HeaderIcons"; import { ToggleSidebarIcon } from "../../icons/HeaderIcons";
import { LogoIcon } from "../../icons/Logo"; import { LogoIcon } from "../../icons/Logo";
import FileMenu from "../../ui/FileMenu"; import FileMenu from "../../ui/FileMenu";
import useToggleStore from "../../../store/useUIToggleStore"; import {useToggleStore} from "../../../store/useUIToggleStore";
import useModuleStore from "../../../store/useModuleStore"; import useModuleStore from "../../../store/useModuleStore";
const Header: React.FC = () => { const Header: React.FC = () => {

View File

@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
import ToggleHeader from "../../ui/inputs/ToggleHeader"; import ToggleHeader from "../../ui/inputs/ToggleHeader";
import Outline from "./Outline"; import Outline from "./Outline";
import Header from "./Header"; import Header from "./Header";
import useToggleStore from "../../../store/useUIToggleStore"; import { useToggleStore } from "../../../store/useUIToggleStore";
import Assets from "./Assets"; import Assets from "./Assets";
import useModuleStore from "../../../store/useModuleStore"; import useModuleStore from "../../../store/useModuleStore";
import Widgets from "./visualization/widgets/Widgets"; import Widgets from "./visualization/widgets/Widgets";
@ -36,9 +36,7 @@ const SideBarLeft: React.FC = () => {
return ( return (
<div <div
className={`sidebar-left-wrapper ${ className={`sidebar-left-wrapper ${
(toggleUILeft && !isVersionSaved) || activeModule !== "simulation" toggleUILeft && !isVersionSaved ? "open" : "closed"
? "open"
: "closed"
}`} }`}
> >
<Header /> <Header />

View File

@ -5,7 +5,7 @@ import { ActiveUser } from "../../../types/users";
import CollaborationPopup from "../../templates/CollaborationPopup"; import CollaborationPopup from "../../templates/CollaborationPopup";
import { getAvatarColor } from "../../../modules/collaboration/functions/getAvatarColor"; import { getAvatarColor } from "../../../modules/collaboration/functions/getAvatarColor";
import { useSelectedUserStore } from "../../../store/collaboration/useCollabStore"; import { useSelectedUserStore } from "../../../store/collaboration/useCollabStore";
import useToggleStore from "../../../store/useUIToggleStore"; import { useToggleStore } from "../../../store/useUIToggleStore";
import { ToggleSidebarIcon } from "../../icons/HeaderIcons"; import { ToggleSidebarIcon } from "../../icons/HeaderIcons";
import useModuleStore from "../../../store/useModuleStore"; import useModuleStore from "../../../store/useModuleStore";
@ -62,8 +62,7 @@ const Header: React.FC = () => {
<div className="options-container"> <div className="options-container">
<button <button
id="toggle-rightSidebar-ui-button" id="toggle-rightSidebar-ui-button"
className={`toggle-sidebar-ui-button ${ className={`toggle-sidebar-ui-button ${!toggleUIRight ? "active" : ""
!toggleUIRight ? "active" : ""
}`} }`}
onClick={() => { onClick={() => {
if (activeModule !== "market") { if (activeModule !== "market") {

View File

@ -9,7 +9,7 @@ import {
PropertiesIcon, PropertiesIcon,
SimulationIcon, SimulationIcon,
} from "../../icons/SimulationIcons"; } from "../../icons/SimulationIcons";
import useToggleStore from "../../../store/useUIToggleStore"; import { useToggleStore } from "../../../store/useUIToggleStore";
import Visualization from "./visualization/Visualization"; import Visualization from "./visualization/Visualization";
import Analysis from "./analysis/Analysis"; import Analysis from "./analysis/Analysis";
import Simulations from "./simulation/Simulations"; import Simulations from "./simulation/Simulations";
@ -63,9 +63,7 @@ const SideBarRight: React.FC = () => {
return ( return (
<div <div
className={`sidebar-right-wrapper ${ className={`sidebar-right-wrapper ${
(toggleUIRight && !isVersionSaved) || activeModule !== "simulation" toggleUIRight && !isVersionSaved ? "open" : "closed"
? "open"
: "closed"
}`} }`}
> >
<Header /> <Header />

View File

@ -28,7 +28,7 @@ import {
useSaveVersion, useSaveVersion,
} from "../../../../store/builder/store"; } from "../../../../store/builder/store";
import CompareLayOut from "../../../ui/compareVersion/CompareLayOut"; import CompareLayOut from "../../../ui/compareVersion/CompareLayOut";
import useToggleStore from "../../../../store/useUIToggleStore"; import {useToggleStore} from "../../../../store/useUIToggleStore";
interface Event { interface Event {
modelName: string; modelName: string;

View File

@ -6,7 +6,7 @@ import {
SimulationIcon, SimulationIcon,
VisualizationIcon, VisualizationIcon,
} from "../icons/ExportModuleIcons"; } from "../icons/ExportModuleIcons";
import useToggleStore from "../../store/useUIToggleStore"; import {useToggleStore} from "../../store/useUIToggleStore";
import useVersionHistoryStore from "../../store/builder/store"; import useVersionHistoryStore from "../../store/builder/store";
const ModuleToggle: React.FC = () => { const ModuleToggle: React.FC = () => {

View File

@ -32,7 +32,7 @@ import {
useActiveSubTool, useActiveSubTool,
useShortcutStore, useShortcutStore,
} from "../../store/builder/store"; } from "../../store/builder/store";
import useToggleStore from "../../store/useUIToggleStore"; import {useToggleStore} from "../../store/useUIToggleStore";
import { import {
use3DWidget, use3DWidget,
useFloatingWidget, useFloatingWidget,

View File

@ -0,0 +1,59 @@
import React, { useState } from "react";
import { getAvatarColor } from "../../../modules/collaboration/functions/getAvatarColor";
const CommentThreads: React.FC = () => {
const [expand, setExpand] = useState(true);
const commentsedUsers = [
{
userId: "1",
userName: "user",
},
{
userId: "1",
userName: "Admin",
},
];
function getDetails(type?: "clicked") {
if (type === "clicked") {
setExpand(true);
} else {
setExpand((prev) => !prev);
}
}
return (
<div className="comments-threads-wrapper">
<button
onPointerEnter={() => getDetails()}
onPointerLeave={() => getDetails()}
onClick={() => getDetails("clicked")}
className={`comments-threads-container ${expand ? "open" : "closed"}`}
>
<div className="users-commented">
{commentsedUsers.map((val, i) => (
<div
className="users"
key={val.userId}
style={{ background: getAvatarColor(i, val.userName) }}
>
{val.userName[0]}
</div>
))}
</div>
<div
className={`last-comment-details ${expand ? "expand" : ""}`}
>
<div className="header">
<div className="user-name">user</div>
<div className="time">4 mins, ago</div>
</div>
<div className="message">hello</div>
<div className="replies">0 replies</div>
</div>
</button>
</div>
);
};
export default CommentThreads;

View File

@ -23,6 +23,7 @@ import { useSubModuleStore } from "../../../store/useModuleStore";
import ProductionCapacity from "../analysis/ThroughputSummary"; import ProductionCapacity from "../analysis/ThroughputSummary";
import ThroughputSummary from "../analysis/ProductionCapacity"; import ThroughputSummary from "../analysis/ProductionCapacity";
import ROISummary from "../analysis/ROISummary"; import ROISummary from "../analysis/ROISummary";
import { usePlayerStore } from "../../../store/useUIToggleStore";
const SimulationPlayer: React.FC = () => { const SimulationPlayer: React.FC = () => {
const MAX_SPEED = 4; // Maximum speed const MAX_SPEED = 4; // Maximum speed
@ -31,7 +32,7 @@ const SimulationPlayer: React.FC = () => {
const sliderRef = useRef<HTMLDivElement>(null); const sliderRef = useRef<HTMLDivElement>(null);
const [expand, setExpand] = useState(true); const [expand, setExpand] = useState(true);
const [playSimulation, setPlaySimulation] = useState(false); const [playSimulation, setPlaySimulation] = useState(false);
const [hidePlayer, setHidePlayer] = useState(false); const { hidePlayer, setHidePlayer } = usePlayerStore();
const { speed, setSpeed } = useAnimationPlaySpeed(); const { speed, setSpeed } = useAnimationPlaySpeed();
const { setIsPlaying } = usePlayButtonStore(); const { setIsPlaying } = usePlayButtonStore();
@ -111,22 +112,9 @@ const SimulationPlayer: React.FC = () => {
const hourlySimulation = 25; const hourlySimulation = 25;
const dailyProduction = 75; const dailyProduction = 75;
const monthlyROI = 50; const monthlyROI = 50;
const { processBar, setProcessBar } = useProcessBar(); const { processBar } = useProcessBar();
// const process = [
// { name: "process 1", completed: 0 }, // 0% completed
// { name: "process 2", completed: 20 }, // 20% completed
// { name: "process 3", completed: 40 }, // 40% completed
// { name: "process 4", completed: 60 }, // 60% completed
// { name: "process 5", completed: 80 }, // 80% completed
// { name: "process 6", completed: 100 }, // 100% completed
// { name: "process 7", completed: 0 }, // 0% completed
// { name: "process 8", completed: 50 }, // 50% completed
// { name: "process 9", completed: 90 }, // 90% completed
// { name: "process 10", completed: 30 }, // 30% completed
// ];
useEffect(() => { useEffect(() => {
// console.log('processBar: ', processBar);
}, [processBar]) }, [processBar])
const intervals = [50, 20, 30, 40, 50, 60]; // in minutes const intervals = [50, 20, 30, 40, 50, 60]; // in minutes

View File

@ -34,10 +34,11 @@ import Footer from "../components/footer/Footer";
import SelectFloorPlan from "../components/temporary/SelectFloorPlan"; import SelectFloorPlan from "../components/temporary/SelectFloorPlan";
import ControlsPlayer from "../components/layout/controls/ControlsPlayer"; import ControlsPlayer from "../components/layout/controls/ControlsPlayer";
import CompareLayOut from "../components/ui/compareVersion/CompareLayOut"; import CompareLayOut from "../components/ui/compareVersion/CompareLayOut";
import useToggleStore from "../store/useUIToggleStore"; import {useToggleStore} from "../store/useUIToggleStore";
import RegularDropDown from "../components/ui/inputs/RegularDropDown"; import RegularDropDown from "../components/ui/inputs/RegularDropDown";
import VersionSaved from "../components/layout/sidebarRight/versionHisory/VersionSaved"; import VersionSaved from "../components/layout/sidebarRight/versionHisory/VersionSaved";
import SimulationPlayer from "../components/ui/simulation/simulationPlayer"; import SimulationPlayer from "../components/ui/simulation/simulationPlayer";
import CommentThreads from "../components/ui/collaboration/CommentThreads";
const Project: React.FC = () => { const Project: React.FC = () => {
let navigate = useNavigate(); let navigate = useNavigate();
@ -180,6 +181,7 @@ const Project: React.FC = () => {
</> </>
)} )}
<VersionSaved /> <VersionSaved />
<CommentThreads />
</div> </div>
); );
}; };

View File

@ -6,7 +6,7 @@ interface ToggleState {
setToggleUI: (value1: boolean, value2: boolean) => void; setToggleUI: (value1: boolean, value2: boolean) => void;
} }
const useToggleStore = create<ToggleState>((set) => ({ export const useToggleStore = create<ToggleState>((set) => ({
toggleUILeft: true, toggleUILeft: true,
toggleUIRight: false, toggleUIRight: false,
setToggleUI: (value1: boolean, value2: boolean) => { setToggleUI: (value1: boolean, value2: boolean) => {
@ -14,4 +14,13 @@ const useToggleStore = create<ToggleState>((set) => ({
}, },
})); }));
export default useToggleStore; interface PlayerState {
hidePlayer: boolean;
setHidePlayer: (hide: boolean) => void;
}
// Create the Zustand store
export const usePlayerStore = create<PlayerState>((set) => ({
hidePlayer: false, // initial state
setHidePlayer: (hide) => set({ hidePlayer: hide }), // state updater
}));

View File

@ -1,48 +1,48 @@
// abstracts // abstracts
@use 'abstracts/variables'; @use "abstracts/variables";
@use 'abstracts/mixins'; @use "abstracts/mixins";
@use 'abstracts/functions'; @use "abstracts/functions";
// base // base
@use 'base/reset'; @use "base/reset";
@use 'base/typography'; @use "base/typography";
@use 'base/global'; @use "base/global";
@use 'base/base'; @use "base/base";
// components // components
@use 'components/button'; @use "components/button";
@use 'components/form'; @use "components/form";
@use 'components/input'; @use "components/input";
@use 'components/lists'; @use "components/lists";
@use 'components/moduleToggle'; @use "components/moduleToggle";
@use 'components/templates'; @use "components/templates";
@use 'components/tools'; @use "components/tools";
@use 'components/visualization/floating/energyConsumed'; @use "components/visualization/floating/energyConsumed";
@use 'components/visualization/ui/styledWidgets'; @use "components/visualization/ui/styledWidgets";
@use 'components/visualization/floating/common'; @use "components/visualization/floating/common";
@use 'components/marketPlace/marketPlace'; @use "components/marketPlace/marketPlace";
@use 'components/menu/menu'; @use "components/menu/menu";
@use 'components/confirmationPopUp'; @use "components/confirmationPopUp";
@use 'components/simulation/simulation'; @use "components/simulation/simulation";
@use 'components/simulation/analysis'; @use "components/simulation/analysis";
@use 'components/logs/logs'; @use "components/logs/logs";
@use 'components/footer/footer.scss'; @use "components/footer/footer.scss";
// layout // layout
@use 'layout/loading'; @use "layout/loading";
@use 'layout/sidebar'; @use "layout/sidebar";
@use 'layout/popup'; @use "layout/popup";
@use 'layout/toast'; @use "layout/toast";
@use 'layout/skeleton'; @use "layout/skeleton";
@use 'layout/compareLayoutPopUp'; @use "layout/compareLayoutPopUp";
@use 'layout/compareLayout'; @use "layout/compareLayout";
// pages // pages
@use 'pages/dashboard'; @use "pages/dashboard";
@use 'pages/home'; @use "pages/home";
@use 'pages/realTimeViz'; @use "pages/realTimeViz";
@use 'pages/userAuth'; @use "pages/userAuth";
// //
@use './scene/scene' @use "./scene/scene";
@use "./scene/comments";

View File

@ -0,0 +1,72 @@
@use "../abstracts/variables" as *;
@use "../abstracts/mixins" as *;
.comments-threads-wrapper {
position: fixed;
top: 50%;
left: 50%;
padding: 4px;
background: var(--background-color);
border-radius: #{$border-radius-large} #{$border-radius-large} #{$border-radius-large}
0;
backdrop-filter: blur(12px);
z-index: 1000;
transform: translateY(-100%);
outline: 1px solid var(--border-color);
transition: all 0.2s ease-out;
.comments-threads-container {
display: flex;
align-items: start;
flex-direction: column;
.users-commented {
@include flex-center;
.users {
height: 24px;
line-height: 24px;
width: 24px;
text-transform: uppercase;
border-radius: 50%;
}
}
.last-comment-details {
display: flex;
align-items: start;
flex-direction: column;
padding-top: 0;
height: 0;
width: 0;
overflow: hidden;
transition: all 0.2s;
.header {
@include flex-center;
gap: 10px;
.user-name {
text-transform: capitalize;
}
.time {
font-size: var(--font-size-small);
color: var(--input-text-color);
}
}
.message {
margin-top: 10px;
}
.replies {
margin-top: 10px;
font-size: var(--font-size-small);
color: var(--input-text-color);
}
}
.expand {
min-width: 200px;
max-width: 260px;
padding: 12px;
height: 100%;
}
}
.open {
.users-commented {
padding: 12px;
}
}
}

View File

@ -1,6 +1,6 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import useModuleStore, { useThreeDStore } from "../../store/useModuleStore"; import useModuleStore, { useThreeDStore } from "../../store/useModuleStore";
import useToggleStore from "../../store/useUIToggleStore"; import { usePlayerStore, useToggleStore } from "../../store/useUIToggleStore";
import { import {
useActiveSubTool, useActiveSubTool,
useActiveTool, useActiveTool,
@ -17,6 +17,7 @@ import useCameraModeStore, {
} from "../../store/usePlayButtonStore"; } from "../../store/usePlayButtonStore";
import { detectModifierKeys } from "./detectModifierKeys"; import { detectModifierKeys } from "./detectModifierKeys";
import { useSelectedZoneStore } from "../../store/visualization/useZoneStore"; import { useSelectedZoneStore } from "../../store/visualization/useZoneStore";
import { useLogger } from "../../components/ui/log/LoggerContext";
const KeyPressListener: React.FC = () => { const KeyPressListener: React.FC = () => {
const { activeModule, setActiveModule } = useModuleStore(); const { activeModule, setActiveModule } = useModuleStore();
@ -34,6 +35,8 @@ const KeyPressListener: React.FC = () => {
const { showShortcuts, setShowShortcuts } = useShortcutStore(); const { showShortcuts, setShowShortcuts } = useShortcutStore();
const { setWalkMode } = useCameraModeStore(); const { setWalkMode } = useCameraModeStore();
const { setIsVersionSaved } = useSaveVersion(); const { setIsVersionSaved } = useSaveVersion();
const { isLogListVisible, setIsLogListVisible } = useLogger();
const { hidePlayer, setHidePlayer } = usePlayerStore();
const isTextInput = (element: Element | null): boolean => const isTextInput = (element: Element | null): boolean =>
element instanceof HTMLInputElement || element instanceof HTMLInputElement ||
@ -175,6 +178,14 @@ const KeyPressListener: React.FC = () => {
setIsPlaying(true); setIsPlaying(true);
} }
if (keyCombination === "L") {
setIsLogListVisible(!isLogListVisible);
}
if (keyCombination === "H") {
setHidePlayer(!hidePlayer);
}
if (keyCombination === "ESCAPE") { if (keyCombination === "ESCAPE") {
setWalkMode(false); setWalkMode(false);
setActiveTool("cursor"); setActiveTool("cursor");
@ -183,6 +194,7 @@ const KeyPressListener: React.FC = () => {
clearSelectedZone(); clearSelectedZone();
setShowShortcuts(false); setShowShortcuts(false);
setIsVersionSaved(false); setIsVersionSaved(false);
setIsLogListVisible(false);
} }
if (keyCombination === "Ctrl+Shift+?") { if (keyCombination === "Ctrl+Shift+?") {
@ -191,7 +203,7 @@ const KeyPressListener: React.FC = () => {
// Placeholder for future implementation // Placeholder for future implementation
if ( if (
["Ctrl+Z", "Ctrl+Y", "Ctrl+Shift+Z", "Ctrl+H", "Ctrl+F"].includes( ["Ctrl+Z", "Ctrl+Y", "Ctrl+Shift+Z", "Ctrl+F"].includes(
keyCombination keyCombination
) )
) { ) {
@ -210,6 +222,8 @@ const KeyPressListener: React.FC = () => {
toggleView, toggleView,
showShortcuts, showShortcuts,
isPlaying, isPlaying,
isLogListVisible,
hidePlayer
]); ]);
return null; return null;