Apply path formatting to remaining frontend components

- Add formatPathForDisplay to session-create-form working directory input
- Add formatPathForDisplay to file-browser path display
- Users now see ~/Documents instead of /Users/username/Documents everywhere
- Maintains raw paths for editing and API calls, only formats for display
This commit is contained in:
Peter Steinberger 2025-06-28 14:37:14 +02:00
parent 039f27112e
commit 836db22a5e
2 changed files with 4 additions and 3 deletions

View file

@ -20,7 +20,7 @@ import {
UIIcons, UIIcons,
} from '../utils/file-icons.js'; } from '../utils/file-icons.js';
import { createLogger } from '../utils/logger.js'; import { createLogger } from '../utils/logger.js';
import { copyToClipboard } from '../utils/path-utils.js'; import { copyToClipboard, formatPathForDisplay } from '../utils/path-utils.js';
import type { Session } from './session-list.js'; import type { Session } from './session-list.js';
import './monaco-editor.js'; import './monaco-editor.js';
@ -562,7 +562,7 @@ export class FileBrowser extends LitElement {
} (click to edit)" } (click to edit)"
@click=${this.handlePathClick} @click=${this.handlePathClick}
> >
${this.currentFullPath || this.currentPath || 'File Browser'} ${formatPathForDisplay(this.currentFullPath || this.currentPath || 'File Browser')}
</div> </div>
` `
} }

View file

@ -16,6 +16,7 @@ import { customElement, property, state } from 'lit/decorators.js';
import './file-browser.js'; import './file-browser.js';
import type { AuthClient } from '../services/auth-client.js'; import type { AuthClient } from '../services/auth-client.js';
import { createLogger } from '../utils/logger.js'; import { createLogger } from '../utils/logger.js';
import { formatPathForDisplay } from '../utils/path-utils.js';
import type { Session } from './session-list.js'; import type { Session } from './session-list.js';
const logger = createLogger('session-create-form'); const logger = createLogger('session-create-form');
@ -389,7 +390,7 @@ export class SessionCreateForm extends LitElement {
<input <input
type="text" type="text"
class="input-field" class="input-field"
.value=${this.workingDir} .value=${formatPathForDisplay(this.workingDir)}
@input=${this.handleWorkingDirChange} @input=${this.handleWorkingDirChange}
placeholder="~/" placeholder="~/"
?disabled=${this.disabled || this.isCreating} ?disabled=${this.disabled || this.isCreating}