import { Todo, User, UserWithTodos } from '@homeman/models.ts' import { Signal, useSignal } from '@preact/signals' import { TodoList } from '@homeman/islands/TodoList.tsx' import { Dialog } from '@homeman/components/Dialog.tsx' import { Label } from '@homeman/components/Label.tsx' import { Input } from '@homeman/components/Input.tsx' import { Avatar } from '@homeman/components/Avatar.tsx' import { Button } from '@homeman/components/Button.tsx' import { JSX } from 'preact' interface Props { users: Record unassignedTodos: Todo[] } const unassignedUserPlaceholder: User = { id: '', createdAt: new Date(), name: 'Shared', avatarUrl: 'http://placekitten.com/512/512', color: '888888', } interface UserSelectButtonProps extends JSX.HTMLAttributes { user: User } function UserSelectButton( { user: { id, name, avatarUrl, color }, tabindex, ...props }: UserSelectButtonProps, ) { const eid = `assigneeUserId_${id}` return ( <> ) } export default function Dashboard({ users, unassignedTodos }: Props) { const todoAssignUserId: Signal = useSignal(null) const showAddTodoDialog = useSignal(false) const unassignedUser: UserWithTodos = { ...unassignedUserPlaceholder, assignedTodos: unassignedTodos, } return (
showAddTodoDialog.value = false} >
Assignee
  • {Object.values(users).map( (user) => { return (
  • ) }, )}

Todos

  • { console.log('shared new') showAddTodoDialog.value = true todoAssignUserId.value = null }} user={unassignedUser} />
  • {Object.values(users).map((u) => (
  • { showAddTodoDialog.value = true todoAssignUserId.value = u.id }} user={u} />
  • ))}
) }