fix(search): address code review feedback on colors, race conditions, and utilities

This commit is contained in:
yiling
2026-05-25 15:33:56 +08:00
parent 1a4721e769
commit 73cd87a261
5 changed files with 77 additions and 109 deletions
@@ -13,6 +13,7 @@ import { Download } from 'lucide-react'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useInView } from 'react-intersection-observer'
import { toast } from 'sonner'
import { formatSize } from '@/ui/lib/format'
import type { DragState } from '../dnd-types'
import { FileBrowserContextMenu } from './context-menu'
import { useNavigate } from '@tanstack/react-router'
@@ -395,12 +396,6 @@ export function FileBrowser({
return `${count} ${isFile ? 'Asset' : 'Folder'}${count !== 1 ? 's' : ''}`
}
const formatSize = (bytes: number) => {
if (bytes < 1024) return `${bytes} B`
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`
return `${(bytes / (1024 * 1024)).toFixed(0)} MB`
}
const handleEmptyAreaClick = (e: React.MouseEvent) => {
const target = e.target as HTMLElement
// Clear selection if we didn't click on a card/row, button, or other interactive element