{#if project}
{#if editing} rename(e.currentTarget)} onkeydown={(e) => { if (e.key === 'Enter') e.currentTarget.blur(); if (e.key === 'Escape') { e.currentTarget.value = project.name; editing = false; } }} /> {:else}

{#if isOwner} {:else} {projectName(project)} {/if}

{/if}
{#each [['list', t('view.list')], ['board', t('view.board')], ['calendar', t('view.calendar')]] as [value, label]} {/each}
{#if showMenu} {/if}
{#if showTidy} api.aiTidyInbox()} apply={(row, line) => api.aiApplyToTask(row.task_id, line)} onclose={() => (showTidy = false)} /> {/if} {#if showLog}
    {#each activity as entry (entry.id)}
  • {entry.user_name || t('history.deletedAccount')} {eventName(entry.event)}{#if eventDetail(entry)}{' '}{eventDetail(entry)}{/if} {when(entry.created_at)}
  • {/each}
{#if !activity.length}

{t('project.noHistory')}

{/if}
{/if} {#if choosingColor}
{#each COLORS as color (color.id)} {/each}
{/if} {#if showShare}
    {#each members as member (member.user_id)}
  • {member.name[0]?.toUpperCase()} {member.name} {#if isOwner && member.role !== 'owner'} {:else} {ROLES[member.role] ?? member.role} {/if} {#if isOwner && member.role !== 'owner'} {/if}
  • {/each}
{#if pending.length}
    {#each pending as invite (invite.id)}
  • @ {invite.email} {t('project.invited')} {#if isOwner} {/if}
  • {/each}
{/if} {#if !isOwner} {/if} {#if isOwner} {#if candidates.length}
{/if}

{t('project.orByEmail')}

{#if inviteLink} {/if} {#if inviteError}

{inviteError}

{/if} {/if}
{/if} {#if canEdit} {/if} {#if mode === 'board'} (sections = [...sections, section])} /> {:else if mode === 'calendar'}
{#each [['week', t('view.week')], ['month', t('view.month')]] as [value, label]} {/each}
{:else}
onSectionDragOver(e, '')} ondragleave={() => (overSection = null)} ondrop={(e) => onSectionDrop(e, '')} > {#if sections.length && !unsectioned.length}

{t('project.noSection')}

{/if}
{#each sections as section (section.id)} {@const tasks = open.filter((t) => t.section_id === section.id)}
onSectionDragOver(e, section.id)} ondragleave={() => (overSection = null)} ondrop={(e) => onSectionDrop(e, section.id)} >
onSectionDragStart(e, section)} ondragend={clearSectionDrag} ondragover={(e) => onHeadDragOver(e, section)} ondragleave={() => (overSectionEdge = null)} ondrop={(e) => onHeadDrop(e, section)} > {#if renamingSection === section.id}
renameSection(e, section)}> (renamingSection = null)} onkeydown={(e) => e.key === 'Escape' && (renamingSection = null)} />
{:else}

{section.name}

{#if canEdit} {/if} {/if}
{#if !tasks.length}

{t('view.emptySection')}

{/if} {#if canEdit} {#if addingIn === section.id}
addToSection(e, section.id)}> !newInSection.trim() && (addingIn = null)} onkeydown={(e) => e.key === 'Escape' && (addingIn = null)} />
{:else} {/if} {/if}
{/each} {#if completedView.shown && done.length}

{t('view.done')}

{#each done as task (task.id)} {/each}
{/if} {#if canEdit}
{#if addingSection}
!sectionName.trim() && (addingSection = false)} onkeydown={(e) => e.key === 'Escape' && (addingSection = false)} />
{:else} {/if}
{/if} {#if !open.length && !sections.length}

{t('project.nothingHere')}

{/if} {/if} {#if project.role === 'viewer'}

{t('project.readOnly')}

{/if} {#if notes.length || canEdit}

{t('notes.title')}

{#if canEdit} {/if}
{#if !notes.length}

{t('notes.noneInProject')}

{/if}
{/if} {:else if status === 'loading'}
{:else if status === 'denied'}

{t('project.notFound')}

{:else}

{t('project.loadFailed')}

{/if}