From e97a9b9b3dd93cbe341fa7d9d204161775f196a1 Mon Sep 17 00:00:00 2001 From: Milo Schwartz Date: Sun, 5 Jan 2025 16:03:29 -0500 Subject: [PATCH] hide whitelist section if no email configured --- .../[resourceId]/authentication/page.tsx | 203 +++++++++--------- 1 file changed, 99 insertions(+), 104 deletions(-) diff --git a/src/app/[orgId]/settings/resources/[resourceId]/authentication/page.tsx b/src/app/[orgId]/settings/resources/[resourceId]/authentication/page.tsx index b563616f..c59806b5 100644 --- a/src/app/[orgId]/settings/resources/[resourceId]/authentication/page.tsx +++ b/src/app/[orgId]/settings/resources/[resourceId]/authentication/page.tsx @@ -637,111 +637,106 @@ export default function ResourceAuthenticationPage() { - - - - One-time Passwords - - - Require email-based authentication for resource - access - - - - {env.email.emailEnabled && ( - <> - + {env.email.emailEnabled && ( + + + + One-time Passwords + + + Require email-based authentication for resource + access + + + + - {whitelistEnabled && ( -
- - ( - - - Whitelisted Emails - - - {/* @ts-ignore */} - {/* @ts-ignore */} - { - return z - .string() - .email() - .safeParse( - tag - ) - .success; - }} - setActiveTagIndex={ - setActiveEmailTagIndex - } - placeholder="Enter an email" - tags={ - whitelistForm.getValues() - .emails - } - setTags={( - newRoles - ) => { - whitelistForm.setValue( - "emails", - newRoles as [ - Tag, - ...Tag[] - ] - ); - }} - allowDuplicates={ - false - } - sortTags={true} - styleClasses={{ - tag: { - body: "bg-muted hover:bg-accent text-foreground py-2 px-3 rounded-full" - }, - input: "text-base md:text-sm border-none bg-transparent text-inherit placeholder:text-inherit shadow-none", - inlineTagsContainer: - "bg-transparent p-2" - }} - /> - - - )} - /> - - - )} - - )} -
- - - -
+ {whitelistEnabled && ( +
+ + ( + + + Whitelisted Emails + + + {/* @ts-ignore */} + {/* @ts-ignore */} + { + return z + .string() + .email() + .safeParse( + tag + ).success; + }} + setActiveTagIndex={ + setActiveEmailTagIndex + } + placeholder="Enter an email" + tags={ + whitelistForm.getValues() + .emails + } + setTags={( + newRoles + ) => { + whitelistForm.setValue( + "emails", + newRoles as [ + Tag, + ...Tag[] + ] + ); + }} + allowDuplicates={ + false + } + sortTags={true} + styleClasses={{ + tag: { + body: "bg-muted hover:bg-accent text-foreground py-2 px-3 rounded-full" + }, + input: "text-base md:text-sm border-none bg-transparent text-inherit placeholder:text-inherit shadow-none", + inlineTagsContainer: + "bg-transparent p-2" + }} + /> + + + )} + /> + + + )} +
+ + + +
+ )} );