"use client" import Link from "next/link" import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import { z } from "zod" import { toast } from "@/hooks/use-toast" import { Button } from "@/components/ui/button" import { Checkbox } from "@/components/ui/checkbox" import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, } from "@/components/ui/form" import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" import { Switch } from "@/components/ui/switch" const notificationsFormSchema = z.object({ type: z.enum(["all", "mentions", "none"], { required_error: "You need to select a notification type.", }), mobile: z.boolean().default(false).optional(), communication_emails: z.boolean().default(false).optional(), social_emails: z.boolean().default(false).optional(), marketing_emails: z.boolean().default(false).optional(), security_emails: z.boolean(), }) type NotificationsFormValues = z.infer // This can come from your database or API. const defaultValues: Partial = { communication_emails: false, marketing_emails: false, social_emails: true, security_emails: true, } export function NotificationsForm() { const form = useForm({ resolver: zodResolver(notificationsFormSchema), defaultValues, }) function onSubmit(data: NotificationsFormValues) { toast({ title: "You submitted the following values:", description: (
          {JSON.stringify(data, null, 2)}
        
), }) } return (
( Notify me about... All new messages Direct messages and mentions Nothing )} />

Email Notifications

(
Communication emails Receive emails about your account activity.
)} /> (
Marketing emails Receive emails about new products, features, and more.
)} /> (
Social emails Receive emails for friend requests, follows, and more.
)} /> (
Security emails Receive emails about your account activity and security.
)} />
(
Use different settings for my mobile devices You can manage your mobile notifications in the{" "} mobile settings page.
)} /> ) }