diff --git a/app/phone-calls/pages/keypad.tsx b/app/phone-calls/pages/keypad.tsx index bc344f5..a6de51b 100644 --- a/app/phone-calls/pages/keypad.tsx +++ b/app/phone-calls/pages/keypad.tsx @@ -1,4 +1,4 @@ -import { Fragment, useRef, useState } from "react"; +import { Fragment, Suspense, useRef, useState } from "react"; import type { BlitzPage } from "blitz"; import { Routes, useRouter } from "blitz"; import { atom, useAtom } from "jotai"; @@ -13,6 +13,7 @@ import usePhoneCalls from "../hooks/use-phone-calls"; import useKeyPress from "../hooks/use-key-press"; import useCurrentUser from "app/core/hooks/use-current-user"; import KeypadErrorModal from "../components/keypad-error-modal"; +import InactiveSubscription from "app/core/components/inactive-subscription"; const KeypadPage: BlitzPage = () => { const { hasFilledTwilioCredentials, hasPhoneNumber, hasOngoingSubscription } = useCurrentUser(); @@ -25,6 +26,10 @@ const KeypadPage: BlitzPage = () => { const intervalRef = useRef | null>(null); const pressDigit = useAtom(pressDigitAtom)[1]; useKeyPress((key) => { + if (!hasOngoingSubscription) { + return; + } + if (key === "Backspace") { return removeDigit(); } @@ -34,6 +39,10 @@ const KeypadPage: BlitzPage = () => { const longPressDigit = useAtom(longPressDigitAtom)[1]; const onZeroPressProps = { onPressStart() { + if (!hasOngoingSubscription) { + return; + } + pressDigit("0"); timeoutRef.current = setTimeout(() => { longPressDigit("+"); @@ -49,6 +58,10 @@ const KeypadPage: BlitzPage = () => { const onDigitPressProps = (digit: string) => ({ onPress() { // navigator.vibrate(1); // removed in webkit + if (!hasOngoingSubscription) { + return; + } + pressDigit(digit); }, }); @@ -75,6 +88,26 @@ const KeypadPage: BlitzPage = () => { }, }); + if (!hasOngoingSubscription) { + return ( + <> + +
+
+
+ {phoneNumber} +
+ + + +
+
+ + ); + } + return ( <>
@@ -91,8 +124,6 @@ const KeypadPage: BlitzPage = () => { } if (!hasOngoingSubscription) { - // TODO - setIsKeypadErrorModalOpen(true); return; }