From a01bf249286c7bf485d26cdf094a7e6ca67d9052 Mon Sep 17 00:00:00 2001 From: seaznCode Date: Tue, 5 May 2026 22:09:31 +0200 Subject: [PATCH] Add SubscribeGuard component to manage subscription access and loading state --- .../components/SubscribeGuard.tsx | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/app/coffee-abonnements/components/SubscribeGuard.tsx diff --git a/src/app/coffee-abonnements/components/SubscribeGuard.tsx b/src/app/coffee-abonnements/components/SubscribeGuard.tsx new file mode 100644 index 0000000..3c571e0 --- /dev/null +++ b/src/app/coffee-abonnements/components/SubscribeGuard.tsx @@ -0,0 +1,32 @@ +'use client'; + +import type { ReactNode } from 'react'; +import PageLayout from '../../components/PageLayout'; +import { useSubscribeGuard } from '../hooks/useSubscribeGuard'; + +type Props = { + children: ReactNode; +}; + +export default function SubscribeGuard({ children }: Props) { + const { isChecking, isAllowed } = useSubscribeGuard(); + + if (!isAllowed) { + return ( + +
+
+
+
+

+ {isChecking ? 'Checking subscription access...' : 'Redirecting...'} +

+
+
+
+ + ); + } + + return <>{children}; +} \ No newline at end of file