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

View file

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

View file

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