Files
triggerdotdev--trigger.dev/apps/webapp/app/components/run/RunCompletedDetail.tsx
T
Matt Aitken 9ff4c0dbd5 Project-wide Prettier setup (#237)
* Setup project-wide prettier

* Remove old workspace file

* Remove old debugging directives

* New top-level .prettierignore

* Updated Prettier config settings

* Contrubuting guide: Fix for some bad code blocks

* Added more ignores

* Improved the format script command

* printWidth set to 100

* Formatted entire repo (pnpm run format)
2023-08-01 10:21:22 +01:00

65 lines
2.0 KiB
TypeScript

import { CodeBlock } from "~/components/code/CodeBlock";
import { DateTime } from "~/components/primitives/DateTime";
import { Paragraph } from "~/components/primitives/Paragraph";
import { RunStatusIcon, RunStatusLabel } from "~/components/runs/RunStatuses";
import { MatchedRun, useRun } from "~/hooks/useRun";
import { formatDuration } from "~/utils";
import {
RunPanel,
RunPanelBody,
RunPanelDivider,
RunPanelError,
RunPanelHeader,
RunPanelIconProperty,
RunPanelIconSection,
} from "./RunCard";
export function RunCompletedDetail({ run }: { run: MatchedRun }) {
return (
<RunPanel>
<RunPanelHeader
icon={<RunStatusIcon status={run.status} className={"h-5 w-5"} />}
title={
<Paragraph variant="small/bright">
<RunStatusLabel status={run.status} />
</Paragraph>
}
/>
<RunPanelBody>
<RunPanelIconSection>
{run.startedAt && (
<RunPanelIconProperty
icon="calendar"
label="Started at"
value={<DateTime date={run.startedAt} />}
/>
)}
{run.completedAt && (
<RunPanelIconProperty
icon="flag"
label="Finished at"
value={<DateTime date={run.completedAt} />}
/>
)}
{run.startedAt && run.completedAt && (
<RunPanelIconProperty
icon="clock"
label="Total duration"
value={formatDuration(run.startedAt, run.completedAt, {
style: "long",
})}
/>
)}
</RunPanelIconSection>
<RunPanelDivider />
{run.error && <RunPanelError text={run.error.message} stackTrace={run.error.stack} />}
{run.output ? (
<CodeBlock language="json" code={run.output} />
) : (
run.output === null && <Paragraph variant="small">This run returned nothing</Paragraph>
)}
</RunPanelBody>
</RunPanel>
);
}