πŸ“„ File detail

components/messages/teamMemSaved.ts

🧩 .tsπŸ“ 20 linesπŸ’Ύ 711 bytesπŸ“ text
← Back to All Files

🎯 Use case

This file lives under β€œcomponents/”, which covers shared React UI pieces. On the API surface it exposes teamMemSavedPart β€” mainly functions, hooks, or classes. It composes internal code from types (relative imports).

Generated from folder role, exports, dependency roots, and inline comments β€” not hand-reviewed for every path.

🧠 Inline summary

import type { SystemMemorySavedMessage } from '../../types/message.js' /** * Returns the team-memory segment for the memory-saved UI, plus the count so * the caller can derive the private count without accessing teamCount itself.

πŸ“€ Exports (heuristic)

  • teamMemSavedPart

πŸ–₯️ Source preview

import type { SystemMemorySavedMessage } from '../../types/message.js'

/**
 * Returns the team-memory segment for the memory-saved UI, plus the count so
 * the caller can derive the private count without accessing teamCount itself.
 * Plain function (not a React component) so the React Compiler won't hoist
 * the teamCount property access for memoization. This module is only loaded
 * when feature('TEAMMEM') is true.
 */
export function teamMemSavedPart(
  message: SystemMemorySavedMessage,
): { segment: string; count: number } | null {
  const count = message.teamCount ?? 0
  if (count === 0) return null
  return {
    segment: `${count} team ${count === 1 ? 'memory' : 'memories'}`,
    count,
  }
}