- online off line status updated
- echo added to rename
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { HelpIcon } from "../icons/DashboardIcon";
|
import { HelpIcon, WifiIcon } from "../icons/DashboardIcon";
|
||||||
import { useLogger } from "../ui/log/LoggerContext";
|
import { useLogger } from "../ui/log/LoggerContext";
|
||||||
import { GetLogIcon } from "./getLogIcons";
|
import { GetLogIcon } from "./getLogIcons";
|
||||||
import {
|
import {
|
||||||
@@ -31,6 +31,27 @@ const Footer: React.FC = () => {
|
|||||||
|
|
||||||
const { Leftnote, Middlenote, Rightnote } = useMouseNoteStore();
|
const { Leftnote, Middlenote, Rightnote } = useMouseNoteStore();
|
||||||
|
|
||||||
|
const [isOnline, setIsOnline] = useState<boolean>(navigator.onLine);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleOnline = () => {
|
||||||
|
echo.success('You are back Online');
|
||||||
|
setIsOnline(true);
|
||||||
|
};
|
||||||
|
const handleOffline = () => {
|
||||||
|
echo.warn('Changes made now might not be saved');
|
||||||
|
echo.error('You are now Offline.');
|
||||||
|
setIsOnline(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("online", handleOnline);
|
||||||
|
window.addEventListener("offline", handleOffline);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("online", handleOnline);
|
||||||
|
window.removeEventListener("offline", handleOffline);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
const mouseButtons = [
|
const mouseButtons = [
|
||||||
{
|
{
|
||||||
icon: <CurserLeftIcon />,
|
icon: <CurserLeftIcon />,
|
||||||
@@ -98,6 +119,16 @@ const Footer: React.FC = () => {
|
|||||||
<HelpIcon />
|
<HelpIcon />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
className={`wifi-connection ${
|
||||||
|
isOnline ? "connected" : "disconnected"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<div className="icon">
|
||||||
|
<WifiIcon />
|
||||||
|
</div>
|
||||||
|
<div className="tooltip">{isOnline ? "Online" : "Offline"}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -253,3 +253,20 @@ export function LogoutIcon() {
|
|||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function WifiIcon() {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
width="12"
|
||||||
|
height="12"
|
||||||
|
viewBox="0 0 12 12"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M6.78458 7.91952C6.35145 7.4864 5.64945 7.4864 5.21633 7.91952C4.7832 8.35265 4.7832 9.05465 5.21633 9.48777C5.64945 9.9209 6.35145 9.9209 6.78458 9.48777C7.2177 9.05465 7.2177 8.35265 6.78458 7.91952ZM9.7902 6.48215L8.67945 7.5929C7.20008 6.11352 4.8012 6.11352 3.32183 7.5929L2.21108 6.48215C4.30395 4.38927 7.69733 4.38927 9.7902 6.48215ZM10.574 5.69802C8.04795 3.17202 3.95258 3.17202 1.42658 5.69802L0.283203 4.55465C3.4407 1.39715 8.55983 1.39715 11.7173 4.55465L10.574 5.69802Z"
|
||||||
|
fill="white"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
useLeftData,
|
useLeftData,
|
||||||
useTopData,
|
useTopData,
|
||||||
} from "../../../store/visualization/useZone3DWidgetStore";
|
} from "../../../store/visualization/useZone3DWidgetStore";
|
||||||
import { useRenameModeStore } from "../../../store/builder/store";
|
|
||||||
|
|
||||||
type RenameTooltipProps = {
|
type RenameTooltipProps = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -20,6 +19,7 @@ const RenameTooltip: React.FC<RenameTooltipProps> = ({ name, onSubmit }) => {
|
|||||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
onSubmit(value.trim());
|
onSubmit(value.trim());
|
||||||
|
echo.info(`Selected Object has been renamed to ${value.trim()}`);
|
||||||
setTop(0);
|
setTop(0);
|
||||||
setLeft(0);
|
setLeft(0);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,12 @@ interface RenameInputProps {
|
|||||||
canEdit?: boolean;
|
canEdit?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const RenameInput: React.FC<RenameInputProps> = ({ value, onRename, checkDuplicate, canEdit = true }) => {
|
const RenameInput: React.FC<RenameInputProps> = ({
|
||||||
|
value,
|
||||||
|
onRename,
|
||||||
|
checkDuplicate,
|
||||||
|
canEdit = true,
|
||||||
|
}) => {
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
const [text, setText] = useState(value);
|
const [text, setText] = useState(value);
|
||||||
const [isDuplicate, setIsDuplicate] = useState(false);
|
const [isDuplicate, setIsDuplicate] = useState(false);
|
||||||
@@ -36,10 +41,10 @@ const RenameInput: React.FC<RenameInputProps> = ({ value, onRename, checkDuplica
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleBlur = () => {
|
const handleBlur = () => {
|
||||||
|
if (isDuplicate) return;
|
||||||
if (isDuplicate) return
|
|
||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
if (onRename && !isDuplicate) {
|
if (onRename && !isDuplicate) {
|
||||||
|
echo.info(`Selected Object has been renamed to ${text}`)
|
||||||
onRename(text);
|
onRename(text);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -52,6 +57,7 @@ const RenameInput: React.FC<RenameInputProps> = ({ value, onRename, checkDuplica
|
|||||||
if (e.key === "Enter" && !isDuplicate) {
|
if (e.key === "Enter" && !isDuplicate) {
|
||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
if (onRename) {
|
if (onRename) {
|
||||||
|
echo.info(`Selected Object has been renamed to ${text}`)
|
||||||
onRename(text);
|
onRename(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,4 +86,4 @@ const RenameInput: React.FC<RenameInputProps> = ({ value, onRename, checkDuplica
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default RenameInput
|
export default RenameInput;
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ const Project: React.FC = () => {
|
|||||||
if (email) {
|
if (email) {
|
||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
const refreshToken = localStorage.getItem("refreshToken");
|
const refreshToken = localStorage.getItem("refreshToken");
|
||||||
|
echo.warn('Validating token');
|
||||||
if (token) {
|
if (token) {
|
||||||
useSocketStore
|
useSocketStore
|
||||||
.getState()
|
.getState()
|
||||||
@@ -110,7 +111,7 @@ const Project: React.FC = () => {
|
|||||||
setOrganization(organization);
|
setOrganization(organization);
|
||||||
setUserName(userName);
|
setUserName(userName);
|
||||||
}
|
}
|
||||||
echo.success("Log in successful");
|
echo.success("Project initialized and loaded successfully");
|
||||||
} else {
|
} else {
|
||||||
navigate("/");
|
navigate("/");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export const renameProductApi = async (body: {
|
|||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Failed to rename product");
|
console.error("Failed to rename product");
|
||||||
|
echo.error("Failed to rename product");
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
@@ -32,11 +33,11 @@ export const renameProductApi = async (body: {
|
|||||||
return result;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
echo.error("Failed to rename product Api");
|
echo.error("Failed to rename product Api");
|
||||||
|
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
console.log(error.message);
|
console.log(error.message);
|
||||||
} else {
|
} else {
|
||||||
console.log("An unknown error occurred");
|
console.log("An unknown error occurred");
|
||||||
|
echo.log("An unknown error occurred");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bg-dummy.right-bottom {
|
.bg-dummy.right-bottom {
|
||||||
right: 68px;
|
right: 84px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 20%;
|
width: 20%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -79,7 +79,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.logs-detail,
|
.logs-detail,
|
||||||
.version {
|
.version,
|
||||||
|
.wifi-connection {
|
||||||
@include flex-center;
|
@include flex-center;
|
||||||
border-radius: #{$border-radius-extra-large};
|
border-radius: #{$border-radius-extra-large};
|
||||||
padding: 3px 6px;
|
padding: 3px 6px;
|
||||||
@@ -107,7 +108,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.version {
|
.wifi-connection {
|
||||||
|
.tooltip {
|
||||||
|
transform: translateX(-16px);
|
||||||
|
&::after {
|
||||||
|
left: 76%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
.tooltip {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.connected svg path {
|
||||||
|
fill: #1ec018;
|
||||||
|
}
|
||||||
|
&.disconnected svg path {
|
||||||
|
fill: #e44405;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.version,
|
||||||
|
.wifi-connection {
|
||||||
background: var(--background-color);
|
background: var(--background-color);
|
||||||
font-size: var(--font-size-tiny);
|
font-size: var(--font-size-tiny);
|
||||||
|
|
||||||
@@ -179,7 +201,7 @@
|
|||||||
background: var(--background-color);
|
background: var(--background-color);
|
||||||
border-radius: #{$border-radius-medium};
|
border-radius: #{$border-radius-medium};
|
||||||
outline: 1px solid var(--border-color);
|
outline: 1px solid var(--border-color);
|
||||||
&:hover{
|
&:hover {
|
||||||
background: var(--background-color-solid);
|
background: var(--background-color-solid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,7 +310,7 @@
|
|||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: var(--font-size-tiny);
|
font-size: var(--font-size-tiny);
|
||||||
color: var(--icon-default-color-active);
|
color: var(--icon-default-color-active);
|
||||||
&:last-child{
|
&:last-child {
|
||||||
background: var(--background-color-button);
|
background: var(--background-color-button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user