@@ -23,6 +23,7 @@ import { Label } from "~/components/primitives/Label";
23
23
import SegmentedControl from "~/components/primitives/SegmentedControl" ;
24
24
import { Select , SelectItem } from "~/components/primitives/Select" ;
25
25
import { InfoIconTooltip } from "~/components/primitives/Tooltip" ;
26
+ import { env } from "~/env.server" ;
26
27
import { useOrganization } from "~/hooks/useOrganizations" ;
27
28
import { useProject } from "~/hooks/useProject" ;
28
29
import { redirectWithSuccessMessage } from "~/models/message.server" ;
@@ -150,9 +151,13 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
150
151
const url = new URL ( request . url ) ;
151
152
const option = url . searchParams . get ( "option" ) ;
152
153
154
+ const emailAlertsEnabled =
155
+ env . ALERT_FROM_EMAIL !== undefined && env . ALERT_RESEND_API_KEY !== undefined ;
156
+
153
157
return typedjson ( {
154
158
...results ,
155
159
option : option === "slack" ? ( "SLACK" as const ) : undefined ,
160
+ emailAlertsEnabled,
156
161
} ) ;
157
162
}
158
163
@@ -200,7 +205,7 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
200
205
201
206
export default function Page ( ) {
202
207
const [ isOpen , setIsOpen ] = useState ( false ) ;
203
- const { slack, option } = useTypedLoaderData < typeof loader > ( ) ;
208
+ const { slack, option, emailAlertsEnabled } = useTypedLoaderData < typeof loader > ( ) ;
204
209
const lastSubmission = useActionData ( ) ;
205
210
const navigation = useNavigation ( ) ;
206
211
const navigate = useNavigate ( ) ;
@@ -271,16 +276,23 @@ export default function Page() {
271
276
</ InputGroup >
272
277
273
278
{ 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
+ )
284
296
) : currentAlertChannel === "SLACK" ? (
285
297
< InputGroup fullWidth >
286
298
{ slack . status === "READY" ? (
0 commit comments