Shared Package
Shared constants, helper utilities, hooks, types, locale files, and utility functions used by both web and mobile apps.
Key Modules
Section titled “Key Modules”| Module | What | LOC |
|---|---|---|
| Hooks | 6 React hooks — timer engine, dashboard stats, work tree, selection, appointment status, i18n | ~1,230 |
| Helpers | Business logic — work tree CRUD, finance processing, pomodoro phases, timer rounding | ~1,850 |
| Constants | Shared values — colors, currencies, locales, UI dimensions, appointment defaults | ~200 |
| Locales | i18n translations in en/ and de/ across 5 namespaces (auth, common, docs, landing, legal) | — |
| Types | Shared TypeScript types (e.g., TimeTrackerEngine types) | — |
Package Exports
Section titled “Package Exports”| Export Path | What |
|---|---|
@life-manager/shared/constants | All constants barrel |
@life-manager/shared/constants/* | Individual constant files |
@life-manager/shared/helper | All helpers barrel |
@life-manager/shared/helper/* | Individual helper modules |
@life-manager/shared/hooks | All hooks barrel |
@life-manager/shared/hooks/* | Individual hooks |
@life-manager/shared/types | Shared types |
@life-manager/shared/utils | Utility functions |
Directory Structure
Section titled “Directory Structure”src/ constants/ # Shared constant values appointment.ts # Appointment status options, defaults colors.ts # Mantine color palette, module color options settings.ts # Currency, locale, rounding options, app defaults ui.ts # UI dimension constants, layout breakpoints
helper/ # Feature-grouped utility functions workHelper/ workHelperFunctions.ts # Work-related calculations, formatting treeHelperFunctions.ts # Project tree manipulation timeEntryHelperFunctions.ts # Time entry formatting, calculations timeTrackerFunctions.ts # Timer rounding, session time calculations getTimeFragmentSession.ts # Time fragment session logic resolveTimeEntryOverlaps.ts # Overlap detection and resolution financeHelper/ financeHelperFunction.ts # Finance calculations, formatting processRecurringCashflows.ts # Recurring cashflow processing logic pomodoroHelper/ pomodoroFunctions.ts # Phase duration, transitions, state reconstruction pomodoroStyles.ts # Phase colors, icons, border styles appointmentHelper/ appointmentFormHelper.ts # Appointment form defaults, validation appointmentTimerHelpers.ts # Appointment timer calculation utilities
hooks/ # Shared React hooks useIntl.ts # Internationalization (formatMoney, formatDate, locale) use-time-tracker-engine.ts # Shared timer engine logic
locales/ # i18n translation files en/ # auth, common, docs, landing, legal de/ # auth, common, docs, landing, legal
types/ # Shared type definitions time-tracker-engine.types.ts
utils/ # Utility functions intl.ts # Internationalization utilitiesKey Conventions
Section titled “Key Conventions”- Constants: Always import from
@life-manager/shared/constants/*(never duplicate in app code) - Helpers: Business logic shared between web and mobile lives here, not in app-specific
src/lib/ - useIntl hook: Used in protected routes for formatting. Public routes use
useTranslation()from i18next - Locales: Five namespaces (auth, common, docs, landing, legal) in two languages (en, de)
Adding New Shared Code
Section titled “Adding New Shared Code”- Constants: Add to existing file in
constants/or create new file, re-export fromconstants/index.ts - Helpers: Create in appropriate feature folder under
helper/, re-export fromhelper/index.ts - Hooks: Add to
hooks/, re-export fromhooks/index.ts - Types: Add to
types/, re-export fromtypes/index.ts - Translations: Add keys to both
en/andde/locale files in matching namespace