Skip to content

Commit 67f6935

Browse files
committed
ui: improve git ref badge styling and add HEAD label in HistoryTab
1 parent a0c9b1a commit 67f6935

1 file changed

Lines changed: 24 additions & 11 deletions

File tree

wimygit-tauri/src/components/tabs/HistoryTab.tsx

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,25 @@ export function HistoryTab({ repoPath, filePath, refreshKey, onRefresh, onFileSe
352352
{refs.map((r, i) => {
353353
const isStale = r.kind === "remote" && staleBranches.has(r.label);
354354
const isLocalOnly = (r.kind === "branch" || r.kind === "head") && localOnlyBranches.has(r.label);
355+
const isCurrent = r.kind === "head";
356+
357+
const outerCls = isStale
358+
? "border border-red-950"
359+
: isLocalOnly
360+
? "border border-orange-950"
361+
: "";
362+
363+
const nameBg = isStale
364+
? "bg-red-800 text-white"
365+
: isCurrent
366+
? "bg-green-700 text-white"
367+
: isLocalOnly
368+
? "bg-orange-700 text-white"
369+
: REF_BADGE[r.kind];
370+
355371
return (
356-
<span key={i} className={`inline-flex items-center shrink-0 leading-4 overflow-hidden rounded ${isStale ? "border border-red-950 bg-red-600" : isLocalOnly ? "border border-orange-950 bg-orange-500" : ""}`}>
357-
<span className={`text-[10px] px-1 leading-4 inline-flex items-center gap-0.5 ${isStale ? "bg-red-800 text-white" : isLocalOnly ? "bg-orange-700 text-white" : REF_BADGE[r.kind]}`}>
372+
<span key={i} className={`inline-flex items-center shrink-0 leading-4 overflow-hidden rounded ${outerCls}`}>
373+
<span className={`text-[10px] px-1 leading-4 inline-flex items-center gap-0.5 ${nameBg}`}>
358374
{(r.kind === "head" || r.kind === "branch" || r.kind === "remote") && (
359375
<svg width="10" height="10" viewBox="0 0 16 16" fill="currentColor" className="shrink-0">
360376
<path d="M11.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5zm-2.25.75a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25zM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5zM3.5 3.25a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0z" />
@@ -367,17 +383,14 @@ export function HistoryTab({ repoPath, filePath, refreshKey, onRefresh, onFileSe
367383
)}
368384
{r.label}
369385
</span>
370-
{isStale && (
371-
<>
372-
<span className="self-stretch w-px bg-red-950" />
373-
<span className="text-[10px] px-1 leading-4 text-white">deleted on remote</span>
374-
</>
386+
{isCurrent && (
387+
<span className="text-[10px] px-1 leading-4 bg-green-600 text-white">HEAD</span>
375388
)}
376389
{isLocalOnly && (
377-
<>
378-
<span className="self-stretch w-px bg-orange-950" />
379-
<span className="text-[10px] px-1 leading-4 text-white">local only</span>
380-
</>
390+
<span className="text-[10px] px-1 leading-4 bg-orange-500 text-white">local only</span>
391+
)}
392+
{isStale && (
393+
<span className="text-[10px] px-1 leading-4 bg-red-600 text-white">deleted on remote</span>
381394
)}
382395
</span>
383396
);

0 commit comments

Comments
 (0)