Skip to content

Commit d4bafc7

Browse files
authored
Merge pull request #73 from layer5io/fix-bugs
Fix bugs
2 parents f8dcf66 + 800f01e commit d4bafc7

File tree

4 files changed

+174
-229
lines changed

4 files changed

+174
-229
lines changed

ui/src/components/ExtensionComponent/AuthedDashboard.js

Lines changed: 68 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ import {
1919
StyledButtonLink,
2020
} from "./styledComponents";
2121

22-
import { InfoCircleIcon, CustomTooltip, Box, CircularProgress,SistentThemeProvider } from "@sistent/sistent";
22+
import {
23+
InfoCircleIcon,
24+
CustomTooltip,
25+
Box,
26+
CircularProgress,
27+
SistentThemeProvider,
28+
} from "@sistent/sistent";
2329

2430
// import KanvasColor from "../../img/SVGs/kanvasColor";
2531
import KanvasWhite from "../../img/SVGs/kanvasWhite";
@@ -31,6 +37,7 @@ import { randomApplicationNameGenerator } from "../../utils";
3137
import { getBase64EncodedFile, getUnit8ArrayDecodedFile } from "../utils/file";
3238
import RecentDesignsCard, { refreshRecentDesignsEvent } from "./RecentDesigns";
3339
import QanelasSistentThemeProvider from "../../theme/QanelasSistentThemeProvider";
40+
import { openExternalLink } from "../utils/hooks";
3441

3542
const proxyUrl = "http://127.0.0.1:7877";
3643

