{#if !currentUser}
{ currentUser = s; view = "home"; }} />
{:else}
{ view = v; }} />
{#if view === "home"}
$ // home — @{currentUser.handle} → {userPosts.length} posts · polling every 5s
{#if timelineError}
err: {timelineError}
{/if} {#if timelineLoading && userPosts.length === 0} {:else if userPosts.length === 0}
// timeline is empty. compose your first post →
{:else} {#if threadRoot}
// thread
{#if threadLoading} {:else if threadError}
err: {threadError}
{:else if threadRoot} {#if threadParent && threadParent.uri !== threadRoot.uri}
{/if} {/if}
{/if} {#each userPosts as p (p.uri)} {/each} {#if timelineCursor}
{/if} {/if} {:else if view === "compose"}
$ // compose — @{currentUser.handle} ⌘↵ to post
{:else if view === "profile"}
$ // profile — @{currentUser.handle}
{#if profileLoading && !profile} {:else if profileError}
err: {profileError}
{:else if profile}
{displayHandle(profile.handle)} {profile.did}
followers
{profile.followers}
following
{profile.following}
posts
{profile.posts.length}
{#if profile.posts.length === 0}
// no posts yet
{:else} {#each profile.posts as p (p.uri)} {/each} {/if}
{/if} {:else if view === "search"}
$ // search
{#if searchError}
err: {searchError}
{/if} {#if searchLoading} {:else if searchQuery.trim().length === 0}
// type to search…
{:else if searchResults.length === 0}
// no posts match "{searchQuery}"
{:else}
{searchResults.length} result{searchResults.length === 1 ? "" : "s"} for "{searchQuery}"
{#each searchResults as p (p.uri)} {/each} {/if} {/if}
{#if toasts.length > 0}
{#each toasts as t (t.id)} {/each}
{/if} {/if}