feat(FN-1209): add quick entry image attachment flow
- Return the created task from board quick create and propagate the onQuickCreate return type through board/list components - Add pending image handling in QuickEntryBox with paste support, hidden file input, and an Attach action in the menu - Render removable pending image previews, include image count in the actions badge, and clean up object URLs on reset/unmount - Upload pending images after task creation with error toasts for failed uploads, and extend tests for attachment and quick-create behavior
This commit is contained in:
@@ -35,16 +35,18 @@ describe("useTaskHandlers", () => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it("handleBoardQuickCreate calls createTask with triage column", async () => {
|
||||
it("handleBoardQuickCreate calls createTask with triage column and returns task", async () => {
|
||||
const options = createOptions();
|
||||
const { result } = renderHook(() => useTaskHandlers(options));
|
||||
const input: TaskCreateInput = { description: "Do work" };
|
||||
|
||||
let created: Task | null = null;
|
||||
await act(async () => {
|
||||
await result.current.handleBoardQuickCreate(input);
|
||||
created = await result.current.handleBoardQuickCreate(input);
|
||||
});
|
||||
|
||||
expect(options.createTask).toHaveBeenCalledWith({ description: "Do work", column: "triage" });
|
||||
expect(created).toEqual(CREATED_TASK);
|
||||
});
|
||||
|
||||
it("handleModalCreate calls createTask with triage column and returns task", async () => {
|
||||
|
||||
@@ -11,7 +11,7 @@ interface UseTaskHandlersOptions {
|
||||
}
|
||||
|
||||
export interface UseTaskHandlersResult {
|
||||
handleBoardQuickCreate: (input: TaskCreateInput) => Promise<void>;
|
||||
handleBoardQuickCreate: (input: TaskCreateInput) => Promise<Task>;
|
||||
handleModalCreate: (input: TaskCreateInput) => Promise<Task>;
|
||||
handlePlanningTaskCreated: (task: Task) => void;
|
||||
handlePlanningTasksCreated: (tasks: Task[]) => void;
|
||||
@@ -29,8 +29,8 @@ export function useTaskHandlers(options: UseTaskHandlersOptions): UseTaskHandler
|
||||
} = options;
|
||||
|
||||
const handleBoardQuickCreate = useCallback(
|
||||
async (input: TaskCreateInput): Promise<void> => {
|
||||
await createTask({ ...input, column: "triage" });
|
||||
async (input: TaskCreateInput): Promise<Task> => {
|
||||
return createTask({ ...input, column: "triage" });
|
||||
},
|
||||
[createTask],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user