mirror of
https://github.com/documenso/documenso.git
synced 2025-11-19 03:01:59 +10:00
fix: add field drag drop colors
This commit is contained in:
@ -278,8 +278,20 @@ export const EnvelopeEditorFieldDragDrop = ({
|
||||
onMouseDown={() => setSelectedField(field.type)}
|
||||
data-selected={selectedField === field.type ? true : undefined}
|
||||
className={cn(
|
||||
'border-border group flex h-12 cursor-pointer items-center justify-center rounded-lg border px-4 transition-colors',
|
||||
'group flex h-12 cursor-pointer items-center justify-center rounded-lg border px-4 transition-colors',
|
||||
RECIPIENT_COLOR_STYLES[selectedRecipientColor].fieldButton,
|
||||
{
|
||||
'text-recipient-green border-recipient-green/30':
|
||||
selectedRecipientColor === 'green',
|
||||
'text-recipient-blue border-recipient-blue/30': selectedRecipientColor === 'blue',
|
||||
'text-recipient-purple border-recipient-purple/30':
|
||||
selectedRecipientColor === 'purple',
|
||||
'text-recipient-orange border-recipient-orange/30':
|
||||
selectedRecipientColor === 'orange',
|
||||
'text-recipient-yellow border-recipient-yellow/30':
|
||||
selectedRecipientColor === 'yellow',
|
||||
'text-recipient-pink border-recipient-pink/30': selectedRecipientColor === 'pink',
|
||||
},
|
||||
)}
|
||||
>
|
||||
<p
|
||||
@ -287,12 +299,12 @@ export const EnvelopeEditorFieldDragDrop = ({
|
||||
'text-muted-foreground font-noto group-data-[selected]:text-foreground flex items-center justify-center gap-x-1.5 text-sm font-normal',
|
||||
field.className,
|
||||
{
|
||||
'group-hover:text-recipient-green': selectedRecipientColor === 'green',
|
||||
'group-hover:text-recipient-blue': selectedRecipientColor === 'blue',
|
||||
'group-hover:text-recipient-purple': selectedRecipientColor === 'purple',
|
||||
'group-hover:text-recipient-orange': selectedRecipientColor === 'orange',
|
||||
'group-hover:text-recipient-yellow': selectedRecipientColor === 'yellow',
|
||||
'group-hover:text-recipient-pink': selectedRecipientColor === 'pink',
|
||||
'text-recipient-green': selectedRecipientColor === 'green',
|
||||
'text-recipient-blue': selectedRecipientColor === 'blue',
|
||||
'text-recipient-purple': selectedRecipientColor === 'purple',
|
||||
'text-recipient-orange': selectedRecipientColor === 'orange',
|
||||
'text-recipient-yellow': selectedRecipientColor === 'yellow',
|
||||
'text-recipient-pink': selectedRecipientColor === 'pink',
|
||||
},
|
||||
)}
|
||||
>
|
||||
|
||||
@ -106,6 +106,13 @@ export const EnvelopeEditorFieldsPage = () => {
|
||||
editorFields.setSelectedRecipient(firstSelectableRecipient?.id ?? null);
|
||||
}, []);
|
||||
|
||||
const canRecipientBeModified = useMemo(
|
||||
() =>
|
||||
editorFields.selectedRecipient !== null &&
|
||||
canRecipientFieldsBeModified(editorFields.selectedRecipient, envelope.fields),
|
||||
[editorFields.selectedRecipient, envelope.fields],
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="relative flex h-full">
|
||||
<div className="flex w-full flex-col overflow-y-auto">
|
||||
@ -175,32 +182,35 @@ export const EnvelopeEditorFieldsPage = () => {
|
||||
align="end"
|
||||
/>
|
||||
|
||||
{editorFields.selectedRecipient &&
|
||||
!canRecipientFieldsBeModified(editorFields.selectedRecipient, envelope.fields) && (
|
||||
<Alert className="mt-4" variant="warning">
|
||||
<AlertDescription>
|
||||
<Trans>
|
||||
This recipient can no longer be modified as they have signed a field, or
|
||||
completed the document.
|
||||
</Trans>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
{!canRecipientBeModified && (
|
||||
<Alert className="mt-4" variant="warning">
|
||||
<AlertDescription>
|
||||
<Trans>
|
||||
This recipient can no longer be modified as they have signed a field, or
|
||||
completed the document.
|
||||
</Trans>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<Separator className="my-4" />
|
||||
{canRecipientBeModified && (
|
||||
<>
|
||||
<Separator className="my-4" />
|
||||
|
||||
{/* Add fields section. */}
|
||||
<section className="px-4">
|
||||
<h3 className="text-foreground mb-2 text-sm font-semibold">
|
||||
<Trans>Add Fields</Trans>
|
||||
</h3>
|
||||
{/* Add fields section. */}
|
||||
<section className="px-4">
|
||||
<h3 className="text-foreground mb-2 text-sm font-semibold">
|
||||
<Trans>Add Fields</Trans>
|
||||
</h3>
|
||||
|
||||
<EnvelopeEditorFieldDragDrop
|
||||
selectedRecipientId={editorFields.selectedRecipient?.id ?? null}
|
||||
selectedEnvelopeItemId={currentEnvelopeItem?.id ?? null}
|
||||
/>
|
||||
</section>
|
||||
<EnvelopeEditorFieldDragDrop
|
||||
selectedRecipientId={editorFields.selectedRecipient?.id ?? null}
|
||||
selectedEnvelopeItemId={currentEnvelopeItem?.id ?? null}
|
||||
/>
|
||||
</section>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Field details section. */}
|
||||
<AnimateGenericFadeInOut key={editorFields.selectedField?.formId}>
|
||||
|
||||
Reference in New Issue
Block a user