shipthis
Version:
ShipThis manages building and uploading your Godot games to the App Store and Google Play.
32 lines (29 loc) • 1.65 kB
JavaScript
import { jsxs, jsx } from 'react/jsx-runtime';
import { Box, Text } from 'ink';
import { T as Title } from './Title-BCQtayg6.js';
const StatusRowLabel = ({ label, width }) => /* @__PURE__ */ jsx(Box, { marginRight: 2, width: width || 10, children: /* @__PURE__ */ jsx(Text, { children: `${label}` }) });
const StatusRow = ({ label, labelWidth, value, ...textProps }) => /* @__PURE__ */ jsxs(Box, { alignItems: "flex-end", flexDirection: "row", children: [
/* @__PURE__ */ jsx(StatusRowLabel, { label, width: labelWidth }),
/* @__PURE__ */ jsx(Text, { bold: true, ...textProps, children: value })
] });
const StatusTable = ({ colors, statuses, title, ...rest }) => {
const getColor = (key) => {
const value = statuses[key];
if (typeof value === "boolean") return value ? "green" : "red";
const defaultColor = "green";
const color = colors?.[key];
return color || defaultColor;
};
const getText = (key) => {
const value = statuses[key];
if (typeof value === "boolean") return value ? "YES" : "NO";
return value;
};
const maxLabelLength = Math.max(...Object.keys(statuses).map((key) => key.length));
const labelWidth = Math.max(maxLabelLength, 10);
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", ...rest, children: [
/* @__PURE__ */ jsx(Title, { children: title }),
/* @__PURE__ */ jsx(Box, { flexDirection: "column", marginLeft: 2, children: Object.entries(statuses).map(([key, value]) => /* @__PURE__ */ jsx(StatusRow, { color: getColor(key), label: key, labelWidth, value: getText(key) }, key)) })
] });
};
export { StatusTable as S, StatusRow as a, StatusRowLabel as b };