mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
Reorganized state files
This commit is contained in:
@@ -9,13 +9,13 @@ import ReactFlow, {
|
|||||||
ConnectionLineType,
|
ConnectionLineType,
|
||||||
} from 'reactflow'
|
} from 'reactflow'
|
||||||
import { getBlock } from '../../../../../blocks'
|
import { getBlock } from '../../../../../blocks'
|
||||||
import { useWorkflowStore } from '@/stores/workflow/workflow-store'
|
import { useWorkflowStore } from '@/stores/workflow/store'
|
||||||
import { useNotificationStore } from '@/stores/notifications/notifications-store'
|
import { useNotificationStore } from '@/stores/notifications/store'
|
||||||
import { useWorkflowExecution } from '../../../hooks/use-workflow-execution'
|
import { useWorkflowExecution } from '../../../hooks/use-workflow-execution'
|
||||||
import { NotificationList } from '@/app/w/components/notifications/notifications'
|
import { NotificationList } from '@/app/w/components/notifications/notifications'
|
||||||
import { WorkflowNode } from '../workflow-node/workflow-node'
|
import { WorkflowNode } from '../workflow-node/workflow-node'
|
||||||
import { CustomEdge } from '../custom-edge/custom-edge'
|
import { CustomEdge } from '../custom-edge/custom-edge'
|
||||||
import { initializeStateLogger } from '@/stores/workflow/state-logger'
|
import { initializeStateLogger } from '@/stores/workflow/logger'
|
||||||
|
|
||||||
// Define custom node and edge types for ReactFlow
|
// Define custom node and edge types for ReactFlow
|
||||||
const nodeTypes: NodeTypes = { workflowBlock: WorkflowNode }
|
const nodeTypes: NodeTypes = { workflowBlock: WorkflowNode }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { ReactFlowProvider } from 'reactflow'
|
import { ReactFlowProvider } from 'reactflow'
|
||||||
import 'reactflow/dist/style.css'
|
import 'reactflow/dist/style.css'
|
||||||
import { useWorkflowRegistry } from '@/stores/workflow/workflow-registry'
|
import { useWorkflowRegistry } from '@/stores/workflow/registry'
|
||||||
import { useParams, useRouter } from 'next/navigation'
|
import { useParams, useRouter } from 'next/navigation'
|
||||||
import { WorkflowCanvas } from './components/workflow-canvas/workflow-canvas'
|
import { WorkflowCanvas } from './components/workflow-canvas/workflow-canvas'
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
NotificationType,
|
NotificationType,
|
||||||
NotificationStore,
|
NotificationStore,
|
||||||
} from '@/stores/notifications/types'
|
} from '@/stores/notifications/types'
|
||||||
import { useNotificationStore } from '@/stores/notifications/notifications-store'
|
import { useNotificationStore } from '@/stores/notifications/store'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { ErrorIcon } from '@/components/icons'
|
import { ErrorIcon } from '@/components/icons'
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import {
|
|||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from '@/components/ui/dropdown-menu'
|
} from '@/components/ui/dropdown-menu'
|
||||||
import { History, Bell, Play, Trash2 } from 'lucide-react'
|
import { History, Bell, Play, Trash2 } from 'lucide-react'
|
||||||
import { useNotificationStore } from '@/stores/notifications/notifications-store'
|
import { useNotificationStore } from '@/stores/notifications/store'
|
||||||
import { NotificationDropdownItem } from './components/notification-dropdown-item'
|
import { NotificationDropdownItem } from './components/notification-dropdown-item'
|
||||||
import { useWorkflowStore } from '@/stores/workflow/workflow-store'
|
import { useWorkflowStore } from '@/stores/workflow/store'
|
||||||
import { HistoryDropdownItem } from './components/history-dropdown-item'
|
import { HistoryDropdownItem } from './components/history-dropdown-item'
|
||||||
import { formatDistanceToNow } from 'date-fns'
|
import { formatDistanceToNow } from 'date-fns'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useWorkflowExecution } from '../../hooks/use-workflow-execution'
|
import { useWorkflowExecution } from '../../hooks/use-workflow-execution'
|
||||||
import { useWorkflowRegistry } from '@/stores/workflow/workflow-registry'
|
import { useWorkflowRegistry } from '@/stores/workflow/registry'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { AlertCircle, Terminal } from 'lucide-react'
|
import { AlertCircle, Terminal } from 'lucide-react'
|
||||||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
|
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
|
||||||
import { useNotificationStore } from '@/stores/notifications/notifications-store'
|
import { useNotificationStore } from '@/stores/notifications/store'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { ErrorIcon } from '@/components/icons'
|
import { ErrorIcon } from '@/components/icons'
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from '@/components/ui/tooltip'
|
} from '@/components/ui/tooltip'
|
||||||
import { AgentIcon } from '@/components/icons'
|
import { AgentIcon } from '@/components/icons'
|
||||||
import { useWorkflowRegistry } from '@/stores/workflow/workflow-registry'
|
import { useWorkflowRegistry } from '@/stores/workflow/registry'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
ArrowLeftRight,
|
ArrowLeftRight,
|
||||||
ArrowUpDown,
|
ArrowUpDown,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import { useWorkflowStore } from '@/stores/workflow/workflow-store'
|
import { useWorkflowStore } from '@/stores/workflow/store'
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
TooltipContent,
|
TooltipContent,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useWorkflowStore } from '@/stores/workflow/workflow-store'
|
import { useWorkflowStore } from '@/stores/workflow/store'
|
||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
|
|
||||||
export function useSubBlockValue(blockId: string, subBlockId: string) {
|
export function useSubBlockValue(blockId: string, subBlockId: string) {
|
||||||
|
|||||||
@@ -6,7 +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'
|
import { useWorkflowStore } from '@/stores/workflow/store'
|
||||||
import { Badge } from '@/components/ui/badge'
|
import { Badge } from '@/components/ui/badge'
|
||||||
|
|
||||||
interface WorkflowBlockProps {
|
interface WorkflowBlockProps {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useWorkflowStore } from '@/stores/workflow/workflow-store'
|
import { useWorkflowStore } from '@/stores/workflow/store'
|
||||||
import { shallow } from 'zustand/shallow'
|
import { shallow } from 'zustand/shallow'
|
||||||
|
|
||||||
export interface ConnectedBlock {
|
export interface ConnectedBlock {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useCallback, useState } from 'react'
|
import { useCallback, useState } from 'react'
|
||||||
import { useWorkflowStore } from '@/stores/workflow/workflow-store'
|
import { useWorkflowStore } from '@/stores/workflow/store'
|
||||||
import { Serializer } from '@/serializer'
|
import { Serializer } from '@/serializer'
|
||||||
import { Executor } from '@/executor'
|
import { Executor } from '@/executor'
|
||||||
import { ExecutionResult } from '@/executor/types'
|
import { ExecutionResult } from '@/executor/types'
|
||||||
import { useNotificationStore } from '@/stores/notifications/notifications-store'
|
import { useNotificationStore } from '@/stores/notifications/store'
|
||||||
import { useWorkflowRegistry } from '@/stores/workflow/workflow-registry'
|
import { useWorkflowRegistry } from '@/stores/workflow/registry'
|
||||||
|
|
||||||
export function useWorkflowExecution() {
|
export function useWorkflowExecution() {
|
||||||
const [isExecuting, setIsExecuting] = useState(false)
|
const [isExecuting, setIsExecuting] = useState(false)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useWorkflowStore } from './workflow-store'
|
import { useWorkflowStore } from './store'
|
||||||
|
|
||||||
export function initializeStateLogger() {
|
export function initializeStateLogger() {
|
||||||
useWorkflowStore.subscribe((state) => {
|
useWorkflowStore.subscribe((state) => {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { create } from 'zustand'
|
import { create } from 'zustand'
|
||||||
import { devtools } from 'zustand/middleware'
|
import { devtools } from 'zustand/middleware'
|
||||||
import { WorkflowRegistry, WorkflowMetadata } from './registry-types'
|
import { WorkflowRegistry, WorkflowMetadata } from './registry-types'
|
||||||
import { useWorkflowStore } from './workflow-store'
|
import { useWorkflowStore } from './store'
|
||||||
|
|
||||||
export const useWorkflowRegistry = create<WorkflowRegistry>()(
|
export const useWorkflowRegistry = create<WorkflowRegistry>()(
|
||||||
devtools(
|
devtools(
|
||||||
@@ -3,7 +3,7 @@ import { devtools } from 'zustand/middleware'
|
|||||||
import { Edge } from 'reactflow'
|
import { Edge } from 'reactflow'
|
||||||
import { Position, SubBlockState, WorkflowStore } from './types'
|
import { Position, SubBlockState, WorkflowStore } from './types'
|
||||||
import { getBlock } from '@/blocks'
|
import { getBlock } from '@/blocks'
|
||||||
import { withHistory, WorkflowStoreWithHistory, pushHistory } from './history-middleware'
|
import { withHistory, WorkflowStoreWithHistory, pushHistory } from './middleware'
|
||||||
import { resolveOutputType } from '@/blocks/utils'
|
import { resolveOutputType } from '@/blocks/utils'
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
Reference in New Issue
Block a user