2024-07-25 01:38:11 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
|
|
|
|
import BoardViewModel from "../../ViewModel/Pages/boardViewModel";
|
2024-07-25 02:49:23 +02:00
|
|
|
import { FilteredList } from "../Components/filteredList";
|
2024-07-25 01:42:41 +02:00
|
|
|
import { PropertyValueList } from "../Components/propertyList";
|
2024-07-25 02:49:23 +02:00
|
|
|
import { TaskCategoryBulkChangeViewModel } from "../../ViewModel/Pages/taskPropertyBulkChangeViewModel";
|
2024-07-25 01:42:41 +02:00
|
|
|
import TaskViewModel from "../../ViewModel/Pages/taskViewModel";
|
2024-07-25 02:49:23 +02:00
|
|
|
import { TaskViewModelToEntry } from "../Components/taskEntry";
|
|
|
|
|
import { translations } from "../translations";
|
2024-07-25 01:38:11 +02:00
|
|
|
|
|
|
|
|
export function BoardKanbanPage(boardViewModel: BoardViewModel) {
|
2024-07-25 02:49:23 +02:00
|
|
|
const categoryNameConverter: React.StateItemConverter<string> = (
|
|
|
|
|
categoryName: string
|
|
|
|
|
) => {
|
|
|
|
|
return KanbanBoard(categoryName, boardViewModel);
|
|
|
|
|
};
|
|
|
|
|
|
2024-07-25 01:42:41 +02:00
|
|
|
return PropertyValueList(
|
|
|
|
|
"category",
|
|
|
|
|
(taskViewModel: TaskViewModel) => taskViewModel.task,
|
|
|
|
|
boardViewModel.taskViewModels,
|
2024-07-25 02:49:23 +02:00
|
|
|
(categories: React.ListState<string>) => {
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
class="kanban-board-wrapper"
|
|
|
|
|
children:append={[categories, categoryNameConverter]}
|
|
|
|
|
></div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function KanbanBoard(categoryName: string, boardViewModel: BoardViewModel) {
|
|
|
|
|
return FilteredList(
|
|
|
|
|
{ category: categoryName },
|
|
|
|
|
(taskViewModel: TaskViewModel) => taskViewModel.task,
|
|
|
|
|
boardViewModel.taskViewModels,
|
|
|
|
|
(taskViewModels: React.ListState<TaskViewModel>) => {
|
|
|
|
|
const viewModel: TaskCategoryBulkChangeViewModel =
|
|
|
|
|
new TaskCategoryBulkChangeViewModel(taskViewModels, categoryName);
|
|
|
|
|
|
|
|
|
|
return (
|
2024-07-25 04:12:30 +02:00
|
|
|
<div class="flex-column flex-no">
|
2024-07-25 02:49:23 +02:00
|
|
|
<div class="flex-row width-input">
|
|
|
|
|
<input
|
|
|
|
|
placeholder={
|
|
|
|
|
translations.chatPage.task.renameCategoryInputPlaceholder
|
|
|
|
|
}
|
|
|
|
|
bind:value={viewModel.inputValue}
|
|
|
|
|
on:enter={viewModel.set}
|
|
|
|
|
></input>
|
|
|
|
|
<button
|
|
|
|
|
class="primary"
|
|
|
|
|
on:click={viewModel.set}
|
|
|
|
|
toggle:disabled={viewModel.cannotSet}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">check</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr></hr>
|
|
|
|
|
|
|
|
|
|
<div
|
2024-07-25 04:12:30 +02:00
|
|
|
class="kanban-column"
|
2024-07-25 02:49:23 +02:00
|
|
|
children:append={[taskViewModels, TaskViewModelToEntry]}
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-07-25 01:42:41 +02:00
|
|
|
);
|
2024-07-25 01:38:11 +02:00
|
|
|
}
|