mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Standardize git status terminology to use 'New' for untracked files
- Web UI: Changed 'Added' to 'New' for untracked files - Mac UI: Changed 'Untracked' to 'New' and removed staged file display - Both UIs now consistently show: New (green +), Modified (yellow ~), Deleted (red -) - Focused on working directory changes, removed staging area counts - Backend: Changed untracked to added in git-status.ts for consistency
This commit is contained in:
parent
75dd51883b
commit
0812bfd89d
5 changed files with 29 additions and 42 deletions
|
|
@ -46,12 +46,12 @@ public struct GitRepository: Sendable, Equatable, Hashable {
|
||||||
|
|
||||||
/// Whether the repository has uncommitted changes
|
/// Whether the repository has uncommitted changes
|
||||||
public var hasChanges: Bool {
|
public var hasChanges: Bool {
|
||||||
modifiedCount > 0 || addedCount > 0 || deletedCount > 0 || untrackedCount > 0
|
modifiedCount > 0 || deletedCount > 0 || untrackedCount > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Total number of files with changes
|
/// Total number of files with changes
|
||||||
public var totalChangedFiles: Int {
|
public var totalChangedFiles: Int {
|
||||||
modifiedCount + addedCount + deletedCount + untrackedCount
|
modifiedCount + deletedCount + untrackedCount
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Folder name for display
|
/// Folder name for display
|
||||||
|
|
@ -66,18 +66,15 @@ public struct GitRepository: Sendable, Equatable, Hashable {
|
||||||
}
|
}
|
||||||
|
|
||||||
var parts: [String] = []
|
var parts: [String] = []
|
||||||
|
if untrackedCount > 0 {
|
||||||
|
parts.append("\(untrackedCount)N")
|
||||||
|
}
|
||||||
if modifiedCount > 0 {
|
if modifiedCount > 0 {
|
||||||
parts.append("\(modifiedCount)M")
|
parts.append("\(modifiedCount)M")
|
||||||
}
|
}
|
||||||
if addedCount > 0 {
|
|
||||||
parts.append("\(addedCount)A")
|
|
||||||
}
|
|
||||||
if deletedCount > 0 {
|
if deletedCount > 0 {
|
||||||
parts.append("\(deletedCount)D")
|
parts.append("\(deletedCount)D")
|
||||||
}
|
}
|
||||||
if untrackedCount > 0 {
|
|
||||||
parts.append("\(untrackedCount)U")
|
|
||||||
}
|
|
||||||
return parts.joined(separator: " ")
|
return parts.joined(separator: " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,12 @@ struct GitRepositoryRow: View {
|
||||||
.foregroundColor(AppColors.Fallback.gitModified(for: colorScheme))
|
.foregroundColor(AppColors.Fallback.gitModified(for: colorScheme))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if repository.addedCount > 0 {
|
if repository.untrackedCount > 0 {
|
||||||
HStack(spacing: 1) {
|
HStack(spacing: 1) {
|
||||||
Image(systemName: "plus")
|
Image(systemName: "plus")
|
||||||
.font(.system(size: 8, weight: .medium))
|
.font(.system(size: 8, weight: .medium))
|
||||||
.foregroundColor(AppColors.Fallback.gitAdded(for: colorScheme))
|
.foregroundColor(AppColors.Fallback.gitAdded(for: colorScheme))
|
||||||
Text("\(repository.addedCount)")
|
Text("\(repository.untrackedCount)")
|
||||||
.font(.system(size: 9, weight: .medium))
|
.font(.system(size: 9, weight: .medium))
|
||||||
.foregroundColor(AppColors.Fallback.gitAdded(for: colorScheme))
|
.foregroundColor(AppColors.Fallback.gitAdded(for: colorScheme))
|
||||||
}
|
}
|
||||||
|
|
@ -56,16 +56,6 @@ struct GitRepositoryRow: View {
|
||||||
.foregroundColor(AppColors.Fallback.gitDeleted(for: colorScheme))
|
.foregroundColor(AppColors.Fallback.gitDeleted(for: colorScheme))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if repository.untrackedCount > 0 {
|
|
||||||
HStack(spacing: 1) {
|
|
||||||
Image(systemName: "questionmark")
|
|
||||||
.font(.system(size: 8))
|
|
||||||
.foregroundColor(AppColors.Fallback.gitUntracked(for: colorScheme))
|
|
||||||
Text("\(repository.untrackedCount)")
|
|
||||||
.font(.system(size: 9, weight: .medium))
|
|
||||||
.foregroundColor(AppColors.Fallback.gitUntracked(for: colorScheme))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
* Git Status Badge Component
|
* Git Status Badge Component
|
||||||
*
|
*
|
||||||
* Displays git repository status information in a compact badge format.
|
* Displays git repository status information in a compact badge format.
|
||||||
* Shows counts for modified, untracked, staged files, and ahead/behind commits.
|
* Shows counts for added, modified, deleted files, and ahead/behind commits.
|
||||||
*/
|
*/
|
||||||
import { html, LitElement } from 'lit';
|
import { html, LitElement } from 'lit';
|
||||||
import { customElement, property } from 'lit/decorators.js';
|
import { customElement, property } from 'lit/decorators.js';
|
||||||
|
|
@ -46,8 +46,8 @@ export class GitStatusBadge extends LitElement {
|
||||||
|
|
||||||
const _hasLocalChanges =
|
const _hasLocalChanges =
|
||||||
(this.session?.gitModifiedCount ?? 0) > 0 ||
|
(this.session?.gitModifiedCount ?? 0) > 0 ||
|
||||||
(this.session?.gitUntrackedCount ?? 0) > 0 ||
|
(this.session?.gitAddedCount ?? 0) > 0 ||
|
||||||
(this.session?.gitStagedCount ?? 0) > 0;
|
(this.session?.gitDeletedCount ?? 0) > 0;
|
||||||
|
|
||||||
const _hasRemoteChanges =
|
const _hasRemoteChanges =
|
||||||
(this.session?.gitAheadCount ?? 0) > 0 || (this.session?.gitBehindCount ?? 0) > 0;
|
(this.session?.gitAheadCount ?? 0) > 0 || (this.session?.gitBehindCount ?? 0) > 0;
|
||||||
|
|
@ -79,10 +79,10 @@ export class GitStatusBadge extends LitElement {
|
||||||
private renderLocalChanges() {
|
private renderLocalChanges() {
|
||||||
if (!this.session) return null;
|
if (!this.session) return null;
|
||||||
|
|
||||||
|
const addedCount = this.session?.gitAddedCount ?? 0;
|
||||||
const modifiedCount = this.session?.gitModifiedCount ?? 0;
|
const modifiedCount = this.session?.gitModifiedCount ?? 0;
|
||||||
const untrackedCount = this.session?.gitUntrackedCount ?? 0;
|
const deletedCount = this.session?.gitDeletedCount ?? 0;
|
||||||
const stagedCount = this.session?.gitStagedCount ?? 0;
|
const totalChanges = addedCount + modifiedCount + deletedCount;
|
||||||
const totalChanges = modifiedCount + untrackedCount + stagedCount;
|
|
||||||
|
|
||||||
if (totalChanges === 0 && !this.detailed) return null;
|
if (totalChanges === 0 && !this.detailed) return null;
|
||||||
|
|
||||||
|
|
@ -91,10 +91,10 @@ export class GitStatusBadge extends LitElement {
|
||||||
return html`
|
return html`
|
||||||
<span class="flex items-center gap-1">
|
<span class="flex items-center gap-1">
|
||||||
${
|
${
|
||||||
stagedCount > 0
|
addedCount > 0
|
||||||
? html`
|
? html`
|
||||||
<span class="text-green-600 dark:text-green-400" title="Staged files">
|
<span class="text-green-600 dark:text-green-400" title="New files">
|
||||||
+${stagedCount}
|
+${addedCount}
|
||||||
</span>
|
</span>
|
||||||
`
|
`
|
||||||
: null
|
: null
|
||||||
|
|
@ -109,10 +109,10 @@ export class GitStatusBadge extends LitElement {
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
${
|
${
|
||||||
untrackedCount > 0
|
deletedCount > 0
|
||||||
? html`
|
? html`
|
||||||
<span class="text-blue-600 dark:text-blue-400" title="Untracked files">
|
<span class="text-red-600 dark:text-red-400" title="Deleted files">
|
||||||
?${untrackedCount}
|
-${deletedCount}
|
||||||
</span>
|
</span>
|
||||||
`
|
`
|
||||||
: null
|
: null
|
||||||
|
|
@ -122,7 +122,7 @@ export class GitStatusBadge extends LitElement {
|
||||||
} else {
|
} else {
|
||||||
// Compact view shows total with an indicator
|
// Compact view shows total with an indicator
|
||||||
return html`
|
return html`
|
||||||
<span class="text-yellow-600 dark:text-yellow-400" title="${modifiedCount} modified, ${untrackedCount} untracked, ${stagedCount} staged">
|
<span class="text-yellow-600 dark:text-yellow-400" title="${addedCount} new, ${modifiedCount} modified, ${deletedCount} deleted">
|
||||||
●${totalChanges}
|
●${totalChanges}
|
||||||
</span>
|
</span>
|
||||||
`;
|
`;
|
||||||
|
|
|
||||||
|
|
@ -243,8 +243,9 @@ export class GitWatcher {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
oldStatus.modified !== newStatus.modified ||
|
oldStatus.modified !== newStatus.modified ||
|
||||||
oldStatus.untracked !== newStatus.untracked ||
|
oldStatus.added !== newStatus.added ||
|
||||||
oldStatus.staged !== newStatus.staged ||
|
oldStatus.staged !== newStatus.staged ||
|
||||||
|
oldStatus.deleted !== newStatus.deleted ||
|
||||||
oldStatus.ahead !== newStatus.ahead ||
|
oldStatus.ahead !== newStatus.ahead ||
|
||||||
oldStatus.behind !== newStatus.behind
|
oldStatus.behind !== newStatus.behind
|
||||||
);
|
);
|
||||||
|
|
@ -268,8 +269,7 @@ export class GitWatcher {
|
||||||
type: 'git-status-update',
|
type: 'git-status-update',
|
||||||
sessionId,
|
sessionId,
|
||||||
gitModifiedCount: status.modified,
|
gitModifiedCount: status.modified,
|
||||||
gitUntrackedCount: status.untracked,
|
gitAddedCount: status.added,
|
||||||
gitStagedCount: status.staged,
|
|
||||||
gitDeletedCount: status.deleted,
|
gitDeletedCount: status.deleted,
|
||||||
gitAheadCount: status.ahead,
|
gitAheadCount: status.ahead,
|
||||||
gitBehindCount: status.behind,
|
gitBehindCount: status.behind,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ const execFileAsync = promisify(execFile);
|
||||||
|
|
||||||
export interface GitStatusCounts {
|
export interface GitStatusCounts {
|
||||||
modified: number;
|
modified: number;
|
||||||
untracked: number;
|
added: number;
|
||||||
staged: number;
|
staged: number;
|
||||||
deleted: number;
|
deleted: number;
|
||||||
ahead: number;
|
ahead: number;
|
||||||
|
|
@ -42,7 +42,7 @@ export async function getDetailedGitStatus(workingDir: string): Promise<GitStatu
|
||||||
let aheadCount = 0;
|
let aheadCount = 0;
|
||||||
let behindCount = 0;
|
let behindCount = 0;
|
||||||
let modifiedCount = 0;
|
let modifiedCount = 0;
|
||||||
let untrackedCount = 0;
|
let addedCount = 0;
|
||||||
let stagedCount = 0;
|
let stagedCount = 0;
|
||||||
let deletedCount = 0;
|
let deletedCount = 0;
|
||||||
|
|
||||||
|
|
@ -80,15 +80,15 @@ export async function getDetailedGitStatus(workingDir: string): Promise<GitStatu
|
||||||
deletedCount++;
|
deletedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Untracked files
|
// Added files (untracked)
|
||||||
if (indexStatus === '?' && workingStatus === '?') {
|
if (indexStatus === '?' && workingStatus === '?') {
|
||||||
untrackedCount++;
|
addedCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
modified: modifiedCount,
|
modified: modifiedCount,
|
||||||
untracked: untrackedCount,
|
added: addedCount,
|
||||||
staged: stagedCount,
|
staged: stagedCount,
|
||||||
deleted: deletedCount,
|
deleted: deletedCount,
|
||||||
ahead: aheadCount,
|
ahead: aheadCount,
|
||||||
|
|
@ -98,7 +98,7 @@ export async function getDetailedGitStatus(workingDir: string): Promise<GitStatu
|
||||||
// Not a git repository or git command failed
|
// Not a git repository or git command failed
|
||||||
return {
|
return {
|
||||||
modified: 0,
|
modified: 0,
|
||||||
untracked: 0,
|
added: 0,
|
||||||
staged: 0,
|
staged: 0,
|
||||||
deleted: 0,
|
deleted: 0,
|
||||||
ahead: 0,
|
ahead: 0,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue