import { Todo, UserWithTodos } from '@homeman/models.ts' import { Button } from '@homeman/components/Button.tsx' import { Dialog } from '@homeman/components/Dialog.tsx' import { createRef } from 'preact' export interface Props { user: UserWithTodos } export function TodoList( { user: { avatarUrl, assignedTodos, name, color } }: Props, ) { const addTodoDialog = createRef() const todoItem = ( { className, description, hideDone }: Pick & { className?: string hideDone?: boolean }, ) => (
  • {description} {hideDone ? '' : }
  • ) return (
    sup {name}
      {assignedTodos.length < 1 ? todoItem({ description: 'All clear! 🎉', className: 'text-center', hideDone: true, }) : assignedTodos.map(todoItem)}
    ) }