Skip to content

Commit

Permalink
Merge pull request #228 from exacaster/update_title_ui
Browse files Browse the repository at this point in the history
Update application title
  • Loading branch information
pdambrauskas authored Nov 22, 2022
2 parents c0ff527 + 46c1433 commit 57f9a6d
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 23 deletions.
1 change: 1 addition & 0 deletions frontend/src/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export type Application = {
id: string;
state: string;
createdAt: string;
contactedAt: string;
appId?: string;
submitParams: {
name: string;
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/components/AppInfo.module.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.noWrapTable {
td {
white-space: nowrap;
.appInfo {
max-width: 100%;
overflow-y: auto;

.noWrapTable {
td {
white-space: nowrap;
}
}
}
2 changes: 1 addition & 1 deletion frontend/src/components/AppInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {

const AppInfo: React.FC<Props> = ({app}) => {
return (
<Box mt="5">
<Box mt="5" className={styles.appInfo}>
<Table className={styles.noWrapTable} variant="simple" size="sm">
<Thead>
<Tr>
Expand Down
39 changes: 25 additions & 14 deletions frontend/src/components/AppTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
import {Grid, GridItem} from '@chakra-ui/react';
import React, {ReactNode} from 'react';
import {Grid, GridItem, Text} from '@chakra-ui/react';
import React from 'react';
import {Application} from '../client/types';
import AppActions from './AppActions';
import AppStatus from './AppStatus';
import DateTime from './DateTime';
import PageHeading from './PageHeading';

interface Props {
app: Application;
children: ReactNode;
}

const AppTitle: React.FC<Props> = ({app, children}) => {
const AppTitle: React.FC<Props> = ({app}) => {
return (
<PageHeading>
<Grid templateColumns="repeat(5, 1fr)">
<GridItem colSpan={4}>
{children} <AppStatus status={app.state} />
</GridItem>
<GridItem colSpan={1} justifySelf="end">
<AppActions app={app} />
</GridItem>
</Grid>
</PageHeading>
<>
<PageHeading mb="3">
<Grid templateColumns="repeat(5, 1fr)">
<GridItem colSpan={4}>
{app.submitParams.name} <AppStatus status={app.state} />
</GridItem>
<GridItem colSpan={1} justifySelf="end">
<AppActions app={app} />
</GridItem>
</Grid>
</PageHeading>
<Text fontSize="sm" color="gray">
<Text as="b">Application Id: </Text> {app.id}
{' | '}
<Text as="b">Created: </Text>
<DateTime>{app.createdAt}</DateTime>
{' | '}
<Text as="b">Last checked: </Text>
<DateTime>{app.contactedAt}</DateTime>
</Text>
</>
);
};

Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/PageHeading.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {Heading} from '@chakra-ui/layout';
import {Heading, HeadingProps} from '@chakra-ui/layout';
import {ReactNode} from 'react';

interface Props {
children: ReactNode;
mb?: HeadingProps['mb'];
}

const PageHeading: React.FC<Props> = ({children}) => {
const PageHeading: React.FC<Props> = ({children, mb = '5'}) => {
return (
<>
<Heading size="lg" mb="5">
<Heading size="lg" mb={mb}>
{children}
</Heading>
</>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Batch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Batch: React.FC = () => {

return (
<div>
<AppTitle app={batch}>Batch {id}</AppTitle>
<AppTitle app={batch} />
<Box textStyle="caption" mt="5">
Logs:
</Box>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Session: React.FC = () => {

return (
<div>
<AppTitle app={session}>Session {id}</AppTitle>
<AppTitle app={session} />
<Box textStyle="caption" mt="5">
Logs:
</Box>
Expand Down

0 comments on commit 57f9a6d

Please sign in to comment.