New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add more field types #1141
base: main
Are you sure you want to change the base?
Conversation
Important Review SkippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent updates introduce several new field types and functionalities across various components and modules. Key changes include adding Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
'pointer-events-none': passive, | ||
'pointer-events-none opacity-75': disabled, | ||
className={cn('group z-20', { | ||
'active:pointer-events-none': passive, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't think of a better way of making the hover work on passive
/disabled
fields. happy to hear suggestions
@@ -52,6 +66,89 @@ const DEFAULT_WIDTH_PERCENT = 15; | |||
const MIN_HEIGHT_PX = 60; | |||
const MIN_WIDTH_PX = 200; | |||
|
|||
/* | |||
I hate this, but due to TailwindCSS JIT, I couldnn't find a better way to do this for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what the comment says
const [currentField, setCurrentField] = useState<FieldFormType>(); | ||
const settingsRef = useRef<HTMLDivElement>(null); | ||
|
||
const recipientColorClasses = useMemo(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a better way to assign colors to recipients?
@@ -35,6 +138,9 @@ export const FieldItem = ({ | |||
onResize, | |||
onMove, | |||
onRemove, | |||
onAdvancedSettings, | |||
color, | |||
hideRecipients = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hideRecipients
was added to avoid showing an empty background on hover for the initials in SPM, which has no recipient.
})), | ||
); | ||
}); | ||
|
||
await tx.field.createMany({ | ||
// @ts-expect-error fix this later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
.with(FieldType.SIGNATURE, () => { | ||
const value = form.getValues('signature'); | ||
const value = form.getValues('customText'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed by mistake I think. revert.
|
||
const fieldMeta = fieldData?.fieldMeta; | ||
|
||
console.log('\n'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove these
}, | ||
); | ||
|
||
const fieldMeta = fieldData?.fieldMeta; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parse this with zod
@@ -0,0 +1,12 @@ | |||
import { z } from 'zod'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update whole file
Description
What I've done:
Moved the title and description (
DocumentFlowFormContainerHeader
) fromedit-template
page into each template step. For example,add-template-fields
,add-template-settings
, etc. have their own title and description. Exactly like it's done for the documents. Why did I do that? So, the header and description from "Field Advanced settings" doesn't collide with the info for each step.Create a new file for each new field (checkbox, number, dropdown, radio). Also updated the text field to include advanced settings.
Created an optional
fieldMeta
field of JSONB type in theField
model. This way, we can store advanced configuration for each field. Also, the selected/chosen/entered value for each field is stored in thecustomText
field.Added the
fieldMeta
field in the required schemas and types.Added the new fields in the
signing-page-view
so they are visible and usable.Added the fields in the document audit log.
Created tRPC procedures for retrieving and updating the
fieldMeta
property for a field.Modified the
getFieldById
function to retrieve a field based on the document or template id, depending on which one is passed to the function.Created the advanced settings panel that has various fields depending on the field. Each has different properties, with some of them overlapping.
Added colors for each recipient so it's easier to distinguish between them. The recipients and their associated fields will have the same color.
Updated the SPM to display the new fields.
.... plus other smaller things.
What's left:
Update the dropdown field to actually be a dropdown field.
Update the UI according to Goutham's design.
Make the new fields work in the SPM mode.
Cleanup the code.
Fix the TS error from
create-document-from-template
file, line 217Related Issue
Changes Made
Testing Performed
Checklist
Additional Notes