shipthis
Version:
ShipThis manages building and uploading your Godot games to the App Store and Google Play.
29 lines (26 loc) • 822 B
JavaScript
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
import { Box, Text } from 'ink';
import Spinner from 'ink-spinner';
import React from 'react';
const RunWithSpinner = ({
executeMethod,
msgComplete,
msgInProgress,
onComplete,
spinnerType
}) => {
const [isInProgress, setIsInProgress] = React.useState(true);
React.useEffect(() => {
setIsInProgress(true);
executeMethod().then(() => {
setIsInProgress(false);
return onComplete();
});
}, []);
if (!isInProgress && !msgComplete) return /* @__PURE__ */ jsx(Fragment, {});
return /* @__PURE__ */ jsxs(Box, { children: [
/* @__PURE__ */ jsx(Text, { children: isInProgress ? msgInProgress : msgComplete }),
isInProgress && /* @__PURE__ */ jsx(Spinner, { type: spinnerType })
] });
};
export { RunWithSpinner as R };