shoc-frontend-new/src/domain/work-orders/utils/service-notes-ui.ts

16 lines
551 B
TypeScript

/** Design: cell shows Service & Notes layout when note or extras exist. */
export function hasServiceNotesDetails(
serviceNotes?: string | null,
extraServices?: string[] | null,
): boolean {
return Boolean(serviceNotes?.trim()) || (extraServices?.length ?? 0) > 0;
}
/** Truncate note for the board cell subtitle (~30 chars, design). */
export function truncateServiceNotesPreview(note: string, max = 30): string {
const trimmed = note.trim();
if (trimmed.length <= max) {
return trimmed;
}
return `${trimmed.slice(0, max)}…`;
}