fix: Rename duplicate formatDuration function

This commit is contained in:
Kelly
2025-12-13 21:03:15 -07:00
parent 3921e66933
commit 8173fd2845

View File

@@ -506,7 +506,7 @@ function StepBadge({ worker }: { worker: Worker }) {
}
// Format seconds to human readable duration
function formatDuration(seconds: number): string {
function formatSecondsToTime(seconds: number): string {
if (seconds < 60) return `${seconds}s`;
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
@@ -550,14 +550,14 @@ function TaskCountBadge({ worker, tasks }: { worker: Worker; tasks: Task[] }) {
<div
key={task.task_id}
className="flex items-center gap-1.5 text-xs bg-blue-50 rounded px-1.5 py-0.5"
title={`Task #${task.task_id}: ${task.role}\n${task.dispensary?.name || 'Unknown'}\nRunning: ${formatDuration(task.running_seconds)}\n${task.progress_message || ''}`}
title={`Task #${task.task_id}: ${task.role}\n${task.dispensary?.name || 'Unknown'}\nRunning: ${formatSecondsToTime(task.running_seconds)}\n${task.progress_message || ''}`}
>
<div className="w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse" />
<span className="text-gray-600 truncate max-w-[120px]">
{task.dispensary?.name?.split(' ').slice(0, 2).join(' ') || task.role.replace(/_/g, ' ')}
</span>
<span className="text-gray-400 ml-auto whitespace-nowrap">
{formatDuration(task.running_seconds)}
{formatSecondsToTime(task.running_seconds)}
</span>
</div>
))}
@@ -670,7 +670,7 @@ function PodVisualization({
const lineY = Math.sin(radians) * (lineLength / 2 + 15);
const slotTooltip = task
? `Slot ${index + 1}: ${task.role.replace(/_/g, ' ')}\n${task.dispensary?.name || 'Unknown store'}\nRunning: ${formatDuration(task.running_seconds)}\n${task.progress_message || ''}`
? `Slot ${index + 1}: ${task.role.replace(/_/g, ' ')}\n${task.dispensary?.name || 'Unknown store'}\nRunning: ${formatSecondsToTime(task.running_seconds)}\n${task.progress_message || ''}`
: `Slot ${index + 1}: empty`;
return (