mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
Merge remote-tracking branch 'origin/main' into feat/extend-models-support
This commit is contained in:
@@ -20,16 +20,18 @@ import {
|
|||||||
Check,
|
Check,
|
||||||
BookOpen,
|
BookOpen,
|
||||||
GripVertical,
|
GripVertical,
|
||||||
RotateCw,
|
|
||||||
RotateCcw,
|
RotateCcw,
|
||||||
Trash2,
|
Trash2,
|
||||||
Undo2,
|
Undo2,
|
||||||
UserCircle,
|
UserCircle,
|
||||||
|
MoreVertical,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuSeparator,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -177,6 +179,7 @@ export function Sidebar() {
|
|||||||
reorderProjects,
|
reorderProjects,
|
||||||
cyclePrevProject,
|
cyclePrevProject,
|
||||||
cycleNextProject,
|
cycleNextProject,
|
||||||
|
clearProjectHistory,
|
||||||
} = useAppStore();
|
} = useAppStore();
|
||||||
|
|
||||||
// State for project picker dropdown
|
// State for project picker dropdown
|
||||||
@@ -777,32 +780,40 @@ export function Sidebar() {
|
|||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
|
||||||
{/* Project Cycle Buttons - only show when there's history */}
|
{/* Project History Menu - only show when there's history */}
|
||||||
{projectHistory.length > 1 && (
|
{projectHistory.length > 1 && (
|
||||||
<div className="hidden lg:flex items-center gap-1">
|
<DropdownMenu>
|
||||||
<button
|
<DropdownMenuTrigger asChild>
|
||||||
onClick={cyclePrevProject}
|
<button
|
||||||
className="flex items-center justify-center w-8 h-8 rounded-lg text-muted-foreground hover:text-foreground hover:bg-sidebar-accent/50 border border-sidebar-border transition-all titlebar-no-drag group relative"
|
className="hidden lg:flex items-center justify-center w-8 h-8 rounded-lg text-muted-foreground hover:text-foreground hover:bg-sidebar-accent/50 border border-sidebar-border transition-all titlebar-no-drag"
|
||||||
title={`Previous project (${ACTION_SHORTCUTS.cyclePrevProject})`}
|
title="Project history"
|
||||||
data-testid="cycle-prev-project"
|
data-testid="project-history-menu"
|
||||||
>
|
>
|
||||||
<RotateCcw className="w-4 h-4" />
|
<MoreVertical className="w-4 h-4" />
|
||||||
<span className="absolute -bottom-5 px-1 py-0.5 text-[9px] font-mono rounded bg-sidebar-accent/20 border border-sidebar-border text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity z-10">
|
</button>
|
||||||
{ACTION_SHORTCUTS.cyclePrevProject}
|
</DropdownMenuTrigger>
|
||||||
</span>
|
<DropdownMenuContent align="end" className="w-48">
|
||||||
</button>
|
<DropdownMenuItem onClick={cyclePrevProject} data-testid="cycle-prev-project">
|
||||||
<button
|
<Undo2 className="w-4 h-4 mr-2" />
|
||||||
onClick={cycleNextProject}
|
<span className="flex-1">Previous</span>
|
||||||
className="flex items-center justify-center w-8 h-8 rounded-lg text-muted-foreground hover:text-foreground hover:bg-sidebar-accent/50 border border-sidebar-border transition-all titlebar-no-drag group relative"
|
<span className="text-[10px] font-mono text-muted-foreground ml-2">
|
||||||
title={`Next project (${ACTION_SHORTCUTS.cycleNextProject})`}
|
{ACTION_SHORTCUTS.cyclePrevProject}
|
||||||
data-testid="cycle-next-project"
|
</span>
|
||||||
>
|
</DropdownMenuItem>
|
||||||
<RotateCw className="w-4 h-4" />
|
<DropdownMenuItem onClick={cycleNextProject} data-testid="cycle-next-project">
|
||||||
<span className="absolute -bottom-5 px-1 py-0.5 text-[9px] font-mono rounded bg-sidebar-accent/20 border border-sidebar-border text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity z-10">
|
<Redo2 className="w-4 h-4 mr-2" />
|
||||||
{ACTION_SHORTCUTS.cycleNextProject}
|
<span className="flex-1">Next</span>
|
||||||
</span>
|
<span className="text-[10px] font-mono text-muted-foreground ml-2">
|
||||||
</button>
|
{ACTION_SHORTCUTS.cycleNextProject}
|
||||||
</div>
|
</span>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
|
<DropdownMenuItem onClick={clearProjectHistory} data-testid="clear-project-history">
|
||||||
|
<RotateCcw className="w-4 h-4 mr-2" />
|
||||||
|
<span>Clear history</span>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ export interface AppActions {
|
|||||||
reorderProjects: (oldIndex: number, newIndex: number) => void;
|
reorderProjects: (oldIndex: number, newIndex: number) => void;
|
||||||
cyclePrevProject: () => void; // Cycle back through project history (Q)
|
cyclePrevProject: () => void; // Cycle back through project history (Q)
|
||||||
cycleNextProject: () => void; // Cycle forward through project history (E)
|
cycleNextProject: () => void; // Cycle forward through project history (E)
|
||||||
|
clearProjectHistory: () => void; // Clear history, keeping only current project
|
||||||
|
|
||||||
// View actions
|
// View actions
|
||||||
setCurrentView: (view: ViewMode) => void;
|
setCurrentView: (view: ViewMode) => void;
|
||||||
@@ -569,6 +570,23 @@ export const useAppStore = create<AppState & AppActions>()(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clearProjectHistory: () => {
|
||||||
|
const currentProject = get().currentProject;
|
||||||
|
if (currentProject) {
|
||||||
|
// Keep only the current project in history
|
||||||
|
set({
|
||||||
|
projectHistory: [currentProject.id],
|
||||||
|
projectHistoryIndex: 0,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// No current project, clear everything
|
||||||
|
set({
|
||||||
|
projectHistory: [],
|
||||||
|
projectHistoryIndex: -1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// View actions
|
// View actions
|
||||||
setCurrentView: (view) => set({ currentView: view }),
|
setCurrentView: (view) => set({ currentView: view }),
|
||||||
toggleSidebar: () => set({ sidebarOpen: !get().sidebarOpen }),
|
toggleSidebar: () => set({ sidebarOpen: !get().sidebarOpen }),
|
||||||
|
|||||||
Reference in New Issue
Block a user