@@ -94,6 +101,7 @@ const HeaderSection = ({ isDarkTheme }) => (
94101
window.ddClient.host.openExternal("https://docs.layer5.io/videos/")
95102
}
96103
/>
104+
97105
<UserAccountSection isDarkTheme={isDarkTheme} />
98106
</MuiBox>
99107
<MuiBox display="flex" justifyContent="center" mb={2}>
@@ -120,7 +128,10 @@ const LaunchKanvasSection = ({ isDarkTheme }) => {
120128

121129
return (
122130
<ExtensionWrapper
123-
sx={{ backgroundColor: isDarkTheme ? "#393F49" : "#D7DADE", flexDirection:"column"}}
131+
sx={{
132+
backgroundColor: isDarkTheme ? "#393F49" : "#D7DADE",
133+
flexDirection: "column",
134+
}}
124135
>
125136
<AccountDiv>
126137
<StyledButton
@@ -130,10 +141,20 @@ const LaunchKanvasSection = ({ isDarkTheme }) => {
130141
window.location.href = proxyUrl + "/extension/meshmap";
131142
setLaunching(true);
132143
}}
133-
sx={{margin:"0"}}
134-
> <KanvasWhite height={48} width={48} sx={{margin:"0", padding:"0"}} />
135-
136-
<MuiBox display={"flex"} gap={0} sx={{margin:"0", padding:"0"}} alignItems="center">
144+
sx={{ margin: "0" }}
145+
>
146+
{" "}
147+
<KanvasWhite
148+
height={48}
149+
width={48}
150+
sx={{ margin: "0", padding: "0" }}
151+
/>
152+
<MuiBox
153+
display={"flex"}
154+
gap={0}
155+
sx={{ margin: "0", padding: "0" }}
156+
alignItems="center"
157+
>
137158
{launching && (
138159
<CircularProgress
139160
sx={{
@@ -153,7 +174,7 @@ const LaunchKanvasSection = ({ isDarkTheme }) => {
153174
cursor: "pointer",
154175
marginTop: "0.55rem",
155176
padding: "0px",
156-
fontSize: ".9rem"
177+
fontSize: ".9rem",
157178
}}
158179
onClick={openInExternalWindow}
159180
>
@@ -200,13 +221,24 @@ const ImportDesignSection = ({ isDarkTheme }) => {
200221
window.ddClient.desktopUI.toast.error("Error uploading design file.");
201222
}
202223
};
203-
224+
const ImportDesignTooltipTitle = (
225+
<Typography variant="body1" component="p" sx={{ mt: 0.5 }}>
226+
Supported formats: Helm chart, Kubernetes manifest, Kustomize, and Docker
227+
Compose. Learn more at
228+
<a
229+
onClick={() =>
230+
openExternalLink("https://docs.layer5.io/kanvas/getting-started/")
231+
}
232+
style={{ color: "#00b39f" }}
233+
>
234+
https://docs.layer5.io/kanvas/getting-started/
235+
</a>
236+
</Typography>
237+
);
204238
return (
205-
206239
<ExtensionWrapper
207240
sx={{ backgroundColor: isDarkTheme ? "#393F49" : "#D7DADE" }}
208241
>
209-
210242
<AccountDiv>
211243
<Box
212244
display="inline"
@@ -215,38 +247,40 @@ const ImportDesignSection = ({ isDarkTheme }) => {
215247
alignSelf="flex-start"
216248
margin="-1.5rem 0rem 1rem -.5rem"
217249
>
218-
<CustomTooltip title="Supported formats: Helm chart, Kubernetes manifest, Kustomize, and Docker Compose. Learn more at https://docs.layer5.io/kanvas/getting-started/">
250+
<CustomTooltip title={ImportDesignTooltipTitle}>
219251
<div>
220252
<InfoCircleIcon height={24} width={24} />
221253
</div>
222254
</CustomTooltip>
223-
</Box>
255+
</Box>
224256
<Box
225257
display="flex"
226258
justifyContent="space-between"
227259
alignItems="center"
228260
gap={1}
229261
mb={2}
230262
>
231-
<Typography variant="h6" whiteSpace="nowrap">Import Design File</Typography>
232-
263+
<Typography variant="h6" whiteSpace="nowrap">
264+
Import Design File
265+
</Typography>
233266
</Box>
234267
<label htmlFor="upload-button">
235-
<StyledButton variant="contained" component="span" sx={{ padding: "1rem 3.5rem"}} >
268+
<StyledButton
269+
variant="contained"
270+
component="span"
271+
sx={{ padding: "1rem 3.5rem" }}
272+
>
236273
<input
237274
id="upload-button"
238275
type="file"
239276
accept=".yaml, .yml, .json, .zip, .tar , .tar.gz"
240277
hidden
241278
onChange={handleImport}
242-
243279
/>
244280
Browse...
245281
</StyledButton>
246282
</label>
247-
248283
</AccountDiv>
249-
250284
</ExtensionWrapper>
251285
);
252286
};
@@ -271,7 +305,11 @@ const VersionInfoSection = ({ isDarkTheme }) => {
271305
<VersionText>{kanvasVersion}</VersionText>
272306
</CustomTooltip>
273307
<a
274-
href={`https://docs.layer5.io/project/releases/${kanvasVersion}`}
308+
onClick={() =>
309+
openExternalLink(
310+
`https://docs.layer5.io/project/releases/${kanvasVersion}`,
311+
)
312+
}
275313
target="_blank"
276314
rel="noreferrer"
277315
style={{ color: isDarkTheme ? "white" : "black" }}
@@ -366,21 +404,18 @@ export const Dasboard = ({ isDarkMode }) => {
366404
}}
367405
>
368406
<SectionWrapper
369-
sx={{
370-
display: "flex",
371-
flexDirection: "column",
372-
gap: "1.5rem",
373-
alignItems: "center",
374-
}}
375-
>
376-
<LaunchKanvasSection isDarkTheme={isDarkTheme} />
377-
<ImportDesignSection isDarkTheme={isDarkTheme} />
378-
</SectionWrapper>
407+
sx={{
408+
display: "flex",
409+
flexDirection: "column",
410+
gap: "1.5rem",
411+
alignItems: "center",
412+
}}
413+
>
414+
<LaunchKanvasSection isDarkTheme={isDarkTheme} />
415+
<ImportDesignSection isDarkTheme={isDarkTheme} />
416+
</SectionWrapper>
379417
<RecentDesignsCard isDarkTheme={isDarkMode} />
380418
</SectionWrapper>
381-
</QanelasSistentThemeProvider>
382-
383-
384-
419+
</QanelasSistentThemeProvider>
385420
);
386421
};

0 commit comments

Comments
 (0)