Files
claudecodeui/src/components/git-panel/constants/constants.ts
Simos Mikelatos adb3a06d7e feat: git panel redesign (#535)
* feat(git-panel): add Branches tab, Fetch always visible, inline error banners

- Add dedicated Branches tab (local/remote sections, switch with confirmation, delete branch, create branch)
- Rename History tab to Commits; add change-count badge on Changes tab
- Fetch button always visible when remote exists (not only when both ahead & behind)
- Inline error banner below header for failed push/pull/fetch, with dismiss button
- Server: /api/git/branches now returns localBranches + remoteBranches separately
- Server: add /api/git/delete-branch endpoint (prevents deleting current branch)
- Controller: expose operationError, clearOperationError, deleteBranch, localBranches, remoteBranches
- Constants: add deleteBranch to all ConfirmActionType record maps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: git log datetime

* feat(git-panel): add staged/unstaged sections and enhanced commit details

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Haile <118998054+blackmammoth@users.noreply.github.com>
2026-03-13 17:38:53 +03:00

81 lines
2.9 KiB
TypeScript

import type { ConfirmActionType, FileStatusCode, GitStatusGroupEntry } from '../types/types';
export const DEFAULT_BRANCH = 'main';
export const RECENT_COMMITS_LIMIT = 10;
export const FILE_STATUS_GROUPS: GitStatusGroupEntry[] = [
{ key: 'modified', status: 'M' },
{ key: 'added', status: 'A' },
{ key: 'deleted', status: 'D' },
{ key: 'untracked', status: 'U' },
];
export const FILE_STATUS_LABELS: Record<FileStatusCode, string> = {
M: 'Modified',
A: 'Added',
D: 'Deleted',
U: 'Untracked',
};
export const FILE_STATUS_BADGE_CLASSES: Record<FileStatusCode, string> = {
M: 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800/50',
A: 'bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300 border-green-200 dark:border-green-800/50',
D: 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300 border-red-200 dark:border-red-800/50',
U: 'bg-muted text-muted-foreground border-border',
};
export const CONFIRMATION_TITLES: Record<ConfirmActionType, string> = {
discard: 'Discard Changes',
delete: 'Delete File',
commit: 'Confirm Action',
pull: 'Confirm Pull',
push: 'Confirm Push',
publish: 'Publish Branch',
revertLocalCommit: 'Revert Local Commit',
deleteBranch: 'Delete Branch',
};
export const CONFIRMATION_ACTION_LABELS: Record<ConfirmActionType, string> = {
discard: 'Discard',
delete: 'Delete',
commit: 'Confirm',
pull: 'Pull',
push: 'Push',
publish: 'Publish',
revertLocalCommit: 'Revert Commit',
deleteBranch: 'Delete',
};
export const CONFIRMATION_BUTTON_CLASSES: Record<ConfirmActionType, string> = {
discard: 'bg-red-600 hover:bg-red-700',
delete: 'bg-red-600 hover:bg-red-700',
commit: 'bg-primary hover:bg-primary/90',
pull: 'bg-green-600 hover:bg-green-700',
push: 'bg-orange-600 hover:bg-orange-700',
publish: 'bg-purple-600 hover:bg-purple-700',
revertLocalCommit: 'bg-yellow-600 hover:bg-yellow-700',
deleteBranch: 'bg-red-600 hover:bg-red-700',
};
export const CONFIRMATION_ICON_CONTAINER_CLASSES: Record<ConfirmActionType, string> = {
discard: 'bg-red-100 dark:bg-red-900/30',
delete: 'bg-red-100 dark:bg-red-900/30',
commit: 'bg-yellow-100 dark:bg-yellow-900/30',
pull: 'bg-yellow-100 dark:bg-yellow-900/30',
push: 'bg-yellow-100 dark:bg-yellow-900/30',
publish: 'bg-yellow-100 dark:bg-yellow-900/30',
revertLocalCommit: 'bg-yellow-100 dark:bg-yellow-900/30',
deleteBranch: 'bg-red-100 dark:bg-red-900/30',
};
export const CONFIRMATION_ICON_CLASSES: Record<ConfirmActionType, string> = {
discard: 'text-red-600 dark:text-red-400',
delete: 'text-red-600 dark:text-red-400',
commit: 'text-yellow-600 dark:text-yellow-400',
pull: 'text-yellow-600 dark:text-yellow-400',
push: 'text-yellow-600 dark:text-yellow-400',
publish: 'text-yellow-600 dark:text-yellow-400',
revertLocalCommit: 'text-yellow-600 dark:text-yellow-400',
deleteBranch: 'text-red-600 dark:text-red-400',
};