1- import { Box , Button , Dialog , Flex , IconButton , Tooltip } from '@radix-ui/themes'
1+ import { Box , Button , Dialog , Flex , IconButton , Text , TextArea , Tooltip } from '@radix-ui/themes'
22import { DEFAULT_BUTTON_STYLE , ICON_PROPS } from './ToolPanel'
33import { LuFileBox } from 'react-icons/lu'
44import { FormProvider , useForm } from 'react-hook-form'
55import LinkFormField from '@/components/common/LinkField/LinkFormField'
6- import { ErrorText } from '@/components/common/Form'
6+ import { ErrorText , Label } from '@/components/common/Form'
77import { useBoolean } from '@/hooks/useBoolean'
88import clsx from 'clsx'
99import { useFrappeCreateDoc } from 'frappe-react-sdk'
@@ -43,7 +43,8 @@ const DocumentLinkButton = ({ channelID }: { channelID: string }) => {
4343
4444interface DocumentLinkFormData {
4545 doctype : string
46- docname : string
46+ docname : string ,
47+ message : string
4748}
4849
4950const DocumentLinkForm = ( { channelID, onClose } : { channelID : string , onClose : ( ) => void } ) => {
@@ -71,6 +72,7 @@ const DocumentLinkForm = ({ channelID, onClose }: { channelID: string, onClose:
7172 createDoc ( 'Raven Message' , {
7273 message_type : 'Text' ,
7374 channel_id : channelID ,
75+ text : data . message ,
7476 link_doctype : data . doctype ,
7577 link_document : data . docname
7678 } as RavenMessage )
@@ -88,6 +90,7 @@ const DocumentLinkForm = ({ channelID, onClose }: { channelID: string, onClose:
8890 < FormProvider { ...methods } >
8991 < Stack gap = '2' >
9092 { error && < ErrorBanner error = { error } /> }
93+
9194 < Box width = '100%' >
9295 < Flex direction = 'column' gap = '2' >
9396 < LinkFormField
@@ -127,6 +130,13 @@ const DocumentLinkForm = ({ channelID, onClose }: { channelID: string, onClose:
127130 { doctype && docname && < DoctypeLinkRenderer doctype = { doctype } docname = { docname } /> }
128131 </ div >
129132
133+ < Box width = '100%' >
134+ < Flex direction = 'column' gap = '0' >
135+ < Label > Message < Text as = 'span' size = '1' color = 'gray' > (Optional)</ Text > </ Label >
136+ < TextArea { ...methods . register ( 'message' ) } placeholder = 'Enter a message to send with the document' />
137+ </ Flex >
138+ </ Box >
139+
130140 < Flex gap = "3" mt = "6" justify = "end" align = 'center' >
131141 < Dialog . Close disabled = { loading } >
132142 < Button variant = "soft" color = "gray" > Cancel</ Button >
0 commit comments