Files
opsxshell/src/components/sftp/SortHeader.tsx
T
Logan.LiandCursor 08696896f9 feat: harden local shell, SFTP, and desktop session reliability
Finder-launched terminals now inherit a login PATH so tools like ollama resolve, destructive SFTP/editor actions require confirmation, and terminal search plus window dragging work again. SSH forwards and RDP sessions keep listeners and survive reconnect without FastPath crashes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-16 16:08:11 +08:00

51 lines
1.6 KiB
TypeScript

/**
* SortHeader - 列表排序表头组件
*/
import { ArrowUp, ArrowDown } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import type { SortField, SortOrder } from '../../../shared/types/sftp.types'
interface SortHeaderProps {
onSort: (f: SortField) => void
sortField: SortField
sortOrder: SortOrder
}
const FIELDS: { key: SortField; className: string }[] = [
{ key: 'name', className: 'sftp-col-name flex-1 min-w-0 justify-start' },
{ key: 'modified', className: 'sftp-col-modified w-28 flex-shrink-0 justify-end' },
{ key: 'size', className: 'sftp-col-size w-16 flex-shrink-0 justify-end' },
{ key: 'type', className: 'sftp-col-type w-16 flex-shrink-0 justify-end' },
]
export function SortHeader({ onSort, sortField, sortOrder }: SortHeaderProps) {
const { t } = useTranslation('sftp')
return (
<div className="h-8 flex items-center w-full text-xs text-txt-muted select-none">
{FIELDS.map(({ key, className }) => {
const active = sortField === key
return (
<button
key={key}
type="button"
onClick={() => onSort(key)}
className={`${className} flex items-center gap-1 hover:text-content-primary transition-colors ${
active ? 'text-content-primary' : ''
}`}
>
<span>{t(`sort.${key}`)}</span>
{active &&
(sortOrder === 'asc' ? (
<ArrowUp className="w-3 h-3 flex-shrink-0" />
) : (
<ArrowDown className="w-3 h-3 flex-shrink-0" />
))}
</button>
)
})}
</div>
)
}