| 40 | * Encapsulates all team memory verb/string logic for getSearchReadSummaryText. |
| 41 | */ |
| 42 | export function appendTeamMemorySummaryParts( |
| 43 | memoryCounts: { |
| 44 | teamMemoryReadCount?: number |
| 45 | teamMemorySearchCount?: number |
| 46 | teamMemoryWriteCount?: number |
| 47 | }, |
| 48 | isActive: boolean, |
| 49 | parts: string[], |
| 50 | ): void { |
| 51 | const teamReadCount = memoryCounts.teamMemoryReadCount ?? 0 |
| 52 | const teamSearchCount = memoryCounts.teamMemorySearchCount ?? 0 |
| 53 | const teamWriteCount = memoryCounts.teamMemoryWriteCount ?? 0 |
| 54 | if (teamReadCount > 0) { |
| 55 | const verb = isActive |
| 56 | ? parts.length === 0 |
| 57 | ? 'Recalling' |
| 58 | : 'recalling' |
| 59 | : parts.length === 0 |
| 60 | ? 'Recalled' |
| 61 | : 'recalled' |
| 62 | parts.push( |
| 63 | `${verb} ${teamReadCount} team ${teamReadCount === 1 ? 'memory' : 'memories'}`, |
| 64 | ) |
| 65 | } |
| 66 | if (teamSearchCount > 0) { |
| 67 | const verb = isActive |
| 68 | ? parts.length === 0 |
| 69 | ? 'Searching' |
| 70 | : 'searching' |
| 71 | : parts.length === 0 |
| 72 | ? 'Searched' |
| 73 | : 'searched' |
| 74 | parts.push(`${verb} team memories`) |
| 75 | } |
| 76 | if (teamWriteCount > 0) { |
| 77 | const verb = isActive |
| 78 | ? parts.length === 0 |
| 79 | ? 'Writing' |
| 80 | : 'writing' |
| 81 | : parts.length === 0 |
| 82 | ? 'Wrote' |
| 83 | : 'wrote' |
| 84 | parts.push( |
| 85 | `${verb} ${teamWriteCount} team ${teamWriteCount === 1 ? 'memory' : 'memories'}`, |
| 86 | ) |
| 87 | } |
| 88 | } |
| 89 | |