refactor: simplify Create Flow dropdown, remove maintenance flow from UI
- Simplify CreateFlowDropdown to 2 clean items: Troubleshooting Flow and Procedural Flow (removed 4 AI-assist entries + 1 orphaned duplicate) - Rename "Troubleshooting Tree" → "Troubleshooting Flow" (per branding) - Remove Maintenance Flow option from MyTreesPage (hidden for pilot) - Replace MyTreesPage inline dropdown with shared CreateFlowDropdown - Remove unused aiEnabled prop, useCachedQuota import, showCreateMenu state Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate, Link } from 'react-router-dom'
|
||||
import { Play, Pencil, Share2, Trash2, GitBranch, Clock, TrendingUp, FolderTree, Plus, ListOrdered, ChevronDown, Wrench } from 'lucide-react'
|
||||
import { Play, Pencil, Share2, Trash2, GitBranch, Clock, TrendingUp } from 'lucide-react'
|
||||
import { PageMeta } from '@/components/common/PageMeta'
|
||||
import { StaggerList } from '@/components/common/StaggerList'
|
||||
import { Button } from '@/components/ui/Button'
|
||||
@@ -16,6 +16,7 @@ import { useAuthStore } from '@/store/authStore'
|
||||
import { usePermissions } from '@/hooks/usePermissions'
|
||||
import { toast } from '@/lib/toast'
|
||||
import { ForkModal } from '@/components/library/ForkModal'
|
||||
import { CreateFlowDropdown } from '@/components/common/CreateFlowDropdown'
|
||||
|
||||
interface TreeWithStats extends TreeListItem {
|
||||
lastUsed?: string
|
||||
@@ -35,7 +36,6 @@ export function MyTreesPage() {
|
||||
const [isDeleting, setIsDeleting] = useState(false)
|
||||
const [treeToShare, setTreeToShare] = useState<TreeWithStats | null>(null)
|
||||
const [showShareModal, setShowShareModal] = useState(false)
|
||||
const [showCreateMenu, setShowCreateMenu] = useState(false)
|
||||
const [forkTarget, setForkTarget] = useState<TreeWithStats | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
@@ -129,55 +129,7 @@ export function MyTreesPage() {
|
||||
</p>
|
||||
</div>
|
||||
{canCreateTrees && (
|
||||
<div className="relative">
|
||||
<Button
|
||||
onClick={() => setShowCreateMenu(!showCreateMenu)}
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
Create New
|
||||
<ChevronDown className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
{showCreateMenu && (
|
||||
<>
|
||||
<div className="fixed inset-0 z-10" onClick={() => setShowCreateMenu(false)} />
|
||||
<div className="absolute right-0 z-20 mt-1 w-56 rounded-lg border border-border bg-card p-1 shadow-xl">
|
||||
<Link
|
||||
to="/trees/new"
|
||||
onClick={() => setShowCreateMenu(false)}
|
||||
className="flex items-center gap-3 rounded-md px-3 py-2.5 text-sm text-foreground hover:bg-accent"
|
||||
>
|
||||
<FolderTree className="h-4 w-4 text-muted-foreground" />
|
||||
<div>
|
||||
<div className="font-medium">Troubleshooting Tree</div>
|
||||
<div className="text-xs text-muted-foreground">Branching decision flow</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link
|
||||
to="/flows/new"
|
||||
onClick={() => setShowCreateMenu(false)}
|
||||
className="flex items-center gap-3 rounded-md px-3 py-2.5 text-sm text-foreground hover:bg-accent"
|
||||
>
|
||||
<ListOrdered className="h-4 w-4 text-muted-foreground" />
|
||||
<div>
|
||||
<div className="font-medium">Procedural Flow</div>
|
||||
<div className="text-xs text-muted-foreground">Step-by-step procedure</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link
|
||||
to="/flows/new?type=maintenance"
|
||||
onClick={() => setShowCreateMenu(false)}
|
||||
className="flex items-center gap-3 rounded-md px-3 py-2.5 text-sm text-foreground hover:bg-accent"
|
||||
>
|
||||
<Wrench className="h-4 w-4 text-amber-400" />
|
||||
<div>
|
||||
<div className="font-medium">Maintenance Flow</div>
|
||||
<div className="text-xs text-muted-foreground">Scheduled multi-target tasks</div>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<CreateFlowDropdown label="Create New" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import { cn, safeGetItem } from '@/lib/utils'
|
||||
import { getSessionResumePath, getTreeNavigatePath } from '@/lib/routing'
|
||||
import { usePermissions } from '@/hooks/usePermissions'
|
||||
import { useUserPreferencesStore } from '@/store/userPreferencesStore'
|
||||
import { useCachedQuota } from '@/hooks/useCachedQuota'
|
||||
import { CreateFlowDropdown } from '@/components/common/CreateFlowDropdown'
|
||||
import { Spinner } from '@/components/common/Spinner'
|
||||
import { EmptyState } from '@/components/common/EmptyState'
|
||||
@@ -94,7 +93,6 @@ export function TreeLibraryPage() {
|
||||
|
||||
// AI builder state
|
||||
|
||||
const { aiEnabled } = useCachedQuota()
|
||||
|
||||
// Repeat Last Session
|
||||
const lastSessionData = (() => {
|
||||
@@ -311,11 +309,7 @@ export function TreeLibraryPage() {
|
||||
<FileUp className="h-4 w-4" />
|
||||
Import
|
||||
</Button>
|
||||
<CreateFlowDropdown
|
||||
aiEnabled={aiEnabled}
|
||||
|
||||
label="Create New"
|
||||
/>
|
||||
<CreateFlowDropdown label="Create New" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -512,7 +506,7 @@ export function TreeLibraryPage() {
|
||||
description="Flows guide your team through proven resolution paths, capturing every decision along the way."
|
||||
action={
|
||||
canCreateTrees ? (
|
||||
<CreateFlowDropdown aiEnabled={aiEnabled} label="Create a Flow" />
|
||||
<CreateFlowDropdown label="Create a Flow" />
|
||||
) : undefined
|
||||
}
|
||||
learnMoreLink="/guides/creating-flows"
|
||||
|
||||
Reference in New Issue
Block a user