mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
Created visual effect for disabled workflow block
This commit is contained in:
@@ -6,6 +6,7 @@ import { cn } from '@/lib/utils'
|
|||||||
import { ActionBar } from './components/action-bar/action-bar'
|
import { ActionBar } from './components/action-bar/action-bar'
|
||||||
import { ConnectionBlocks } from './components/connection-blocks/connection-blocks'
|
import { ConnectionBlocks } from './components/connection-blocks/connection-blocks'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
import { useWorkflowStore } from '@/stores/workflow/workflow-store'
|
||||||
|
|
||||||
interface WorkflowBlockProps {
|
interface WorkflowBlockProps {
|
||||||
id: string
|
id: string
|
||||||
@@ -26,6 +27,9 @@ export function WorkflowBlock({
|
|||||||
const { toolbar, workflow } = config
|
const { toolbar, workflow } = config
|
||||||
// Dragging connection state
|
// Dragging connection state
|
||||||
const [isConnecting, setIsConnecting] = useState(false)
|
const [isConnecting, setIsConnecting] = useState(false)
|
||||||
|
const isEnabled = useWorkflowStore(
|
||||||
|
(state) => state.blocks[id]?.enabled ?? true
|
||||||
|
)
|
||||||
|
|
||||||
function groupSubBlocks(subBlocks: SubBlockConfig[]) {
|
function groupSubBlocks(subBlocks: SubBlockConfig[]) {
|
||||||
const rows: SubBlockConfig[][] = []
|
const rows: SubBlockConfig[][] = []
|
||||||
@@ -54,7 +58,12 @@ export function WorkflowBlock({
|
|||||||
const subBlockRows = groupSubBlocks(workflow.subBlocks)
|
const subBlockRows = groupSubBlocks(workflow.subBlocks)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="w-[320px] shadow-md select-none group relative cursor-default">
|
<Card
|
||||||
|
className={cn(
|
||||||
|
'w-[320px] shadow-md select-none group relative cursor-default',
|
||||||
|
!isEnabled && 'shadow-sm'
|
||||||
|
)}
|
||||||
|
>
|
||||||
{selected && <ActionBar blockId={id} />}
|
{selected && <ActionBar blockId={id} />}
|
||||||
<ConnectionBlocks blockId={id} setIsConnecting={setIsConnecting} />
|
<ConnectionBlocks blockId={id} setIsConnecting={setIsConnecting} />
|
||||||
|
|
||||||
@@ -74,7 +83,7 @@ export function WorkflowBlock({
|
|||||||
<div className="flex items-center gap-3 p-3 border-b workflow-drag-handle cursor-grab [&:active]:cursor-grabbing">
|
<div className="flex items-center gap-3 p-3 border-b workflow-drag-handle cursor-grab [&:active]:cursor-grabbing">
|
||||||
<div
|
<div
|
||||||
className="flex items-center justify-center w-7 h-7 rounded"
|
className="flex items-center justify-center w-7 h-7 rounded"
|
||||||
style={{ backgroundColor: toolbar.bgColor }}
|
style={{ backgroundColor: isEnabled ? toolbar.bgColor : 'gray' }}
|
||||||
>
|
>
|
||||||
<toolbar.icon className="w-5 h-5 text-white" />
|
<toolbar.icon className="w-5 h-5 text-white" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user