Skip to content

Commit

Permalink
Use flexbox for layout height, better console size
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Jun 5, 2022
1 parent fded657 commit 2a2353c
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 62 deletions.
9 changes: 8 additions & 1 deletion imports/dashboard/dashboardLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ const DashboardLayout = (props: React.PropsWithChildren<{ loggedIn: boolean }>)
</List>
</Drawer>
)}
<div style={{ marginLeft: drawerVariant === 'permanent' && props.loggedIn ? '200px' : undefined }}>
<div style={{
padding: 20,
marginLeft: drawerVariant === 'permanent' && props.loggedIn ? '200px' : undefined,
flexDirection: 'column',
display: 'flex',
flex: 1
}}
>
{props.children}
</div>
</Layout>
Expand Down
4 changes: 3 additions & 1 deletion imports/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const Layout = (props: React.PropsWithChildren<{
// background: 'linear-gradient(to top, #fc00ff, #00dbde)',
minHeight: '100vh',
width: '100vw',
maxWidth: '100%'
maxWidth: '100%',
display: 'flex',
flexDirection: 'column'
// minWidth: '100%'
}}
>
Expand Down
16 changes: 7 additions & 9 deletions pages/dashboard/[server]/console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ const Console = ({ setAuthenticated }: {
return !listening
? <ConnectionFailure loading={listening === null} />
: (
<Paper style={{ padding: 20 }}>
<Paper style={{ padding: 20, flex: 1, display: 'flex', flexDirection: 'column' }}>
<Typography variant='h5' gutterBottom>Console - {server}</Typography>
<Paper variant='outlined' style={{ height: '60vh', padding: 10, color, ...terminalUi }}>
<Paper variant='outlined' style={{ flex: 1, padding: 10, color, ...terminalUi }}>
<ConsoleView console={consoleText} />
</Paper>
<CommandTextField ws={ws} buffer={buffer} id={id} />
Expand All @@ -187,13 +187,11 @@ const ConsolePage = () => {
url={`/dashboard/${server}/console`}
/>
<DashboardLayout loggedIn={nodeExists && serverExists && authenticated}>
<div style={{ padding: 20 }}>
{!nodeExists || !serverExists
? <NotExistsError node={!nodeExists} />
: !authenticated
? <AuthFailure />
: <Console setAuthenticated={setAuthenticated} />}
</div>
{!nodeExists || !serverExists
? <NotExistsError node={!nodeExists} />
: !authenticated
? <AuthFailure />
: <Console setAuthenticated={setAuthenticated} />}
</DashboardLayout>
</React.StrictMode>
)
Expand Down
18 changes: 8 additions & 10 deletions pages/dashboard/[server]/files/[[...path]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ const Files: NextPage<{ path: string }> = (props: { path: string }) => {
return (
<React.StrictMode>
<DashboardLayout loggedIn={nodeExists && serverExists && authenticated}>
<div style={{ padding: 20 }}>
{!nodeExists || !serverExists ? <NotExistsError node={!nodeExists} />
: !authenticated
? <AuthFailure />
: <FileManager
path={props.path}
setServerExists={setServerExists}
setAuthenticated={setAuthenticated}
/>}
</div>
{!nodeExists || !serverExists ? <NotExistsError node={!nodeExists} />
: !authenticated
? <AuthFailure />
: <FileManager
path={props.path}
setServerExists={setServerExists}
setAuthenticated={setAuthenticated}
/>}
</DashboardLayout>
</React.StrictMode>
)
Expand Down
14 changes: 6 additions & 8 deletions pages/dashboard/[server]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,12 @@ const Statistics = () => {
url={`/dashboard/${server}`}
/>
<DashboardLayout loggedIn={nodeExists && serverExists && authenticated}>
<div style={{ padding: 20 }}>
{!nodeExists || !serverExists ? <NotExistsError node={!nodeExists} />
: !authenticated ? <AuthFailure /> : (
(!listening || !statistics) ? <ConnectionFailure loading={listening === null} /> : (
<StatisticsDisplayMemo statistics={statistics} />
)
)}
</div>
{!nodeExists || !serverExists ? <NotExistsError node={!nodeExists} />
: !authenticated ? <AuthFailure /> : (
(!listening || !statistics) ? <ConnectionFailure loading={listening === null} /> : (
<StatisticsDisplayMemo statistics={statistics} />
)
)}
</DashboardLayout>
</React.StrictMode>
)
Expand Down
64 changes: 31 additions & 33 deletions pages/dashboard/[server]/properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,39 +62,37 @@ const ServerProperties = () => {
url={`/dashboard/${server}/properties`}
/>
<DashboardLayout loggedIn={nodeExists && serverExists && authenticated}>
<div style={{ padding: 20 }}>
{!nodeExists || !serverExists ? <NotExistsError node={!nodeExists} />
: !authenticated ? <AuthFailure /> : (
!listening ? <ConnectionFailure loading={listening === null} /> : (
<Paper style={{ padding: 20 }}>
{originalFileContent === null || fileContent === null ? (
<>
<Typography variant='h5' gutterBottom>server.properties</Typography>
<div style={{ paddingBottom: 10 }} />
<Typography>
Looks like this server does not have a server.properties file.
</Typography>
</>
) : (
<>
<Editor
name='server.properties'
content={fileContent}
siblingFiles={[]}
handleClose={(setContent) => setContent(originalFileContent)}
server={server as string}
path='/'
ip={ip}
setMessage={setMessage}
closeText='Cancel'
/>
{message && <Message message={message} setMessage={setMessage} />}
</>
)}
</Paper>
)
)}
</div>
{!nodeExists || !serverExists ? <NotExistsError node={!nodeExists} />
: !authenticated ? <AuthFailure /> : (
!listening ? <ConnectionFailure loading={listening === null} /> : (
<Paper style={{ padding: 20 }}>
{originalFileContent === null || fileContent === null ? (
<>
<Typography variant='h5' gutterBottom>server.properties</Typography>
<div style={{ paddingBottom: 10 }} />
<Typography>
Looks like this server does not have a server.properties file.
</Typography>
</>
) : (
<>
<Editor
name='server.properties'
content={fileContent}
siblingFiles={[]}
handleClose={(setContent) => setContent(originalFileContent)}
server={server as string}
path='/'
ip={ip}
setMessage={setMessage}
closeText='Cancel'
/>
{message && <Message message={message} setMessage={setMessage} />}
</>
)}
</Paper>
)
)}
</DashboardLayout>
</React.StrictMode>
)
Expand Down

0 comments on commit 2a2353c

Please sign in to comment.