Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { useCallback, useState } from 'react'
import { Loader2 } from 'lucide-react'
import { Button, Rocket, Tooltip } from '@/components/emcn'
import { cn } from '@/lib/utils'
import { DeployModal } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/components'
import { useCurrentWorkflow } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-current-workflow'
import type { WorkspaceUserPermissions } from '@/hooks/use-user-permissions'
Expand Down Expand Up @@ -101,40 +100,25 @@ export function Deploy({ activeWorkflowId, userPermissions, className }: DeployP
return 'Deploy workflow'
}

const buttonContent = (
<>
{isDeploying ? (
<Loader2 className='h-[13px] w-[13px] animate-spin' />
) : (
<Rocket className='h-[13px] w-[13px]' />
)}
{changeDetected ? 'Update' : isDeployed ? 'Active' : 'Deploy'}
</>
)

return (
<>
<Tooltip.Root>
<Tooltip.Trigger asChild>
{isDisabled ? (
<div
className={cn(
'inline-flex h-[32px] items-center justify-center gap-[8px] px-[10px]',
'rounded-md border border-input bg-background font-medium text-sm opacity-50',
'shadow-sm transition-colors'
)}
>
{buttonContent}
</div>
) : (
<span>
<Button
className='h-[32px] gap-[8px] px-[10px]'
variant='active'
onClick={onDeployClick}
disabled={isDisabled}
>
{buttonContent}
{isDeploying ? (
<Loader2 className='h-[13px] w-[13px] animate-spin' />
) : (
<Rocket className='h-[13px] w-[13px]' />
)}
{changeDetected ? 'Update' : isDeployed ? 'Active' : 'Deploy'}
</Button>
)}
</span>
</Tooltip.Trigger>
<Tooltip.Content>{getTooltipText()}</Tooltip.Content>
</Tooltip.Root>
Expand Down