The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Profile details forms
Tim Wilsondd1ba6b5ec6e
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsxindex 2d33abb9dc..516add1a95 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx@@ -1,463 +1,45 @@"use client";-import { updatePartnerProfileAction } from "@/lib/actions/partners/update-partner-profile";-import usePartnerPayoutsCount from "@/lib/swr/use-partner-payouts-count";import usePartnerProfile from "@/lib/swr/use-partner-profile";-import { PartnerProps, PayoutsCount } from "@/lib/types";import { PageContent } from "@/ui/layout/page-content";import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";-import { useConfirmModal } from "@/ui/modals/confirm-modal";-import { CountryCombobox } from "@/ui/partners/country-combobox";import { useMergePartnerAccountsModal } from "@/ui/partners/merge-accounts/merge-partner-accounts-modal";-import { CustomToast } from "@/ui/shared/custom-toast";-import { AlertCircleFill } from "@/ui/shared/icons";-import {- Button,- buttonVariants,- DotsPattern,- DynamicTooltipWrapper,- FileUpload,- LoadingSpinner,- ToggleGroup,- useEnterSubmit,-} from "@dub/ui";-import { cn, OG_AVATAR_URL } from "@dub/utils";-import { PartnerProfileType } from "@prisma/client";-import { AnimatePresence, LayoutGroup, motion } from "framer-motion";-import { useAction } from "next-safe-action/hooks";-import { PropsWithChildren, RefObject, useRef } from "react";-import {- Controller,- FormProvider as FormContextProvider,- useForm,- useFormContext,-} from "react-hook-form";-import ReactTextareaAutosize from "react-textarea-autosize";-import { toast } from "sonner";+import { Button } from "@dub/ui";+import { ProfileDetailsForm } from "./profile-details-form";export function ProfileSettingsPageClient() {- const { partner, error } = usePartnerProfile();-- const formRef = useRef<HTMLFormElement>(null);+ const { partner } = usePartnerProfile();return (- <FormWrapper partner={partner}>- <PageContent- title="Profile info"- titleInfo={{- title:- "Build a stronger partner profile and increase trust by adding and verifying your website and social accounts.",- href: "https://dub.co/help/article/partner-profile",- }}- controls={<Controls formRef={formRef} />}- >- <PageWidthWrapper className="mb-20 flex flex-col gap-8">- <div className="relative m-1 mb-8">- <div- className="pointer-events-none absolute inset-0 rounded-2xl bg-neutral-100/50 [mask-image:linear-gradient(black,transparent_60%)]"- aria-hidden- >- <div className="absolute inset-4 overflow-hidden">- <div className="absolute inset-y-0 left-1/2 w-[1200px] -translate-x-1/2">- <DotsPattern className="text-neutral-200/80" />- </div>- </div>- </div>- <div className="relative mx-auto my-12 w-full max-w-[400px]">- {partner ? (- <ProfileForm partner={partner} formRef={formRef} />- ) : (- <div className="flex h-32 w-full items-center justify-center">- {error ? (- <span className="text-sm text-neutral-500">- Failed to load profile data- </span>- ) : (- <LoadingSpinner />- )}- </div>- )}- </div>- </div>- </PageWidthWrapper>- </PageContent>- </FormWrapper>- );-}--function FormWrapper({- partner,- children,-}: PropsWithChildren<{ partner?: PartnerProps }>) {- return partner ? (- <FormProvider partner={partner}>{children}</FormProvider>- ) : (- children+ <PageContent+ title="Profile"+ titleInfo={{+ title:+ "Build a stronger partner profile and increase trust by adding and verifying your website and social accounts.",+ href: "https://dub.co/help/article/partner-profile",+ }}+ controls={<Controls />}+ >+ <PageWidthWrapper className="mb-20 flex flex-col gap-6">+ <ProfileDetailsForm partner={partner} />+ </PageWidthWrapper>+ </PageContent>);}-type ProfileFormData = {- name: string;- email: string;- image: string | null;- description: string | null;- country: string;- profileType: PartnerProfileType;- companyName: string | null;-};--function FormProvider({- partner,- children,-}: PropsWithChildren<{ partner: PartnerProps }>) {- const form = useForm<ProfileFormData>({- defaultValues: {- name: partner.name,- email: partner.email ?? "",- image: partner.image,- description: partner.description ?? null,- country: partner.country ?? "",- profileType: partner.profileType ?? "individual",- companyName: partner.companyName ?? null,- },- });-- return <FormContextProvider {...form}>{children}</FormContextProvider>;-}--function Controls({ formRef }: { formRef: RefObject<HTMLFormElement> }) {- const { partner } = usePartnerProfile();-+function Controls() {const { MergePartnerAccountsModal, setShowMergePartnerAccountsModal } =useMergePartnerAccountsModal();- const {- formState: { isSubmitting, isDirty, dirtyFields },- } = useFormContext();-- const {- setShowConfirmModal: setShowStripeConfirmModal,- confirmModal: stripeConfirmModal,- } = useConfirmModal({- title: "Confirm profile update",- description:- "Updating your country or profile type will reset your Stripe account, which will require you to restart the payout connection process. Are you sure you want to continue?",- confirmText: "Continue",- onConfirm: () => {- formRef.current?.requestSubmit();- },- });-return (<><MergePartnerAccountsModal />- {stripeConfirmModal}<Buttontext="Merge accounts"variant="secondary"className="h-8 w-fit px-2.5"onClick={() => setShowMergePartnerAccountsModal(true)}/>- <Button- text="Save changes"- className="h-8 w-fit px-2.5"- loading={isSubmitting}- disabled={!isDirty}- onClick={() => {- if (- partner?.stripeConnectId &&- (dirtyFields.country ||- dirtyFields.profileType ||- dirtyFields.companyName)- ) {- setShowStripeConfirmModal(true);- } else {- formRef.current?.requestSubmit();- }- }}- /></>);}--function ProfileForm({- partner,- formRef,-}: {- partner: PartnerProps;- formRef: RefObject<HTMLFormElement>;-}) {- const {- register,- control,- handleSubmit,- setError,- watch,- setValue,- formState: { errors },- } = useFormContext<ProfileFormData>();-- const { profileType } = watch();-- const { payoutsCount } = usePartnerPayoutsCount<PayoutsCount[]>({- groupBy: "status",- });-- const completedPayoutsCount =- payoutsCount- ?.filter((payout) => ["sent", "completed"].includes(payout.status))- .reduce((acc, payout) => acc + payout.count, 0) ?? 0;-- const { handleKeyDown } = useEnterSubmit();-- const { executeAsync } = useAction(updatePartnerProfileAction, {- onSuccess: async ({ data }) => {- if (data?.needsEmailVerification) {- toast.success(- "Please check your email to verify your new email address.",- );- } else {- toast.success("Your profile has been updated.");- }- },- onError({ error }) {- setError("root.serverError", {- message: error.serverError,- });-- if (error.serverError?.includes("merge your partner accounts")) {- toast.custom(() => (- <CustomToast icon={AlertCircleFill}>- Email already in use. Do you want to [merge your partner- accounts](https://d.to/merge-partners) instead?- </CustomToast>- ));- } else {- toast.error(error.serverError);- }- },- });-- return (- <form- ref={formRef}- onSubmit={handleSubmit(async (data) => {- const imageChanged = data.image !== partner.image;-- await executeAsync({- ...data,- image: imageChanged ? data.image : null,- });- })}- >- <div className="px-5">- <div className="flex flex-col gap-6">- <label>- <div className="flex items-center gap-5">- <Controller- control={control}- name="image"- render={({ field }) => (- <FileUpload- accept="images"- className="size-20 shrink-0 rounded-full border border-neutral-300 sm:size-32"- iconClassName="w-5 h-5"- previewClassName="size-20 sm:size-32 rounded-full"- variant="plain"- imageSrc={field.value || `${OG_AVATAR_URL}${partner?.name}`}- readFile- onChange={({ src }) => field.onChange(src)}- content={null}- maxFileSizeMB={2}- targetResolution={{ width: 160, height: 160 }}- />- )}- />- <div>- <div- className={cn(- buttonVariants({ variant: "secondary" }),- "flex h-8 w-fit cursor-pointer items-center rounded-md border px-2.5 text-xs",- )}- >- Upload image- </div>- <p className="mt-1.5 text-xs text-neutral-500">- Recommended size: 160x160px- </p>- </div>- </div>- </label>- <label className="flex flex-col gap-1.5">- <span className="text-sm font-medium text-neutral-800">- Full name- </span>- <div>- <input- type="text"- className={cn(- "block w-full rounded-md focus:outline-none sm:text-sm",- errors.name- ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"- : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",- )}- placeholder="Brendon Urie"- {...register("name", {- required: true,- })}- />- </div>- </label>- <label className="flex flex-col gap-1.5">- <span className="text-sm font-medium text-neutral-800">Email</span>- <input- type="email"- className={cn(- "block w-full rounded-md focus:outline-none sm:text-sm",- errors.email- ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"- : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",- )}- placeholder="[email protected]"- {...register("email", {- required: true,- })}- />- </label>- <label className="flex flex-col">- <span className="text-sm font-medium text-neutral-800">- Country- </span>- <Controller- control={control}- name="country"- rules={{ required: true }}- render={({ field }) => (- <CountryCombobox- value={field.value || ""}- onChange={field.onChange}- error={errors.country ? true : false}- disabledTooltip={- completedPayoutsCount > 0- ? "Since you've already received payouts on Dub, you cannot change your country. If you need to update your country, please contact support."- : undefined- }- />- )}- />- </label>-- <label className="flex flex-col gap-1.5">- <span className="text-sm font-medium text-neutral-800">- About yourself- </span>- <div>- <ReactTextareaAutosize- className={cn(- "block w-full rounded-md focus:outline-none sm:text-sm",- errors.name- ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"- : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",- )}- placeholder="Tell us about the kind of content you create – e.g. tech, travel, fashion, etc."- minRows={3}- maxRows={10}- onKeyDown={handleKeyDown}- {...register("description")}- />- </div>- </label>-- <label className="flex flex-col gap-1.5">- <span className="text-sm font-medium text-neutral-800">- Profile type- </span>- <DynamicTooltipWrapper- tooltipProps={- completedPayoutsCount > 0- ? {- content:- "Since you've already received payouts on Dub, you cannot change your profile type. If you need to update your profile type, please contact support.",- }- : undefined- }- >- <LayoutGroup>- <div className="w-full">- <ToggleGroup- options={[- {- value: "individual",- label: "Individual",- },- {- value: "company",- label: "Company",- },- ]}- selected={profileType}- selectAction={(option: "individual" | "company") => {- if (completedPayoutsCount === 0) {- setValue("profileType", option);- }- }}- className={cn(- "flex w-full items-center gap-0.5 rounded-lg border-neutral-300 bg-neutral-100 p-0.5",- completedPayoutsCount > 0 && "cursor-not-allowed",- )}- optionClassName={cn(- "h-9 flex items-center justify-center rounded-lg flex-1",- completedPayoutsCount > 0 &&- "pointer-events-none text-neutral-400",- )}- indicatorClassName="bg-white"- />- </div>- </LayoutGroup>- </DynamicTooltipWrapper>- </label>-- <AnimatePresence mode="popLayout">- {profileType === "company" && (- <motion.div- layout- initial={{ opacity: 0, height: 0 }}- animate={{ opacity: 1, height: "auto" }}- exit={{ opacity: 0, height: 0 }}- transition={{- type: "spring",- stiffness: 300,- damping: 30,- opacity: { duration: 0.2 },- layout: { duration: 0.3, type: "spring" },- }}- className="contents"- >- <label className="flex flex-col gap-1.5">- <span className="text-sm font-medium text-neutral-800">- Legal company name- </span>- <div>- <input- type="text"- className={cn(- "block w-full rounded-md focus:outline-none sm:text-sm",- errors.companyName- ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"- : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",- )}- disabled={completedPayoutsCount > 0}- {...register("companyName", {- required: profileType === "company",- })}- />- </div>- </label>- </motion.div>- )}- </AnimatePresence>- </div>- </div>- </form>- );-}diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsxnew file mode 100644index 0000000000..8dc3e2ac4c--- /dev/null+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx@@ -0,0 +1,411 @@+import { updatePartnerProfileAction } from "@/lib/actions/partners/update-partner-profile";+import usePartnerPayoutsCount from "@/lib/swr/use-partner-payouts-count";+import { PartnerProps, PayoutsCount } from "@/lib/types";+import { useConfirmModal } from "@/ui/modals/confirm-modal";+import { CountryCombobox } from "@/ui/partners/country-combobox";+import {+ OnlinePresenceForm,+ useOnlinePresenceForm,+} from "@/ui/partners/online-presence-form";+import { CustomToast } from "@/ui/shared/custom-toast";+import { AlertCircleFill } from "@/ui/shared/icons";+import { PartnerProfileType } from "@dub/prisma/client";+import {+ Button,+ DynamicTooltipWrapper,+ FileUpload,+ ToggleGroup,+ buttonVariants,+} from "@dub/ui";+import { OG_AVATAR_URL, cn } from "@dub/utils";+import { AnimatePresence, LayoutGroup, motion } from "framer-motion";+import { useAction } from "next-safe-action/hooks";+import { RefObject, useEffect, useRef } from "react";+import { Controller, FormProvider, useForm } from "react-hook-form";+import { toast } from "sonner";+import { SettingsRow } from "./settings-row";++type ProfileDetailsFormData = {+ name: string;+ email: string;+ image: string | null;+ country: string;+ profileType: PartnerProfileType;+ companyName: string | null;+};++export function ProfileDetailsForm({ partner }: { partner?: PartnerProps }) {+ const basicInfoFormRef = useRef<HTMLFormElement>(null);+ const onlinePresenceFormRef = useRef<HTMLFormElement>(null);++ const basicInfoForm = useForm<ProfileDetailsFormData>();+ const onlinePresenceForm = useOnlinePresenceForm({ partner });++ const {+ setShowConfirmModal: setShowStripeConfirmModal,+ confirmModal: stripeConfirmModal,+ } = useConfirmModal({+ title: "Confirm profile update",+ description:+ "Updating your country or profile type will reset your Stripe account, which will require you to restart the payout connection process. Are you sure you want to continue?",+ confirmText: "Continue",+ onConfirm: () => {+ basicInfoFormRef.current?.requestSubmit();+ onlinePresenceFormRef.current?.requestSubmit();+ },+ });++ return (+ <div className="border-border-subtle divide-border-subtle flex flex-col divide-y rounded-lg border">+ {stripeConfirmModal}+ <div className="px-6 py-8">+ <h3 className="text-content-emphasis text-lg font-semibold leading-7">+ Profile details+ </h3>+ <p className="text-content-subtle text-sm font-normal leading-5">+ Basic details that make up your profile.+ </p>+ </div>++ <SettingsRow+ heading="Basic information"+ description="Your core details, and information that's required to set up your Dub Partner account."+ >+ <FormProvider {...basicInfoForm}>+ <BasicInfoForm partner={partner} formRef={basicInfoFormRef} />+ </FormProvider>+ </SettingsRow>++ <SettingsRow+ heading="Website and socials"+ description="Add your website and social accounts you use to share links. Verifying at least one helps build trust with programs."+ >+ <OnlinePresenceForm+ ref={onlinePresenceFormRef}+ partner={partner}+ form={onlinePresenceForm}+ variant="settings"+ />+ </SettingsRow>++ <div className="flex items-center justify-end rounded-b-lg border-t border-neutral-200 bg-neutral-50 px-6 py-4">+ <Button+ text="Save changes"+ className="h-8 w-fit px-2.5"+ loading={+ basicInfoForm.formState.isSubmitting ||+ onlinePresenceForm.formState.isSubmitting+ }+ onClick={() => {+ if (+ partner?.stripeConnectId &&+ (basicInfoForm.formState.dirtyFields.country ||+ basicInfoForm.formState.dirtyFields.profileType ||+ basicInfoForm.formState.dirtyFields.companyName)+ ) {+ setShowStripeConfirmModal(true);+ } else {+ basicInfoFormRef.current?.requestSubmit();+ onlinePresenceFormRef.current?.requestSubmit();+ }+ }}+ />+ </div>+ </div>+ );+}++function BasicInfoForm({+ partner,+ formRef,+}: {+ partner?: PartnerProps;+ formRef: RefObject<HTMLFormElement>;+}) {+ const {+ register,+ control,+ handleSubmit,+ setError,+ watch,+ setValue,+ getValues,+ reset,+ formState: { errors, isSubmitSuccessful },+ } = useForm<ProfileDetailsFormData>({+ defaultValues: {+ name: partner?.name,+ email: partner?.email ?? "",+ image: partner?.image,+ country: partner?.country ?? "",+ profileType: partner?.profileType ?? "individual",+ companyName: partner?.companyName ?? null,+ },+ });++ // Reset form dirty state after submit+ useEffect(() => {+ if (isSubmitSuccessful)+ reset(getValues(), { keepValues: true, keepDirty: false });+ }, [isSubmitSuccessful, reset, getValues]);++ const { profileType } = watch();++ const { payoutsCount } = usePartnerPayoutsCount<PayoutsCount[]>({+ groupBy: "status",+ });++ const completedPayoutsCount =+ payoutsCount+ ?.filter((payout) => ["sent", "completed"].includes(payout.status))+ .reduce((acc, payout) => acc + payout.count, 0) ?? 0;++ // const { handleKeyDown } = useEnterSubmit();++ const { executeAsync } = useAction(updatePartnerProfileAction, {+ onSuccess: async ({ data }) => {+ if (data?.needsEmailVerification) {+ toast.success(+ "Please check your email to verify your new email address.",+ );+ } else {+ toast.success("Your profile has been updated.");+ }+ },+ onError({ error }) {+ setError("root.serverError", {+ message: error.serverError,+ });++ if (error.serverError?.includes("merge your partner accounts")) {+ toast.custom(() => (+ <CustomToast icon={AlertCircleFill}>+ Email already in use. Do you want to [merge your partner+ accounts](https://d.to/merge-partners) instead?+ </CustomToast>+ ));+ } else {+ toast.error(error.serverError);+ }+ },+ });++ return (+ <form+ ref={formRef}+ onSubmit={handleSubmit(async (data) => {+ const imageChanged = data.image !== partner?.image;++ await executeAsync({+ ...data,+ image: imageChanged ? data.image : null,+ });+ })}+ >+ <div className="flex flex-col gap-6">+ <label>+ <div className="flex items-center gap-5">+ <Controller+ control={control}+ name="image"+ render={({ field }) => (+ <FileUpload+ accept="images"+ className="size-20 shrink-0 rounded-full border border-neutral-300 sm:size-32"+ iconClassName="w-5 h-5"+ previewClassName="size-20 sm:size-32 rounded-full"+ variant="plain"+ imageSrc={field.value || `${OG_AVATAR_URL}${partner?.name}`}+ readFile+ onChange={({ src }) => field.onChange(src)}+ content={null}+ maxFileSizeMB={2}+ targetResolution={{ width: 160, height: 160 }}+ />+ )}+ />+ <div>+ <div+ className={cn(+ buttonVariants({ variant: "secondary" }),+ "flex h-8 w-fit cursor-pointer items-center rounded-md border px-2.5 text-xs",+ )}+ >+ Upload image+ </div>+ <p className="mt-1.5 text-xs text-neutral-500">+ Recommended size: 160x160px+ </p>+ </div>+ </div>+ </label>+ <label className="flex flex-col gap-1.5">+ <span className="text-sm font-medium text-neutral-800">+ Full name+ </span>+ <div>+ <input+ type="text"+ className={cn(+ "block w-full rounded-md focus:outline-none sm:text-sm",+ errors.name+ ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"+ : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",+ )}+ placeholder="Brendon Urie"+ {...register("name", {+ required: true,+ })}+ />+ </div>+ </label>+ <label className="flex flex-col gap-1.5">+ <span className="text-sm font-medium text-neutral-800">Email</span>+ <input+ type="email"+ className={cn(+ "block w-full rounded-md focus:outline-none sm:text-sm",+ errors.email+ ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"+ : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",+ )}+ placeholder="[email protected]"+ {...register("email", {+ required: true,+ })}+ />+ </label>+ <label className="flex flex-col">+ <span className="text-sm font-medium text-neutral-800">Country</span>+ <Controller+ control={control}+ name="country"+ rules={{ required: true }}+ render={({ field }) => (+ <CountryCombobox+ value={field.value || ""}+ onChange={field.onChange}+ error={errors.country ? true : false}+ disabledTooltip={+ completedPayoutsCount > 0+ ? "Since you've already received payouts on Dub, you cannot change your country. If you need to update your country, please contact support."+ : undefined+ }+ />+ )}+ />+ </label>++ {/* <label className="flex flex-col gap-1.5">+ <span className="text-sm font-medium text-neutral-800">+ About yourself+ </span>+ <div>+ <ReactTextareaAutosize+ className={cn(+ "block w-full rounded-md focus:outline-none sm:text-sm",+ errors.name+ ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"+ : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",+ )}+ placeholder="Tell us about the kind of content you create – e.g. tech, travel, fashion, etc."+ minRows={3}+ maxRows={10}+ onKeyDown={handleKeyDown}+ {...register("description")}+ />+ </div>+ </label> */}++ <label className="flex flex-col gap-1.5">+ <span className="text-sm font-medium text-neutral-800">+ Profile type+ </span>+ <DynamicTooltipWrapper+ tooltipProps={+ completedPayoutsCount > 0+ ? {+ content:+ "Since you've already received payouts on Dub, you cannot change your profile type. If you need to update your profile type, please contact support.",+ }+ : undefined+ }+ >+ <LayoutGroup>+ <div className="w-full">+ <ToggleGroup+ options={[+ {+ value: "individual",+ label: "Individual",+ },+ {+ value: "company",+ label: "Company",+ },+ ]}+ selected={profileType}+ selectAction={(option: "individual" | "company") => {+ if (completedPayoutsCount === 0) {+ setValue("profileType", option);+ }+ }}+ className={cn(+ "flex w-full items-center gap-0.5 rounded-lg border-neutral-300 bg-neutral-100 p-0.5",+ completedPayoutsCount > 0 && "cursor-not-allowed",+ )}+ optionClassName={cn(+ "h-9 flex items-center justify-center rounded-lg flex-1",+ completedPayoutsCount > 0 &&+ "pointer-events-none text-neutral-400",+ )}+ indicatorClassName="bg-white"+ />+ </div>+ </LayoutGroup>+ </DynamicTooltipWrapper>+ </label>++ <AnimatePresence mode="popLayout">+ {profileType === "company" && (+ <motion.div+ layout+ initial={{ opacity: 0, height: 0 }}+ animate={{ opacity: 1, height: "auto" }}+ exit={{ opacity: 0, height: 0 }}+ transition={{+ type: "spring",+ stiffness: 300,+ damping: 30,+ opacity: { duration: 0.2 },+ layout: { duration: 0.3, type: "spring" },+ }}+ className="contents"+ >+ <label className="flex flex-col gap-1.5">+ <span className="text-sm font-medium text-neutral-800">+ Legal company name+ </span>+ <div>+ <input+ type="text"+ className={cn(+ "block w-full rounded-md focus:outline-none sm:text-sm",+ errors.companyName+ ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"+ : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",+ )}+ disabled={completedPayoutsCount > 0}+ {...register("companyName", {+ required: profileType === "company",+ })}+ />+ </div>+ </label>+ </motion.div>+ )}+ </AnimatePresence>+ </div>+ </form>+ );+}diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/settings-row.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/settings-row.tsxnew file mode 100644index 0000000000..b4f3e27dfc--- /dev/null+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/settings-row.tsx@@ -0,0 +1,23 @@+import { PropsWithChildren } from "react";++export function SettingsRow({+ heading,+ description,+ children,+}: PropsWithChildren<{+ heading: string;+ description: string;+}>) {+ return (+ <div className="@2xl/page:grid-cols-2 grid grid-cols-1 gap-10 px-6 py-8 lg:gap-16">+ <div className="flex flex-col gap-1">+ <h3 className="text-content-emphasis text-base font-semibold leading-none">+ {heading}+ </h3>+ <p className="text-content-subtle text-sm">{description}</p>+ </div>++ <div>{children}</div>+ </div>+ );+}diff --git a/apps/web/lib/actions/partners/update-partner-profile.ts b/apps/web/lib/actions/partners/update-partner-profile.tsindex 72087e4e9e..d10a50d0bb 100644--- a/apps/web/lib/actions/partners/update-partner-profile.ts+++ b/apps/web/lib/actions/partners/update-partner-profile.ts@@ -24,7 +24,7 @@ const updatePartnerProfileSchema = zname: z.string(),email: z.string().email(),image: uploadedImageSchema.nullish(),- description: z.string().nullable(),+ description: z.string().nullish(),country: z.enum(Object.keys(COUNTRIES) as [string, ...string[]]).nullable(),profileType: z.nativeEnum(PartnerProfileType),companyName: z.string().nullable(),diff --git a/apps/web/ui/partners/online-presence-form.tsx b/apps/web/ui/partners/online-presence-form.tsxindex e9e515ccec..cecf6377db 100644--- a/apps/web/ui/partners/online-presence-form.tsx+++ b/apps/web/ui/partners/online-presence-form.tsx@@ -178,7 +178,12 @@ export const OnlinePresenceForm = forwardRef<if (result?.data?.success) onSubmitSuccessful?.();})}>- <div className={cn("flex w-full flex-col gap-6 text-left")}>+ <div+ className={cn(+ "flex w-full flex-col gap-6 text-left",+ variant === "settings" && "gap-4",+ )}+ ><FormRowlabel="Website"property="website"@@ -225,6 +230,7 @@ export const OnlinePresenceForm = forwardRef<{...register("website")}/>}+ variant={variant}/><FormRow@@ -259,6 +265,7 @@ export const OnlinePresenceForm = forwardRef</></div>}+ variant={variant}/><FormRow@@ -289,6 +296,7 @@ export const OnlinePresenceForm = forwardRef</></div>}+ variant={variant}/><FormRow@@ -320,6 +328,7 @@ export const OnlinePresenceForm = forwardRef</></div>}+ variant={variant}/><FormRow@@ -351,6 +360,7 @@ export const OnlinePresenceForm = forwardRef</></div>}+ variant={variant}/><FormRow@@ -384,6 +394,7 @@ export const OnlinePresenceForm = forwardRef</></div>}+ variant={variant}/></div>@@ -525,6 +536,7 @@ function FormRow({icon: Icon,onVerifyClick,verifyDisabledTooltip,+ variant,}: {label: string;input: ReactNode;@@ -535,6 +547,7 @@ function FormRow({icon: Icon;onVerifyClick: () => Promise<boolean>;verifyDisabledTooltip?: string;+ variant: "onboarding" | "settings";}) {const { partner } = usePartnerProfile();const { control, setValue } = useFormContext<OnlinePresenceFormData>();@@ -566,7 +579,12 @@ function FormRow({<div className="p-0.5">{isVerified ? (<div className="flex flex-col gap-1.5">- <span className="text-content-emphasis text-sm font-medium">+ <span+ className={cn(+ "text-content-emphasis text-sm font-medium",+ variant === "settings" && "sr-only",+ )}+ >{label}</span><OnlinePresenceCard@@ -580,7 +598,12 @@ function FormRow({</div>) : (<label className={cn("flex flex-col gap-1.5")}>- <span className="text-content-emphasis text-sm font-medium">+ <span+ className={cn(+ "text-content-emphasis text-sm font-medium",+ variant === "settings" && "sr-only",+ )}+ >{label}</span><div className={cn("relative")}>