refactor: improve conditional rendering on panel buttons (#5365)

add render condition on modal buttons
This commit is contained in:
Cristhian Zanforlin Lousa 2024-12-19 15:35:11 -03:00 • committed by GitHub
commit 435d86067c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 279 additions and 264 deletions

View file

@ -259,6 +259,7 @@ export default function IOModal({
<BaseModal.Trigger>{children}</BaseModal.Trigger>
{/* TODO ADAPT TO ALL TYPES OF INPUTS AND OUTPUTS */}
<BaseModal.Content overflowHidden className="h-full">
{open && (
<div className="flex-max-width h-full">
<div
className={cn(
@ -286,7 +287,9 @@ export default function IOModal({
/>
</Button>
</ShadTooltip>
{sidebarOpen && <div className="font-semibold">Playground</div>}
{sidebarOpen && (
<div className="font-semibold">Playground</div>
)}
</div>
{sidebarOpen && (
<div className="flex flex-col pl-3">
@ -370,8 +373,8 @@ export default function IOModal({
</button>
)}
{
nodes.find((node) => node.id === selectedViewField.id)?.data
.node.display_name
nodes.find((node) => node.id === selectedViewField.id)
?.data.node.display_name
}
</div>
<div className="h-full w-full">
@ -502,6 +505,7 @@ export default function IOModal({
</div>
</div>
</div>
)}
</BaseModal.Content>
</BaseModal>
);

View file

@ -54,6 +54,8 @@ export default function ApiModal({
/>
</BaseModal.Header>
<BaseModal.Content overflowHidden>
{open && (
<>
<CustomAPIGenerator isOpen={open} />
<CodeTabsComponent
open={open}
@ -63,6 +65,8 @@ export default function ApiModal({
activeTweaks={activeTweaks}
setActiveTweaks={setActiveTweaks}
/>
</>
)}
</BaseModal.Content>
</BaseModal>
);

View file

@ -221,6 +221,8 @@ export default function ShareModal({
/>
</BaseModal.Header>
<BaseModal.Content>
{open && (
<>
<div className="w-full rounded-lg border border-border p-4">
<EditFlowSettings name={name} description={description} />
</div>
@ -242,7 +244,10 @@ export default function ShareModal({
}}
data-testid="public-checkbox"
/>
<label htmlFor="public" className="export-modal-save-api text-sm">
<label
htmlFor="public"
className="export-modal-save-api text-sm"
>
Set {nameComponent} status to public
</label>
</div>
@ -250,6 +255,8 @@ export default function ShareModal({
<b>Attention:</b> API keys in specified fields are automatically
removed upon sharing.
</span>
</>
)}
</BaseModal.Content>
<BaseModal.Footer