@@ -23,6 +23,7 @@ import { Label } from "~/components/primitives/Label";
2323import SegmentedControl from "~/components/primitives/SegmentedControl" ;
2424import { Select , SelectItem } from "~/components/primitives/Select" ;
2525import { InfoIconTooltip } from "~/components/primitives/Tooltip" ;
26+ import { env } from "~/env.server" ;
2627import { useOrganization } from "~/hooks/useOrganizations" ;
2728import { useProject } from "~/hooks/useProject" ;
2829import { redirectWithSuccessMessage } from "~/models/message.server" ;
@@ -150,9 +151,13 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
150151 const url = new URL ( request . url ) ;
151152 const option = url . searchParams . get ( "option" ) ;
152153
154+ const emailAlertsEnabled =
155+ env . ALERT_FROM_EMAIL !== undefined && env . ALERT_RESEND_API_KEY !== undefined ;
156+
153157 return typedjson ( {
154158 ...results ,
155159 option : option === "slack" ? ( "SLACK" as const ) : undefined ,
160+ emailAlertsEnabled,
156161 } ) ;
157162}
158163
@@ -200,7 +205,7 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
200205
201206export default function Page ( ) {
202207 const [ isOpen , setIsOpen ] = useState ( false ) ;
203- const { slack, option } = useTypedLoaderData < typeof loader > ( ) ;
208+ const { slack, option, emailAlertsEnabled } = useTypedLoaderData < typeof loader > ( ) ;
204209 const lastSubmission = useActionData ( ) ;
205210 const navigation = useNavigation ( ) ;
206211 const navigate = useNavigate ( ) ;
@@ -271,16 +276,23 @@ export default function Page() {
271276 </ InputGroup >
272277
273278 { currentAlertChannel === "EMAIL" ? (
274- < InputGroup fullWidth >
275- < Label > Email</ Label >
276- < Input
277- { ...conform . input ( channelValue ) }
278- placeholder = "email@youremail.com"
279- type = "email"
280- autoFocus
281- />
282- < FormError id = { channelValue . errorId } > { channelValue . error } </ FormError >
283- </ InputGroup >
279+ emailAlertsEnabled ? (
280+ < InputGroup fullWidth >
281+ < Label > Email</ Label >
282+ < Input
283+ { ...conform . input ( channelValue ) }
284+ placeholder = "email@youremail.com"
285+ type = "email"
286+ autoFocus
287+ />
288+ < FormError id = { channelValue . errorId } > { channelValue . error } </ FormError >
289+ </ InputGroup >
290+ ) : (
291+ < Callout variant = "warning" >
292+ Email integration is not available. Please contact your organization
293+ administrator.
294+ </ Callout >
295+ )
284296 ) : currentAlertChannel === "SLACK" ? (
285297 < InputGroup fullWidth >
286298 { slack . status === "READY" ? (
0 commit comments