feat: dim node

This commit is contained in:
lyzno1
2025-10-30 15:33:32 +08:00
parent 8a48db6d0d
commit 4d37d61851
4 changed files with 57 additions and 3 deletions

View File

@ -1,10 +1,11 @@
import NodeStatus, { NodeStatusEnum } from '@/app/components/base/node-status'
import type { NodeProps } from '@/app/components/workflow/types'
import type { FC } from 'react'
import React, { useMemo } from 'react'
import React, { useEffect, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { InstallPluginButton } from '@/app/components/workflow/nodes/_base/components/install-plugin-button'
import { useNodePluginInstallation } from '@/app/components/workflow/hooks/use-node-plugin-installation'
import { useNodeDataUpdate } from '@/app/components/workflow/hooks/use-node-data-update'
import type { PluginTriggerNodeType } from './types'
import useConfig from './use-config'
@ -50,9 +51,22 @@ const Node: FC<NodeProps<PluginTriggerNodeType>> = ({
uniqueIdentifier,
canInstall,
onInstallSuccess,
shouldDim,
} = useNodePluginInstallation(data)
const { handleNodeDataUpdate } = useNodeDataUpdate()
const showInstallButton = !isChecking && isMissing && canInstall && uniqueIdentifier
useEffect(() => {
if (data._dimmed === shouldDim)
return
handleNodeDataUpdate({
id,
data: {
_dimmed: shouldDim,
},
})
}, [data._dimmed, handleNodeDataUpdate, id, shouldDim])
const { t } = useTranslation()
const isValidSubscription = useMemo(() => {