Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: emui artifact layout fix #1877

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 14 additions & 33 deletions enclave-manager/web/src/components/AppLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Flex } from "@chakra-ui/react";
import { PropsWithChildren, useRef } from "react";
import { Box, Flex } from "@chakra-ui/react";
import { PropsWithChildren } from "react";
import { Navbar } from "../emui/Navbar";
import { KurtosisBreadcrumbs } from "./KurtosisBreadcrumbs";
import {
Expand All @@ -14,14 +14,7 @@ export const AppLayout = ({ children }: PropsWithChildren) => {
return (
<>
<Navbar />
<Flex
as="main"
w={"100%"}
minH={"100vh"}
justifyContent={"flex-start"}
flexDirection={"column"}
className={"app-container"}
>
<Flex flexDirection="column" as="main" w={"100%"} minH={"100vh"} className={"app-container"}>
{children}
</Flex>
</>
Expand All @@ -33,18 +26,11 @@ type AppPageLayoutProps = PropsWithChildren<{
}>;

export const AppPageLayout = ({ preventPageScroll, children }: AppPageLayoutProps) => {
const headerRef = useRef<HTMLDivElement>(null);
const numberOfChildren = Array.isArray(children) ? children.length : 1;

if (numberOfChildren === 1) {
return (
<Flex
flexDirection={"column"}
w={"100%"}
h={"100%"}
maxHeight={preventPageScroll ? `100vh` : undefined}
flex={"1"}
>
<Box w={"100%"} h={preventPageScroll ? `100vh` : "100%"}>
<Flex
flexDirection={"column"}
flex={"1"}
Expand All @@ -55,37 +41,32 @@ export const AppPageLayout = ({ preventPageScroll, children }: AppPageLayoutProp
pr={MAIN_APP_RIGHT_PADDING}
>
<KurtosisBreadcrumbs />
<Flex
<Box
w={"100%"}
h={"100%"}
minH={preventPageScroll ? "0" : undefined}
pt={MAIN_APP_TOP_PADDING}
pb={MAIN_APP_BOTTOM_PADDING}
flexDirection={"column"}
flex={"1"}
>
{children}
</Flex>
</Box>
</Flex>
</Flex>
</Box>
);
}

// TS cannot infer that children is an array if numberOfChildren === 2
if (numberOfChildren === 2 && Array.isArray(children)) {
return (
<Flex direction="column" width={"100%"} h={"100%"} flex={"1"}>
<Flex ref={headerRef} width={"100%"} bg={"gray.850"}>
<Flex
flexDirection={"column"}
width={"100%"}
pl={MAIN_APP_LEFT_PADDING}
pr={MAIN_APP_RIGHT_PADDING}
maxW={MAIN_APP_MAX_WIDTH}
>
<Flex flexDirection={"column"} width={"100%"} h={preventPageScroll ? `100vh` : "100%"} flex={"1"}>
<Box width={"100%"} bg={"gray.850"}>
<Box width={"100%"} pl={MAIN_APP_LEFT_PADDING} pr={MAIN_APP_RIGHT_PADDING} maxW={MAIN_APP_MAX_WIDTH}>
<KurtosisBreadcrumbs />
{children[0]}
</Flex>
</Flex>
</Box>
</Box>
<Flex
maxWidth={MAIN_APP_MAX_WIDTH}
pl={MAIN_APP_LEFT_PADDING}
Expand All @@ -96,7 +77,7 @@ export const AppPageLayout = ({ preventPageScroll, children }: AppPageLayoutProp
h={"100%"}
flex={"1"}
flexDirection={"column"}
maxHeight={preventPageScroll ? `calc(100vh - ${headerRef.current?.offsetHeight || 0}px)` : undefined}
minH={preventPageScroll ? "0" : undefined}
>
{children[1]}
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion enclave-manager/web/src/emui/enclaves/enclave/Enclave.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const EnclaveImpl = ({ enclave }: EnclaveImplProps) => {

return (
<Tabs isManual isLazy index={activeIndex} onChange={handleTabChange}>
<AppPageLayout>
<AppPageLayout preventPageScroll={activeTab === "logs"}>
<Flex justifyContent={"space-between"} alignItems={"flex-end"} width={"100%"}>
<Flex alignItems={"center"} gap={"8px"}>
<PageTitle>{enclave.name}</PageTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const ArtifactImpl = ({ enclave, artifactName, files }: ArtifactImplProps) => {

return (
<AppPageLayout preventPageScroll>
<Flex w={"100%"} gap={"32px"}>
<Flex w={"100%"} h={"100%"} gap={"32px"}>
<TitledCard title={"FILES"} w={"328px"} fillContainer>
<Flex>
<FileTree
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const EnclaveLogs = () => {
: 0;

return (
<AppPageLayout>
<AppPageLayout preventPageScroll>
<LogViewer
logLines={logLines}
progressPercent={progressPercent}
Expand Down
6 changes: 3 additions & 3 deletions engine/server/webapp/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"files": {
"main.js": "./static/js/main.b8e909a2.js",
"main.js": "./static/js/main.e00c76ec.js",
"index.html": "./index.html",
"main.b8e909a2.js.map": "./static/js/main.b8e909a2.js.map"
"main.e00c76ec.js.map": "./static/js/main.e00c76ec.js.map"
},
"entrypoints": [
"static/js/main.b8e909a2.js"
"static/js/main.e00c76ec.js"
]
}
2 changes: 1 addition & 1 deletion engine/server/webapp/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Kurtosis Enclave Manager"/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.b8e909a2.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Kurtosis Enclave Manager"/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.e00c76ec.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.