Skip to content

Commit 3007b98

Browse files
committed
feat: improve design of app, job and workflow cards
1 parent 5188603 commit 3007b98

File tree

4 files changed

+79
-28
lines changed

4 files changed

+79
-28
lines changed

src/components/BaseCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export interface BaseCardProps {
5959
* * optional actions that are always displayed - {@link actions}
6060
* * an optional collapsed view that can be enabled by default
6161
* * children are passed into the main area (unexpanded view) of the component
62+
* * coloured top border using the header color
6263
*/
6364
export const BaseCard = ({
6465
children,
@@ -72,7 +73,7 @@ export const BaseCard = ({
7273
const [expanded, setExpanded] = useState(!collapsedByDefault);
7374

7475
return (
75-
<Card>
76+
<Card sx={{ borderTop: header?.color ? "3px solid" : "none", borderTopColor: header?.color }}>
7677
{!!header && (
7778
<CardHeader
7879
avatar={

src/components/runCards/ApplicationCard/ApplicationCard.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type ApplicationSummary } from "@squonk/data-manager-client";
22

3-
import { CircularProgress, LinearProgress } from "@mui/material";
3+
import { CircularProgress, LinearProgress, Typography } from "@mui/material";
44
import dynamic from "next/dynamic";
55

66
import { useIsUserAdminOrEditorOfCurrentProject } from "../../../hooks/projectHooks";
@@ -51,6 +51,14 @@ export const ApplicationCard = ({ app, projectId }: ApplicationCardProps) => {
5151
avatar: app.kind[0],
5252
color: "secondary.dark",
5353
}}
54-
/>
54+
>
55+
<Typography
56+
color="text.secondary"
57+
sx={{ textTransform: "uppercase", fontWeight: "bold" }}
58+
variant="caption"
59+
>
60+
Application
61+
</Typography>
62+
</BaseCard>
5563
);
5664
};

src/components/runCards/JobCard/JobCard.tsx

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@ import { useState } from "react";
22

33
import { type JobSummary } from "@squonk/data-manager-client";
44

5-
import { Alert, Chip, LinearProgress, Link, MenuItem, TextField, Typography } from "@mui/material";
5+
import { Launch as LaunchIcon } from "@mui/icons-material";
6+
import {
7+
Alert,
8+
Box,
9+
Chip,
10+
IconButton,
11+
LinearProgress,
12+
MenuItem,
13+
TextField,
14+
Tooltip,
15+
Typography,
16+
} from "@mui/material";
617
import dynamic from "next/dynamic";
718
import semver from "semver";
819

@@ -77,24 +88,57 @@ export const JobCard = ({ projectId, job: jobs, disabled = false }: ApplicationC
7788
header={{ color: "primary.main", subtitle: job.name, avatar: job.job[0], title: job.job }}
7889
key={projectId} // Reset state when project changes
7990
>
80-
<Typography gutterBottom>{job.description}</Typography>
81-
<Typography variant="body2">
82-
<Link href={job.doc_url} rel="noopener noreferrer" target="_blank">
83-
docs
84-
</Link>
91+
<Typography
92+
color="text.secondary"
93+
sx={{ textTransform: "uppercase", fontWeight: "bold" }}
94+
variant="caption"
95+
>
96+
Job
8597
</Typography>
86-
<Typography gutterBottom>
87-
{/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */}
88-
<em>{job.category || "<none>"}</em> : {job.collection}
89-
</Typography>
90-
<Chips>
91-
{job.keywords?.map((word) => (
92-
<Chip color="primary" key={word} label={word} size="small" variant="outlined" />
93-
))}
94-
</Chips>
98+
99+
{!!job.description && (
100+
<Typography sx={{ mt: 1, mb: 2, textWrap: "pretty" }} variant="body1">
101+
{job.description}
102+
{!!job.doc_url && (
103+
<Tooltip title="View documentation">
104+
<IconButton
105+
href={job.doc_url}
106+
rel="noopener noreferrer"
107+
size="small"
108+
sx={{ ml: 0.5, p: 0.25, verticalAlign: "middle" }}
109+
target="_blank"
110+
>
111+
<LaunchIcon sx={{ fontSize: "0.875rem" }} />
112+
</IconButton>
113+
</Tooltip>
114+
)}
115+
</Typography>
116+
)}
117+
118+
<Box sx={{ mb: 2 }}>
119+
<Typography gutterBottom color="text.secondary" variant="body2">
120+
Category & Collection:
121+
</Typography>
122+
<Typography variant="body1">
123+
<em>{job.category ?? "No category"}</em>{job.collection}
124+
</Typography>
125+
</Box>
126+
127+
{!!job.keywords && job.keywords.length > 0 && (
128+
<Box sx={{ mb: 2 }}>
129+
<Typography gutterBottom color="text.secondary" variant="body2">
130+
Keywords:
131+
</Typography>
132+
<Chips>
133+
{job.keywords.map((word) => (
134+
<Chip color="primary" key={word} label={word} size="small" variant="outlined" />
135+
))}
136+
</Chips>
137+
</Box>
138+
)}
95139

96140
{!!job.disabled_reason && (
97-
<Alert severity="warning" sx={{ mt: 1, mb: -2 }}>
141+
<Alert severity="warning" sx={{ mt: 1 }}>
98142
{job.disabled_reason}
99143
</Alert>
100144
)}

src/components/runCards/WorkflowCard/WorkflowCard.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,19 @@ export const WorkflowCard = ({ workflow, runningWorkflows = [] }: WorkflowCardPr
9090
}}
9191
key={workflow.id}
9292
>
93+
<Typography
94+
color="text.secondary"
95+
sx={{ textTransform: "uppercase", fontWeight: "bold" }}
96+
variant="caption"
97+
>
98+
Workflow
99+
</Typography>
93100
<Typography gutterBottom>
94101
{workflow.workflow_description ?? <em>No description</em>}
95102
</Typography>
96103
<Typography gutterBottom variant="body2">
97104
Version: {workflow.version ?? <em>n/a</em>}
98105
</Typography>
99-
<Typography gutterBottom variant="body2">
100-
Scope: {workflow.scope}
101-
{workflow.scope_id ? ` (${workflow.scope_id})` : null}
102-
</Typography>
103-
{!!workflow.source_id && (
104-
<Typography gutterBottom variant="body2">
105-
Source Workflow ID: {workflow.source_id}
106-
</Typography>
107-
)}
108106
</BaseCard>
109107
);
110108
};

0 commit comments

Comments
 (0)