refactor(store): split gatewayStore into specialized domain stores

Major restructuring:
- Split monolithic gatewayStore into 5 focused stores:
  - connectionStore: WebSocket connection and gateway lifecycle
  - configStore: quickConfig, workspaceInfo, MCP services
  - agentStore: clones, usage stats, agent management
  - handStore: hands, approvals, triggers, hand runs
  - workflowStore: workflows, workflow runs, execution

- Update all components to use new stores with selector pattern
- Remove
This commit is contained in:
iven
2026-03-20 22:14:13 +08:00
parent 6f72442531
commit 1cf3f585d3
43 changed files with 2826 additions and 3103 deletions

View File

@@ -8,11 +8,8 @@
*/
import { useState, useEffect, useCallback } from 'react';
import {
useGatewayStore,
type Approval,
type ApprovalStatus,
} from '../store/gatewayStore';
import { useHandStore } from '../store/handStore';
import type { Approval, ApprovalStatus } from '../store/handStore';
import {
CheckCircle,
XCircle,
@@ -297,8 +294,10 @@ function EmptyState({ filter }: { filter: FilterStatus }) {
// === Main ApprovalsPanel Component ===
export function ApprovalsPanel() {
const { approvals, loadApprovals, respondToApproval, isLoading } =
useGatewayStore();
const approvals = useHandStore((s) => s.approvals);
const loadApprovals = useHandStore((s) => s.loadApprovals);
const respondToApproval = useHandStore((s) => s.respondToApproval);
const isLoading = useHandStore((s) => s.isLoading);
const [filter, setFilter] = useState<FilterStatus>('all');
const [processingId, setProcessingId] = useState<string | null>(null);