Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

725 B
Raw Blame
import type { CardPerson } from '@trek/shared';

import { useTranslation } from '../../../../i18n';
import { useViewerId } from '../parts/useViewerId';

/**
 * The words the costs' cards say about people, as the Costs page says them:
 * the signed-in user is "You", and "You paid" rather than "Ana paid".
 */
export function useBudgetPeople() {
  const { t } = useTranslation();
  const viewerId = useViewerId();
  const isViewer = (person: CardPerson) => person.id === viewerId;
  return {
    nameOf: (person: CardPerson) => (isViewer(person) ? t('costs.you') : person.name),
    paidBy: (person: CardPerson) =>
      isViewer(person) ? t('costs.youPaid') : t('assistant.card.budget.paidBy', { name: person.name }),
  };
}