Skip to content

Commit 2bbbc47

Browse files
committed
feat: add comment fix
1 parent d2146a8 commit 2bbbc47

File tree

1 file changed

+58
-39
lines changed

1 file changed

+58
-39
lines changed

apps/frontend/src/components/new-launch/editor.tsx

Lines changed: 58 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,19 @@ export const EditorWrapper: FC<{
368368
dummy={dummy}
369369
selectedIntegration={selectedIntegration}
370370
chars={chars}
371+
childButton={
372+
<>
373+
{canEdit ? (
374+
<AddPostButton
375+
num={index}
376+
onClick={addValue(index)}
377+
postComment={postComment}
378+
/>
379+
) : (
380+
<div className="h-[25px]" />
381+
)}
382+
</>
383+
}
371384
/>
372385
</div>
373386
<div className="flex flex-col items-center gap-[10px]">
@@ -417,16 +430,6 @@ export const EditorWrapper: FC<{
417430
)}
418431
</div>
419432
</div>
420-
421-
{canEdit ? (
422-
<AddPostButton
423-
num={index}
424-
onClick={addValue(index)}
425-
postComment={postComment}
426-
/>
427-
) : (
428-
<div className="h-[25px]" />
429-
)}
430433
</div>
431434
))}
432435
</div>
@@ -450,6 +453,7 @@ export const Editor: FC<{
450453
selectedIntegration: SelectedIntegrations[];
451454
dummy: boolean;
452455
chars: Record<string, number>;
456+
childButton?: React.ReactNode;
453457
}> = (props) => {
454458
const {
455459
editorType = 'normal',
@@ -463,6 +467,7 @@ export const Editor: FC<{
463467
selectedIntegration,
464468
dummy,
465469
chars,
470+
childButton,
466471
} = props;
467472
const user = useUser();
468473
const [id] = useState(makeId(10));
@@ -524,7 +529,7 @@ export const Editor: FC<{
524529
);
525530

526531
return (
527-
<div>
532+
<div className="flex flex-col gap-[20px]">
528533
<div className="relative bg-bigStrip" id={id}>
529534
<div className="flex gap-[5px] bg-newBgLineColor border-b border-t border-customColor3 justify-center items-center p-[5px]">
530535
<SignatureBox editor={editorRef?.current?.editor} />
@@ -650,34 +655,48 @@ export const Editor: FC<{
650655
</div>
651656
</div>
652657
</div>
653-
<div className="absolute bottom-10px end-[25px]">
654-
{(props?.totalChars || 0) > 0 ? (
655-
<div
656-
className={clsx(
657-
'text-end text-sm mt-1',
658-
valueWithoutHtml.length > props.totalChars && '!text-red-500'
659-
)}
660-
>
661-
{valueWithoutHtml.length}/{props.totalChars}
662-
</div>
663-
) : (
664-
<div
665-
className={clsx(
666-
'text-end text-sm mt-1 grid grid-cols-[max-content_max-content] gap-x-[5px]'
667-
)}
668-
>
669-
{selectedIntegration?.map((p) => (
670-
<Fragment key={p.integration.id}>
671-
<div className={valueWithoutHtml.length > chars?.[p.integration.id] && '!text-red-500'}>
672-
{p.integration.name} ({capitalize(p.integration.identifier)}):
673-
</div>
674-
<div className={valueWithoutHtml.length > chars?.[p.integration.id] && '!text-red-500'}>
675-
{valueWithoutHtml.length}/{chars?.[p.integration.id]}
676-
</div>
677-
</Fragment>
678-
))}
679-
</div>
680-
)}
658+
<div className="flex">
659+
<div className="flex-1">{childButton}</div>
660+
<div className="bottom-10px end-[25px]">
661+
{(props?.totalChars || 0) > 0 ? (
662+
<div
663+
className={clsx(
664+
'text-end text-sm mt-1',
665+
valueWithoutHtml.length > props.totalChars && '!text-red-500'
666+
)}
667+
>
668+
{valueWithoutHtml.length}/{props.totalChars}
669+
</div>
670+
) : (
671+
<div
672+
className={clsx(
673+
'text-end text-sm mt-1 grid grid-cols-[max-content_max-content] gap-x-[5px]'
674+
)}
675+
>
676+
{selectedIntegration?.map((p) => (
677+
<Fragment key={p.integration.id}>
678+
<div
679+
className={
680+
valueWithoutHtml.length > chars?.[p.integration.id] &&
681+
'!text-red-500'
682+
}
683+
>
684+
{p.integration.name} ({capitalize(p.integration.identifier)}
685+
):
686+
</div>
687+
<div
688+
className={
689+
valueWithoutHtml.length > chars?.[p.integration.id] &&
690+
'!text-red-500'
691+
}
692+
>
693+
{valueWithoutHtml.length}/{chars?.[p.integration.id]}
694+
</div>
695+
</Fragment>
696+
))}
697+
</div>
698+
)}
699+
</div>
681700
</div>
682701
</div>
683702
);

0 commit comments

Comments
 (0)