diff --git a/app/core/components/alert.tsx b/app/core/components/alert.tsx index c517aa4..c3806f2 100644 --- a/app/core/components/alert.tsx +++ b/app/core/components/alert.tsx @@ -1,4 +1,4 @@ -import type { ReactElement } from "react"; +import type { ReactElement, ReactChild } from "react"; type AlertVariant = "error" | "success" | "info" | "warning"; @@ -10,8 +10,8 @@ type AlertVariantProps = { }; type Props = { - title: string; - message: string; + title: ReactChild; + message: ReactChild; variant: AlertVariant; }; diff --git a/app/settings/components/phone/phone-number-form.tsx b/app/settings/components/phone/phone-number-form.tsx index 0208d6c..d2ddf14 100644 --- a/app/settings/components/phone/phone-number-form.tsx +++ b/app/settings/components/phone/phone-number-form.tsx @@ -1,5 +1,5 @@ import { useEffect } from "react"; -import { useMutation, useQuery } from "blitz"; +import { useMutation, useQuery, withErrorBoundary } from "blitz"; import { useForm } from "react-hook-form"; import setPhoneNumber from "../../mutations/set-phone-number"; @@ -14,83 +14,113 @@ type Form = { phoneNumberSid: string; }; -export default function PhoneNumberForm() { - const { hasFilledTwilioCredentials } = useCurrentUser(); - const currentPhoneNumber = useUserPhoneNumber(); - const { - register, - handleSubmit, - setValue, - formState: { isSubmitting }, - } = useForm
- ); -} + {isError ? ( ++ We failed to fetch your Twilio phone numbers. Make sure both your SID and your auth token + are valid and that your Twilio account isn't suspended. + {error.moreInfo ? Related Twilio docs : null} +
+ + > + } + /> + ), + onError: (error) => console.log("error", error), + }, +); function parseErrorMessage(error: Error | null): string { if (!error) {