Repository navigation
feat(ui): show project title in pane headers #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
20 changes: 20 additions & 0 deletions
20
apps/desktop/src/renderer/src/features/split/pane-title.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { formatPaneTitle } from './pane-title' | ||
|
|
||
| describe('formatPaneTitle', () => { | ||
| it('joins a project name and session title with a hyphen', () => { | ||
| expect(formatPaneTitle('New session', 'Ari')).toBe('Ari - New session') | ||
| }) | ||
|
|
||
| it('falls back to the session title when there is no project', () => { | ||
| expect(formatPaneTitle('Alpha', null)).toBe('Alpha') | ||
| expect(formatPaneTitle('Alpha', undefined)).toBe('Alpha') | ||
| expect(formatPaneTitle('Alpha', '')).toBe('Alpha') | ||
| }) | ||
|
|
||
| it('stays null while the session itself has no name yet', () => { | ||
| expect(formatPaneTitle(null, 'Ari')).toBe(null) | ||
| expect(formatPaneTitle(undefined, 'Ari')).toBe(null) | ||
| expect(formatPaneTitle('', 'Ari')).toBe(null) | ||
| }) | ||
| }) |
12 changes: 12 additions & 0 deletions
12
apps/desktop/src/renderer/src/features/split/pane-title.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /** | ||
| * The pane header's on-screen name: the session, prefixed with its project | ||
| * when one is known. Ad-hoc / unfiled sessions keep the session title alone. | ||
| */ | ||
| export function formatPaneTitle( | ||
| sessionTitle: string | null | undefined, | ||
| projectName: string | null | undefined, | ||
| ): string | null { | ||
| if (sessionTitle == null || sessionTitle === '') return null | ||
| if (projectName == null || projectName === '') return sessionTitle | ||
| return `${projectName} - ${sessionTitle}` | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Closed projects remain in pane titles
When a project is closed,
titleOfstill prefixes its sessions with that project's name. Closed projects remain inprojects, although their sessions are Unfiled.Learn more
A closed project stays in the project registry with
open: false. Its sessions are grouped under Unfiled by sidebarGroups, but this lookup matches every registry entry. The pane therefore retains a project prefix after the user closes that project.Example: Closing the “Docs” project moves “Draft notes” beneath Unfiled. Its pane still reads “Docs - Draft notes” instead of “Draft notes”.
Recommended fix: Restrict the name lookup to open projects, matching the sidebar's filing rule.
Was this helpful? React with 👍 or 👎 to provide feedback.