Improve public pages

This commit is contained in:
Urtzi Alfaro
2025-10-17 18:14:28 +02:00
parent d4060962e4
commit 7e089b80cf
46 changed files with 5734 additions and 1084 deletions

View File

@@ -0,0 +1,32 @@
/**
* Custom hook to detect pilot program participation via URL parameter
* Checks for ?pilot=true in URL and provides pilot status and coupon code
*/
import { useMemo } from 'react';
import { useLocation } from 'react-router-dom';
interface PilotDetectionResult {
isPilot: boolean;
couponCode: string | null;
trialMonths: number;
trialDays: number;
}
export const usePilotDetection = (): PilotDetectionResult => {
const location = useLocation();
const pilotInfo = useMemo(() => {
const searchParams = new URLSearchParams(location.search);
const pilotParam = searchParams.get('pilot');
const isPilot = pilotParam === 'true';
return {
isPilot,
couponCode: isPilot ? 'PILOT2025' : null,
trialMonths: isPilot ? 3 : 0,
trialDays: isPilot ? 90 : 14,
};
}, [location.search]);
return pilotInfo;
};