diff --git a/src/components/wrappers/dashboard/database/alert-policy/alert-policy-form.tsx b/src/components/wrappers/dashboard/database/alert-policy/alert-policy-form.tsx index 4b5dc77a..573e7b1d 100644 --- a/src/components/wrappers/dashboard/database/alert-policy/alert-policy-form.tsx +++ b/src/components/wrappers/dashboard/database/alert-policy/alert-policy-form.tsx @@ -23,8 +23,8 @@ import {useRouter} from "next/navigation"; import {Switch} from "@/components/ui/switch"; import {getNotificationChannelIcon} from "@/components/wrappers/dashboard/admin/notifications/helpers"; import {Card} from "@/components/ui/card"; -import {cn} from "@/lib/utils"; import Link from "next/link"; +import {useIsMobile} from "@/hooks/use-mobile"; type AlertPolicyFormProps = { onSuccess?: () => void; @@ -35,6 +35,7 @@ type AlertPolicyFormProps = { export const AlertPolicyForm = ({database, notificationChannels, organizationId, onSuccess}: AlertPolicyFormProps) => { const router = useRouter() + const isMobile = useIsMobile() const organizationNotificationChannels = notificationChannels.map(channel => channel.id) ?? []; @@ -159,9 +160,11 @@ export const AlertPolicyForm = ({database, notificationChannels, organizationId,
-

- Choose which channels receive notifications for specific events. -

+ {!isMobile && ( +

+ Choose which channels receive notifications for specific events. +

+ )}
) : fields.length === 0 ? ( @@ -201,17 +206,17 @@ export const AlertPolicyForm = ({database, notificationChannels, organizationId, ) : (
{fields.map((field, index) => ( - +
-
-
+
+
{ + render={({ field }) => { const selectedIds = form .watch("alertPolicies") .map((a: AlertPolicyType) => a.notificationChannelId) @@ -226,36 +231,38 @@ export const AlertPolicyForm = ({database, notificationChannels, organizationId, const selectedChannel = notificationChannels.find(c => c.id === field.value); return ( - - - + - {selectedChannel ? ( -
-
+ {selectedChannel && ( +
+
{getNotificationChannelIcon(selectedChannel.provider)}
- {selectedChannel.name} - {selectedChannel.provider} + + {selectedChannel.name} + + + {selectedChannel.provider} +
- ) : "Select channel"} + )} - {availableNotificationChannels.map((channel) => ( - -
-
+ {availableNotificationChannels.map(channel => ( + +
+
{getNotificationChannelIcon(channel.provider)}
- {channel.name} - ({channel.provider}) + {channel.name} + + ({channel.provider}) +
))} @@ -267,63 +274,61 @@ export const AlertPolicyForm = ({database, notificationChannels, organizationId, }} />
- -
-