set your twilio things from settings

This commit is contained in:
m5r
2021-10-16 01:25:13 +02:00
parent 3cc6f35071
commit 2afd3554b3
18 changed files with 242 additions and 483 deletions

View File

@ -33,14 +33,14 @@ const KeypadErrorModal: FunctionComponent<Props> = ({ isOpen, closeModal }) => {
<button
ref={openSettingsButtonRef}
type="button"
className="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-primary-500 text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 md:mt-0 md:w-auto md:text-sm"
className="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-primary-500 font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 md:mt-0 md:w-auto"
onClick={() => router.push(Routes.PhoneSettings())}
>
Take me there
</button>
<button
type="button"
className="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 md:mt-0 md:w-auto md:text-sm"
className="md:mr-2 mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white font-medium text-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 md:mt-0 md:w-auto"
onClick={closeModal}
>
I got it, thanks!

View File

@ -9,9 +9,9 @@ import useCurrentUser from "app/core/hooks/use-current-user";
import PageTitle from "../../core/components/page-title";
const PhoneCalls: BlitzPage = () => {
const { hasFilledTwilioCredentials } = useCurrentUser();
const { hasFilledTwilioCredentials, hasPhoneNumber } = useCurrentUser();
if (!hasFilledTwilioCredentials) {
if (!hasFilledTwilioCredentials || !hasPhoneNumber) {
return (
<>
<MissingTwilioCredentials />

View File

@ -15,7 +15,7 @@ import useCurrentUser from "app/core/hooks/use-current-user";
import KeypadErrorModal from "../components/keypad-error-modal";
const KeypadPage: BlitzPage = () => {
const { hasFilledTwilioCredentials, hasActiveSubscription } = useCurrentUser();
const { hasFilledTwilioCredentials, hasPhoneNumber, hasActiveSubscription } = useCurrentUser();
const router = useRouter();
const [isKeypadErrorModalOpen, setIsKeypadErrorModalOpen] = useState(false);
const [phoneCalls] = usePhoneCalls();
@ -85,7 +85,7 @@ const KeypadPage: BlitzPage = () => {
<Keypad onDigitPressProps={onDigitPressProps} onZeroPressProps={onZeroPressProps}>
<button
onClick={async () => {
if (!hasFilledTwilioCredentials) {
if (!hasFilledTwilioCredentials || !hasPhoneNumber) {
setIsKeypadErrorModalOpen(true);
return;
}