fix: keep our copy-state styling and port stale-instance button hiding

Amends the merge resolution: drop the duplicated copy icon/tooltip block
that main reintroduced in ApiKeyCell (ours already declares it with the
text-success token), and port the functional change from main e40061965
that hides the Delete all stale button entirely when no stale instances
exist instead of rendering it disabled.
This commit is contained in:
t0ng7u
2026-07-11 20:30:15 +08:00
parent 9232444feb
commit d19b6196a5
2 changed files with 26 additions and 35 deletions
@@ -85,16 +85,6 @@ export function ApiKeyCell({ apiKey }: { apiKey: ApiKey }) {
if (ok) markKeyCopied(apiKey.id)
}, [resolvedFullKey, resolveRealKey, apiKey.id, markKeyCopied])
let copyIcon = <Copy className='size-3.5' />
let copyTooltip = t('Copy API key')
if (isLoading) {
copyIcon = <Loader2 className='size-3.5 animate-spin' />
copyTooltip = t('Loading...')
} else if (isCopied) {
copyIcon = <Check className='size-3.5 text-green-600' />
copyTooltip = t('Copied!')
}
return (
<div className='flex max-w-full min-w-0 items-center'>
<Popover open={popoverOpen} onOpenChange={handlePopoverOpen}>
@@ -503,6 +503,7 @@ export function SystemInstancesPanel() {
const staleInstances = instances.filter(
(instance) => instance.status === 'stale'
)
const hasStaleInstances = staleInstances.length > 0
const loading = instancesQuery.isLoading
const refreshing = instancesQuery.isFetching && !instancesQuery.isLoading
@@ -640,31 +641,31 @@ export function SystemInstancesPanel() {
seconds: INSTANCE_POLL_INTERVAL_MS / 1000,
})}
</span>
<Button
type='button'
variant='destructive'
onClick={() => setDeleteAllConfirmOpen(true)}
disabled={
staleInstances.length === 0 ||
isMutatingInstance ||
deleteStaleInstancesMutation.isPending
}
>
{deleteStaleInstancesMutation.isPending ? (
<Loader2
data-icon='inline-start'
className='size-3.5 animate-spin'
aria-hidden='true'
/>
) : (
<Trash2
data-icon='inline-start'
className='size-3.5'
aria-hidden='true'
/>
)}
{t('Delete all stale')}
</Button>
{hasStaleInstances ? (
<Button
type='button'
variant='destructive'
onClick={() => setDeleteAllConfirmOpen(true)}
disabled={
isMutatingInstance || deleteStaleInstancesMutation.isPending
}
>
{deleteStaleInstancesMutation.isPending ? (
<Loader2
data-icon='inline-start'
className='size-3.5 animate-spin'
aria-hidden='true'
/>
) : (
<Trash2
data-icon='inline-start'
className='size-3.5'
aria-hidden='true'
/>
)}
{t('Delete all stale')}
</Button>
) : null}
<Button
type='button'
variant='outline'