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.

849 B
Raw Blame
import { useMemo } from 'react';

import { useTranslation } from '../../../../i18n';
import { countryNamer } from '../../../../utils/countryName';
import { useAssistantView } from '../../assistantViewContext';
import { densityLimits } from './atlasCardModel';

/**
 * What every atlas card reads from where it is drawn: country names in the
 * reader's language, the locale for dates and numbers, and how many flags and
 * wish tiles fit. The phone always draws the compact card, a narrow window too.
 */
export function useAtlasCard() {
  const { language, locale } = useTranslation();
  const { variant, density } = useAssistantView();
  const roomy = variant !== 'fullscreen' && density === 'roomy';
  const countryName = useMemo(() => countryNamer(language), [language]);
  return { countryName, locale, roomy, limits: densityLimits(roomy) };
}