Give the empty projects state a create-project action - #6231
Open
T0nyzz wants to merge 1 commit into
Open
Conversation
With zero projects, ProjectsView returned EmptyState directly, before the create menu and CreateProjectDialog ever mounted. There was no other entry point to project creation (the other create dialogs live behind a project detail screen you can't reach without one), so a fresh relay had no way to create its first project. EmptyState now takes a required onCreateProject callback and renders a "Create project" button. ProjectsView wires it to the same handler and dialog the pinned create menu uses, mounting CreateProjectDialog in the empty-state branch too so the button actually opens something. The prop is required, not optional — EmptyState has exactly one call site, so making it required turns a dropped wiring at that call site into a compile error instead of a silent regression. Co-authored-by: Tony Do <tony.do@ib.team> Signed-off-by: Tony Do <tony.do@ib.team>
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.
Problem
On a relay with no projects yet, there is no way to create your first project.
ProjectsViewreturnsEmptyStatefrom an early return atProjectsView.tsx:594:That happens before the create menu and
CreateProjectDialogare mounted (further down, around line 790), andEmptyStateitself renders only an icon and the text "No projects yet · Projects published to this relay will appear here." — no action.So the create control only appears once you already have a project.
There is no other entry point:
CreateProjectDialogis mounted solely inProjectsView, andAddProjectRepositoryDialog/AttachProjectRepositoryDialoglive inProjectRepositoryManagement, which is inside a project detail screen you cannot reach without an existing project.Reproduce: open Projects on a relay with zero projects. There is no create affordance anywhere.
Fix
EmptyStatenow takes a requiredonCreateProjectcallback and renders a Create project button.ProjectsViewwires it to the same handler and dialog the pinned create menu uses, and mountsCreateProjectDialogin the empty-state branch so the button opens something.The prop is required rather than optional deliberately.
EmptyStatehas exactly one call site, so making it required turns dropped wiring at that call site into a compile error instead of a silent regression — which is precisely the failure this PR is fixing.Testing
ProjectCards.test.mjs— new coverage asserting the empty state renders a create action and invokes the callbacktsc --noEmitcleanbiome checkclean on all three changed files