Skip to content

Commit 5ca3fca

Browse files
committed
Spin and revert containers
1 parent 04a83da commit 5ca3fca

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jderobot-ide-interface",
3-
"version": "0.2.48",
3+
"version": "0.2.49",
44
"main": "dist/main.js",
55
"typings": "dist/index.d.ts",
66
"files": [

src/components/ResizableLayout/ResizableComponents.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,14 @@ export const CollapsableResizableColumn = ({
268268

269269
return (
270270
<StyledVertContiner bgColor={theme.palette?.background}>
271-
<StyledVertFillerContiner bgColor={theme.palette?.background}>
272-
{children[0]}
273-
</StyledVertFillerContiner>
274-
{children.slice(1, children.length).map((comp, i) => (
275-
<ResizableVert key={`v-cont${i}`} height={100 / children.length} max={100} min={0} snap={[0]} top>
271+
{children.slice(0, children.length - 1).map((comp, i) => (
272+
<ResizableVert key={`v-cont${i}`} height={100 / children.length} max={100} min={0} snap={[0]}>
276273
{comp}
277274
</ResizableVert>
278275
))}
276+
<StyledVertFillerContiner bgColor={theme.palette?.background}>
277+
{children[children.length - 1]}
278+
</StyledVertFillerContiner>
279279
</StyledVertContiner>
280280
);
281281
};

src/components/StatusBar/StatusBar.style.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const handleAnimation = (p: StyledStatusBarButtonProps) => {
8181
}
8282
};
8383

84-
export const StyledStatusBarButton = styled.div<StyledStatusBarButtonProps>`
84+
export const StyledStatusBarButton = styled.button<StyledStatusBarButtonProps>`
8585
margin: 0 0 0 0;
8686
padding: 0 10px 0 10px;
8787
height: 24px;
@@ -114,5 +114,20 @@ export const StyledStatusBarButton = styled.div<StyledStatusBarButtonProps>`
114114
height: 24px;
115115
margin: 0 0 0 0;
116116
}
117+
118+
@keyframes spin {
119+
from {
120+
transform: rotate(0deg);
121+
}
122+
to {
123+
transform: rotate(360deg);
124+
}
125+
}
126+
127+
#loading-spin {
128+
animation: spin 2s linear infinite;
129+
opacity: 50%;
130+
}
131+
117132
${handleAnimation}
118133
`;

src/components/StatusBar/StatusBar.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const StatusBar = ({
3030
extraComponents: StatusBarComponents;
3131
}) => {
3232
const theme = useTheme();
33+
const [loading, setLoading] = useState<boolean>(false);
3334
const [dockerData, setDockerData] = useState<any>(
3435
commsManager?.getHostData()
3536
);
@@ -54,6 +55,10 @@ const StatusBar = ({
5455
if (e.detail.state == states.IDLE) {
5556
setDockerData(undefined);
5657
connectWithRetry();
58+
} else {
59+
if (loading) {
60+
setLoading(false)
61+
}
5762
}
5863
};
5964

@@ -91,12 +96,17 @@ const StatusBar = ({
9196
id={`connect-with-rb`}
9297
onClick={() => {
9398
if (state === undefined || state === "idle") {
94-
connectManager();
99+
setLoading(true);
100+
connectManager(states.CONNECTED, () => {
101+
setLoading(false);
102+
close();
103+
});
95104
}
96105
}}
97106
title="Connect to the Robotics Backend"
107+
disabled={loading}
98108
>
99-
<ResetIcon viewBox="0 0 20 20" stroke={theme.palette.darkText} />
109+
<ResetIcon viewBox="0 0 20 20" stroke={theme.palette.darkText} id={loading ? "loading-spin" : "loading"}/>
100110
<label>{`Connect${state === undefined || state === "idle" ? "" : "ing ..."}`}</label>
101111
</StyledStatusBarButton>
102112
)}

0 commit comments

Comments
 (0)