UNPKG

vanta-auditor-tui

Version:

Beautiful terminal UI for exporting Vanta audit evidence with ZIP support and progress tracking

53 lines 2.7 kB
import React from "react"; import { Box, Text } from "ink"; import { ProgressBar, Spinner } from "../lib/inkModules.js"; import { theme } from "../theme.js"; export function ArchiveProgress({ progress }) { if (!progress) { return (React.createElement(Box, { flexDirection: "column" }, React.createElement(Box, null, React.createElement(Text, { color: theme.colors.primaryLight }, React.createElement(Spinner, { type: "dots" }), " Initializing archive...")))); } const progressPercent = progress.totalFiles ? progress.filesProcessed / progress.totalFiles : 0; return (React.createElement(Box, { flexDirection: "column" }, React.createElement(Box, { marginBottom: 1 }, React.createElement(Text, { color: theme.colors.primary, bold: true }, "\uD83D\uDCE6 Creating ZIP Archive")), React.createElement(Box, { flexDirection: "column" }, React.createElement(Box, null, React.createElement(Text, { color: theme.colors.text }, "Phase: ", progress.phase === "preparing" && "Preparing archive", progress.phase === "archiving" && "Adding files to archive", progress.phase === "finalizing" && "Finalizing archive", progress.phase === "complete" && "Archive complete")), progress.totalFiles && (React.createElement(Box, null, React.createElement(Text, { color: theme.colors.text }, "Files: ", progress.filesProcessed, "/", progress.totalFiles))), React.createElement(Box, { width: 50 }, React.createElement(ProgressBar, { percent: progressPercent })), progress.message && (React.createElement(Box, null, React.createElement(Text, { color: theme.colors.primaryLight }, progress.phase === "complete" ? "✅" : React.createElement(Spinner, { type: "dots" }), " ", progress.message))), progress.bytesProcessed > 0 && (React.createElement(Box, null, React.createElement(Text, { color: theme.colors.text }, "Size: ", formatBytes(progress.bytesProcessed))))))); } function formatBytes(bytes) { if (bytes === 0) return "0 B"; const k = 1024; const sizes = ["B", "KB", "MB", "GB"]; const i = Math.floor(Math.log(bytes) / Math.log(k)); return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}`; } //# sourceMappingURL=ArchiveProgress.js.map