Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor(cos): replace local formatAttachmentSize with shared formatBytes

Adam Eivybcf0182012b9
diff --git a/client/src/components/cos/tabs/TaskItem.jsx b/client/src/components/cos/tabs/TaskItem.jsx
index fc5904fddf..d7e5a8fc67 100644
--- a/client/src/components/cos/tabs/TaskItem.jsx
+++ b/client/src/components/cos/tabs/TaskItem.jsx
@@ -20,7 +20,7 @@ import {
import toast from '../../ui/Toast';
import * as api from '../../../services/api';
import { filterSelectableModels } from '../../../utils/providers';
-import { formatDurationMin } from '../../../utils/formatters';
+import { formatDurationMin, formatBytes } from '../../../utils/formatters';
const statusIcons = {
pending: <Clock size={16} aria-hidden="true" className="text-yellow-500" />,
@@ -76,14 +76,6 @@ function extractTaskType(description) {
return 'feature';
}
-// Format file size for display
-function formatAttachmentSize(bytes) {
- if (!bytes) return '';
- if (bytes < 1024) return `${bytes} B`;
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
-}
-
// Get success rate styling based on percentage
function getSuccessRateStyle(rate) {
if (rate >= 70) return { bg: 'bg-port-success/15', text: 'text-port-success', label: 'high' };
@@ -368,7 +360,7 @@ export default function TaskItem({ task, isSystem, awaitingApproval, onRefresh,
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-1 px-2 py-0.5 text-xs bg-port-accent/10 text-port-accent hover:bg-port-accent/20 rounded transition-colors"
- title={`${att.originalName || att.filename} (${formatAttachmentSize(att.size)})`}
+ title={`${att.originalName || att.filename}${att.size ? ` (${formatBytes(att.size)})` : ''}`}
>
<FileText size={10} aria-hidden="true" />
<span className="truncate max-w-[100px]">{att.originalName || att.filename}</span>