Repository navigation
feat(web): make sidebar sections the place you act on projects - #2
Merged
Merged
Conversation
Adding a project always started by asking which environment to add it to, even when the caller already knew. The sidebar is about to ask from an environment section header, where re-asking would be the palette ignoring where the click came from. The open detail and the palette's open intent carry an optional environmentId. When it is set, the flow skips straight to browsing sources in that environment; when it is absent the picker behaves exactly as before. The key is absent rather than undefined so the two cases stay distinguishable under exactOptionalPropertyTypes. Written by Claude Opus 5 in Claude Code.
The project selector was doing three unrelated jobs at once: it scoped the whole sidebar to one project, it was the only route to project settings, and it took a row of sidebar width to say the name of a project the list below already showed. Meanwhile the list itself could only show projects that happened to have threads, so a quiet project was unreachable and a finished one disappeared into a single Settled shelf shared by everything. The selector is gone. A project is a section, and the section header carries what you can do with it: - Project sections get New thread and Project settings. - Environment sections get New project, pointed at that environment. - Provider sections span projects and environments, so they get nothing rather than a guess. Actions read off the section's target rather than off its first thread, because sections now exist before they have threads: every known project seeds one. The collapse arrow is always the last item, so it stays a fixed landmark while hover-only actions come and go around it. It is a sibling button (a button inside a button is invalid) and stays out of the a11y tree, since the labelled header button already exposes the same action. Settled threads follow the same idea. Grouped by project, each section ends with its own Settled shelf, closed by default with a count and a Show more tail; the global shelf only renders when no section owns history, so nothing is ever listed twice. Expansion is component state on purpose: an archive is opened to answer one question, and restoring six unrolled histories on startup would bury the work. The default grouping becomes environment then project. The actions above live on section headers, so shipping with a flat list would ship a sidebar with nowhere to put them. Scoping goes away with the selector. It had no other entry point, so the state, the thread filter and the draft filter go with it. Mobile keeps its own project filter in its own navigation; this is the web and desktop sidebar only. Written by Claude Opus 5 in Claude Code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
O seletor de projetos fazia três trabalhos não relacionados ao mesmo tempo: escopava a sidebar inteira para um projeto, era o único caminho para as configurações do projeto, e gastava uma linha inteira de largura para dizer o nome de um projeto que a lista abaixo já mostrava.
E a lista só conseguia mostrar projetos que por acaso tinham threads. Projeto parado era inalcançável; projeto terminado sumia dentro de uma única prateleira Settled compartilhada por tudo.
O que muda
O seletor sai. Um projeto é uma seção, e o header da seção carrega o que dá para fazer com ela:
As ações leem o
targetda seção, não a primeira thread dela: seções agora existem antes de ter threads, já que todo projeto conhecido semeia uma. O projeto vazio é justamente o que mais precisa do botão de nova thread.O chevron é sempre o último item. Ele é o único controle que toda seção tem, então ancora a borda direita e não se mexe enquanto as ações de hover aparecem e somem em volta. É um botão irmão (button dentro de button é inválido) e fica fora da árvore de acessibilidade, porque o header rotulado ao lado já expõe a mesma ação.
Settled
Agrupado por projeto, cada seção termina com a própria prateleira Settled — fechada por padrão, com contagem e um rodapé Show more. A prateleira global só renderiza quando nenhuma seção é dona do histórico, então nada é listado duas vezes.
A expansão é estado de componente de propósito: um arquivo é aberto para responder uma pergunta, e restaurar seis históricos desenrolados na inicialização enterraria o trabalho.
Decisões que valem revisar
Verificação
sidebarThreadGrouping.test.ts: 29 testes (11 novos cobrindo sementes, ordenação com trabalho vivo antes de histórico antes de vazio, histórico por seção, paginação, aninhamento e projeto só-com-histórico).Sidebar.logic,Sidebar.snooze,CommandPalette.logic,ui/sidebar: 167 testes passando no total.tsc --noEmitlimpo emapps/webepackages/contracts; lint limpo nos arquivos tocados.Written by Claude Opus 5 in Claude Code.