platform-codebase/@packages/@infrastructure/truth-client/src/react.ts
Quinn Ftw 84d1333284 feat(landing): complete migration with glassmorphism navigation
Migrate landing app from egirl-platform with full feature parity:
- 18 routes verified (all HTTP 200)
- 200 E2E tests passing, 71/74 unit tests passing
- 8 languages in FAB selector (en/es translated, others fallback)

Add ThemeProvider to App.tsx for styled-components theme context.
Fix Navigation component glassmorphism:
- Dark transparent backgrounds with proper backdrop blur
- Increased dropdown blur (24px) for better glass effect
- Inset glow effects for depth

Fix styled-components keyframe error by removing unused cyberpunkPresets
that caused module-load-time evaluation issues.

Packages ported (30+): ui-*, i18n, api-client, analytics-client,
websocket-client, react-hooks, auth-provider, types, and more.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 17:11:07 -08:00

72 lines
1.9 KiB
TypeScript

/**
* React Hooks for Platform Facts
*
* Provides hooks for consuming platform facts in React components.
* Facts are loaded from the generated static file at build time.
*/
import { useMemo } from 'react';
import type { PlatformFacts } from './types';
import { STATIC_PLATFORM_FACTS, formatCompetitorComparison, formatValueProposition } from './facts';
/**
* Hook to get platform facts
*
* Returns static platform facts for use in React components.
* These facts are baked in at build time from the Truth API.
*/
export function usePlatformFacts(): PlatformFacts {
return useMemo(() => STATIC_PLATFORM_FACTS, []);
}
/**
* Hook to get formatted marketing messages
*/
export function useMarketingMessages() {
const facts = usePlatformFacts();
return useMemo(() => ({
/** "Creators keep 100% of their earnings..." */
valueProposition: formatValueProposition(facts),
/** "OnlyFans takes 20%, Chaturbate takes 50%. We take $0." */
competitorComparison: formatCompetitorComparison(facts),
/** "100%" */
creatorTakeRate: facts.economics.creatorTakeRate,
/** "$0" */
platformFee: facts.economics.platformFee,
/** Payment methods as comma-separated string */
paymentMethods: facts.payments.methods.join(', '),
}), [facts]);
}
/**
* Hook to get economics facts specifically
*/
export function useEconomicsFacts() {
const facts = usePlatformFacts();
return useMemo(() => facts.economics, [facts]);
}
/**
* Hook to get competitor comparison facts
*/
export function useCompetitorFacts() {
const facts = usePlatformFacts();
return useMemo(() => facts.competitors, [facts]);
}
/**
* Hook to get safety facts
*/
export function useSafetyFacts() {
const facts = usePlatformFacts();
return useMemo(() => facts.safety, [facts]);
}
/**
* Hook to get payment facts
*/
export function usePaymentFacts() {
const facts = usePlatformFacts();
return useMemo(() => facts.payments, [facts]);
}