mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
feat: implement bulk feature verification and enhance selection mode
- Added functionality for bulk verifying features in the BoardView, allowing users to mark multiple features as verified at once. - Introduced a selection target mechanism to differentiate between 'backlog' and 'waiting_approval' features during selection mode. - Updated the KanbanCard and SelectionActionBar components to support the new selection target logic, improving user experience for bulk actions. - Enhanced the UI to provide appropriate actions based on the current selection target, including verification options for waiting approval features.
This commit is contained in:
@@ -7,5 +7,5 @@ export { useBoardEffects } from './use-board-effects';
|
||||
export { useBoardBackground } from './use-board-background';
|
||||
export { useBoardPersistence } from './use-board-persistence';
|
||||
export { useFollowUpState } from './use-follow-up-state';
|
||||
export { useSelectionMode } from './use-selection-mode';
|
||||
export { useSelectionMode, type SelectionTarget } from './use-selection-mode';
|
||||
export { useListViewState } from './use-list-view-state';
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { useState, useCallback, useEffect } from 'react';
|
||||
|
||||
export type SelectionTarget = 'backlog' | 'waiting_approval' | null;
|
||||
|
||||
interface UseSelectionModeReturn {
|
||||
isSelectionMode: boolean;
|
||||
selectionTarget: SelectionTarget;
|
||||
selectedFeatureIds: Set<string>;
|
||||
selectedCount: number;
|
||||
toggleSelectionMode: () => void;
|
||||
toggleSelectionMode: (target?: SelectionTarget) => void;
|
||||
toggleFeatureSelection: (featureId: string) => void;
|
||||
selectAll: (featureIds: string[]) => void;
|
||||
clearSelection: () => void;
|
||||
@@ -13,21 +16,26 @@ interface UseSelectionModeReturn {
|
||||
}
|
||||
|
||||
export function useSelectionMode(): UseSelectionModeReturn {
|
||||
const [isSelectionMode, setIsSelectionMode] = useState(false);
|
||||
const [selectionTarget, setSelectionTarget] = useState<SelectionTarget>(null);
|
||||
const [selectedFeatureIds, setSelectedFeatureIds] = useState<Set<string>>(new Set());
|
||||
|
||||
const toggleSelectionMode = useCallback(() => {
|
||||
setIsSelectionMode((prev) => {
|
||||
if (prev) {
|
||||
const isSelectionMode = selectionTarget !== null;
|
||||
|
||||
const toggleSelectionMode = useCallback((target: SelectionTarget = 'backlog') => {
|
||||
setSelectionTarget((prev) => {
|
||||
if (prev === target) {
|
||||
// Exiting selection mode - clear selection
|
||||
setSelectedFeatureIds(new Set());
|
||||
return null;
|
||||
}
|
||||
return !prev;
|
||||
// Switching to a different target or entering selection mode
|
||||
setSelectedFeatureIds(new Set());
|
||||
return target;
|
||||
});
|
||||
}, []);
|
||||
|
||||
const exitSelectionMode = useCallback(() => {
|
||||
setIsSelectionMode(false);
|
||||
setSelectionTarget(null);
|
||||
setSelectedFeatureIds(new Set());
|
||||
}, []);
|
||||
|
||||
@@ -70,6 +78,7 @@ export function useSelectionMode(): UseSelectionModeReturn {
|
||||
|
||||
return {
|
||||
isSelectionMode,
|
||||
selectionTarget,
|
||||
selectedFeatureIds,
|
||||
selectedCount: selectedFeatureIds.size,
|
||||
toggleSelectionMode,
|
||||
|
||||
Reference in New Issue
Block a user