import { ViewController } from "../viewController"; import { TaskViewModelToEntry } from "../Components/taskEntry"; import { PropertyValueList, createPropertyValueIndexState, } from "../Components/propertyValueList"; import { FilteredList } from "../Components/filteredList"; import * as React from "../../react"; import { TaskCategoryBulkChangeViewModel } from "../../ViewModel/Utility/taskPropertyBulkChangeViewModel"; import TaskViewModel from "../../ViewModel/Pages/taskViewModel"; import BoardViewModel from "../../ViewModel/Pages/boardViewModel"; import CoreViewModel from "../../ViewModel/Global/coreViewModel"; export function BoardKanbanPage( coreViewModel: CoreViewModel, boardViewModel: BoardViewModel, ) { return PropertyValueList( "category", (taskViewModel: TaskViewModel) => taskViewModel.task, boardViewModel.filteredTaskViewModels, ( categories: React.ListState, sortedCategories: React.State, ) => { const categoryNameConverter: React.StateItemConverter = ( categoryName: string, ) => { const index: React.State = createPropertyValueIndexState( sortedCategories, categoryName, ); return Column( coreViewModel, categoryName, index, boardViewModel, ); }; return (
); }, ); } function Column( coreViewModel: CoreViewModel, categoryName: string, index: React.State, boardViewModel: BoardViewModel, ) { return FilteredList( { category: categoryName }, (taskViewModel: TaskViewModel) => taskViewModel.task, boardViewModel.filteredTaskViewModels, (taskViewModels: React.ListState) => { const viewModel: TaskCategoryBulkChangeViewModel = new TaskCategoryBulkChangeViewModel( taskViewModels, categoryName, ); function drop() { boardViewModel.handleDropWithinBoard(categoryName); } const view = (

); index.subscribe((newIndex) => { view.style.order = newIndex; }); return view; }, ); }