feat(frontend): fix duplicate publish button and improve BuilderActionButton styling

(#11669)

Fixes duplicate "Publish to Marketplace" buttons in the builder by
adding a `showTrigger` prop to control modal trigger visibility.

<img width="296" height="99" alt="Screenshot 2025-12-23 at 8 18 58 AM"
src="https://github.com/user-attachments/assets/d5dbfba8-e854-4c0c-a6b7-da47133ec815"
/>


### Changes 🏗️

**BuilderActionButton.tsx**

- Removed borders on hover and active states for a cleaner visual
appearance
- Added `hover:border-none` and `active:border-none` to maintain
consistent styling during interactions

**PublishToMarketplace.tsx**

- Pass `showTrigger={false}` to `PublishAgentModal` to hide the default
trigger button
- This prevents duplicate buttons when a custom trigger is already
rendered

**PublishAgentModal.tsx**

- Added `showTrigger` prop (defaults to `true`) to conditionally render
the modal trigger
- Allows parent components to control whether the built-in trigger
button should be displayed
- Maintains backward compatibility with existing usage

### Checklist 📋

#### For code changes:

- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
- [x] Verify only one "Publish to Marketplace" button appears in the
builder
- [x] Confirm button hover/active states display correctly without
border artifacts
- [x] Verify modal can still be triggered programmatically without the
trigger button
This commit is contained in:
Abhimanyu Yadav
2025-12-31 15:16:12 +05:30
committed by GitHub
parent 79d45a15d0
commit fba61c72ed
4 changed files with 10 additions and 5 deletions

View File

@@ -19,8 +19,8 @@ export const BuilderActionButton = ({
"border border-zinc-200",
"shadow-[inset_0_3px_0_0_rgba(255,255,255,0.5),0_2px_4px_0_rgba(0,0,0,0.2)]",
"dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.1),0_2px_4px_0_rgba(0,0,0,0.4)]",
"hover:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.5),0_1px_2px_0_rgba(0,0,0,0.2)]",
"active:shadow-[inset_0_2px_4px_0_rgba(0,0,0,0.2)]",
"hover:border-none hover:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.5),0_1px_2px_0_rgba(0,0,0,0.2)]",
"active:border-none active:shadow-[inset_0_2px_4px_0_rgba(0,0,0,0.2)]",
"transition-all duration-150",
"disabled:cursor-not-allowed disabled:opacity-50",
className,

View File

@@ -30,6 +30,7 @@ export const PublishToMarketplace = ({ flowID }: { flowID: string | null }) => {
targetState={publishState}
onStateChange={handleStateChange}
preSelectedAgentId={flowID || undefined}
showTrigger={false}
/>
</>
);

View File

@@ -20,6 +20,7 @@ export function PublishAgentModal({
onStateChange,
preSelectedAgentId,
preSelectedAgentVersion,
showTrigger = true,
}: Props) {
const {
// State
@@ -121,9 +122,11 @@ export function PublishAgentModal({
},
}}
>
<Dialog.Trigger>
{trigger || <Button size="small">Publish Agent</Button>}
</Dialog.Trigger>
{showTrigger && (
<Dialog.Trigger>
{trigger || <Button size="small">Publish Agent</Button>}
</Dialog.Trigger>
)}
<Dialog.Content>
<div data-testid="publish-agent-modal">{renderContent()}</div>
</Dialog.Content>

View File

@@ -30,6 +30,7 @@ export interface Props {
onStateChange?: (state: PublishState) => void;
preSelectedAgentId?: string;
preSelectedAgentVersion?: number;
showTrigger?: boolean;
}
export function usePublishAgentModal({