feat: Add process abort control and improve auth detection

This commit is contained in:
gsxdsm
2026-02-18 20:48:37 -08:00
parent 4ee160fae4
commit 15ca1eb6d3
24 changed files with 706 additions and 498 deletions

View File

@@ -103,8 +103,6 @@ const getStatusBadgeColor = (status: string) => {
}
};
// parseDiff is imported from @/lib/diff-utils
function DiffLine({
type,
content,
@@ -236,7 +234,12 @@ export function CommitWorktreeDialog({
}
}
} catch (err) {
console.warn('Failed to load diffs for commit dialog:', err);
console.error('Failed to load diffs for commit dialog:', err);
if (!cancelled) {
const errorMsg = err instanceof Error ? err.message : 'Failed to load diffs';
setError(errorMsg);
toast.error(errorMsg);
}
} finally {
if (!cancelled) setIsLoadingDiffs(false);
}

View File

@@ -102,7 +102,26 @@ const getStatusBadgeColor = (status: string) => {
}
};
// parseDiff is imported from @/lib/diff-utils
const bgClass = {
context: 'bg-transparent',
addition: 'bg-green-500/10',
deletion: 'bg-red-500/10',
header: 'bg-blue-500/10',
};
const textClass = {
context: 'text-foreground-secondary',
addition: 'text-green-400',
deletion: 'text-red-400',
header: 'text-blue-400',
};
const prefix = {
context: ' ',
addition: '+',
deletion: '-',
header: '',
};
function DiffLine({
type,
@@ -113,27 +132,6 @@ function DiffLine({
content: string;
lineNumber?: { old?: number; new?: number };
}) {
const bgClass = {
context: 'bg-transparent',
addition: 'bg-green-500/10',
deletion: 'bg-red-500/10',
header: 'bg-blue-500/10',
};
const textClass = {
context: 'text-foreground-secondary',
addition: 'text-green-400',
deletion: 'text-red-400',
header: 'text-blue-400',
};
const prefix = {
context: ' ',
addition: '+',
deletion: '-',
header: '',
};
if (type === 'header') {
return (
<div className={cn('px-2 py-1 font-mono text-xs', bgClass[type], textClass[type])}>
@@ -332,6 +330,7 @@ export function DiscardWorktreeChangesDialog({
</Label>
{files.length > 0 && (
<button
type="button"
onClick={handleToggleAll}
className="text-xs text-muted-foreground hover:text-foreground transition-colors"
>
@@ -368,6 +367,8 @@ export function DiscardWorktreeChangesDialog({
)
: 0;
const fileButtonId = `file-btn-${file.path.replace(/[^a-zA-Z0-9]/g, '-')}`;
return (
<div key={file.path} className="border-b border-border last:border-b-0">
<div
@@ -381,11 +382,15 @@ export function DiscardWorktreeChangesDialog({
checked={isChecked}
onCheckedChange={() => handleToggleFile(file.path)}
className="flex-shrink-0"
aria-labelledby={fileButtonId}
/>
{/* Clickable file row to show diff */}
<button
id={fileButtonId}
type="button"
onClick={() => handleFileClick(file.path)}
aria-expanded={isExpanded}
className="flex items-center gap-2 flex-1 min-w-0 text-left"
>
{isExpanded ? (

View File

@@ -5,7 +5,11 @@ import { Spinner } from '@/components/ui/spinner';
import { getElectronAPI } from '@/lib/electron';
import { useAppStore } from '@/store/app-store';
import { AnthropicIcon, OpenAIIcon, ZaiIcon, GeminiIcon } from '@/components/ui/provider-icon';
import { getExpectedWeeklyPacePercentage, getPaceStatusLabel } from '@/store/utils/usage-utils';
import {
getExpectedWeeklyPacePercentage,
getExpectedCodexPacePercentage,
getPaceStatusLabel,
} from '@/store/utils/usage-utils';
interface MobileUsageBarProps {
showClaudeUsage: boolean;
@@ -345,6 +349,10 @@ export function MobileUsageBar({
label={getCodexWindowLabel(codexUsage.rateLimits.primary.windowDurationMins)}
percentage={codexUsage.rateLimits.primary.usedPercent}
isStale={isCodexStale}
pacePercentage={getExpectedCodexPacePercentage(
codexUsage.rateLimits.primary.resetsAt,
codexUsage.rateLimits.primary.windowDurationMins
)}
/>
)}
{codexUsage.rateLimits.secondary && (
@@ -352,6 +360,10 @@ export function MobileUsageBar({
label={getCodexWindowLabel(codexUsage.rateLimits.secondary.windowDurationMins)}
percentage={codexUsage.rateLimits.secondary.usedPercent}
isStale={isCodexStale}
pacePercentage={getExpectedCodexPacePercentage(
codexUsage.rateLimits.secondary.resetsAt,
codexUsage.rateLimits.secondary.windowDurationMins
)}
/>
)}
</>