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