File size: 1,198 Bytes
f6213fc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | export function formatClock(seconds) {
const safe = Math.max(0, Math.floor(seconds || 0));
const hours = Math.floor(safe / 3600) % 24;
const minutes = Math.floor((safe % 3600) / 60);
return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`;
}
export function formatDuration(seconds) {
const safe = Math.max(0, Math.floor(seconds || 0));
if (safe >= 3600) {
return `${(safe / 3600).toFixed(1)}h`;
}
return `${Math.round(safe / 60)}m`;
}
export function kindLabel(kind) {
switch (kind) {
case 'business':
return 'Business';
case 'residential':
return 'Residential';
case 'restaurant':
return 'Restaurant';
default:
return 'Other';
}
}
export function iconForKind(kind) {
switch (kind) {
case 'business':
return 'fa-building';
case 'residential':
return 'fa-house';
case 'restaurant':
return 'fa-utensils';
default:
return 'fa-box';
}
}
export function toneForKind(kind) {
switch (kind) {
case 'business':
return 'blue';
case 'residential':
return 'emerald';
case 'restaurant':
return 'amber';
default:
return 'slate';
}
}
|