import * as React from "bloatless-react"; import TaskViewModel from "../../ViewModel/Pages/taskViewModel"; export function TaskEntry(taskViewModel: TaskViewModel) { const details: { [icon: string]: string } = { description: taskViewModel.description.value || "---", priority_high: taskViewModel.priority.value || "---", category: taskViewModel.category.value || "---", clock_loader_40: taskViewModel.status.value || "---", calendar_month: taskViewModel.date.value || "---", schedule: taskViewModel.time.value || "---", }; const view = ( {...Object.entries(details).map((entry) => ( {entry[0]} {entry[1]} ))} ); taskViewModel.index.subscribe((newIndex) => { view.style.order = newIndex; }); return view; } export const TaskViewModelToEntry: React.StateItemConverter = ( taskViewModel: TaskViewModel ) => { return TaskEntry(taskViewModel); };