refactor: remove manual refresh functionality and update UI components for improved document management experience

This commit is contained in:
Anish Sarkar 2026-02-06 02:24:51 +05:30
parent c12401c1e8
commit 781cdc3dbd
6 changed files with 24 additions and 32 deletions

View file

@ -226,7 +226,7 @@ export function DocumentsFilters({
)}
</div>
{activeTypes.length > 0 && (
<div className="px-3 pt-1.5 border-t border-border/50">
<div className="px-3 pt-1.5 pb-1.5 border-t border-border/50">
<Button
variant="ghost"
size="sm"

View file

@ -45,7 +45,7 @@ function StatusIndicator({ status }: { status?: DocumentStatus }) {
<Clock className="h-5 w-5 text-muted-foreground" />
</div>
</TooltipTrigger>
<TooltipContent side="top">Pending - waiting to be processed</TooltipContent>
<TooltipContent side="top">Pending - waiting to be synced</TooltipContent>
</Tooltip>
);
case "processing":
@ -191,7 +191,6 @@ export function DocumentsTableShell({
documents,
loading,
error,
onRefresh,
selectedIds,
setSelectedIds,
columnVisibility,
@ -204,7 +203,6 @@ export function DocumentsTableShell({
documents: Document[];
loading: boolean;
error: boolean;
onRefresh: () => Promise<void>;
selectedIds: Set<number>;
setSelectedIds: (update: Set<number>) => void;
columnVisibility: ColumnVisibility;
@ -361,10 +359,15 @@ export function DocumentsTableShell({
</TableHead>
)}
{columnVisibility.created_at && (
<TableHead className="w-32">
<TableHead className="w-32 border-r border-border/40">
<Skeleton className="h-3 w-16" />
</TableHead>
)}
{columnVisibility.status && (
<TableHead className="w-20 text-center">
<Skeleton className="h-3 w-12 mx-auto" />
</TableHead>
)}
<TableHead className="w-10">
<span className="sr-only">Actions</span>
</TableHead>
@ -401,10 +404,15 @@ export function DocumentsTableShell({
</TableCell>
)}
{columnVisibility.created_at && (
<TableCell className="w-32 py-2.5">
<TableCell className="w-32 py-2.5 border-r border-border/40">
<Skeleton className="h-4 w-20" />
</TableCell>
)}
{columnVisibility.status && (
<TableCell className="w-20 py-2.5 text-center">
<Skeleton className="h-5 w-5 mx-auto rounded-full" />
</TableCell>
)}
<TableCell className="w-10 py-2.5 text-center">
<Skeleton className="h-6 w-6 mx-auto rounded" />
</TableCell>
@ -435,23 +443,26 @@ export function DocumentsTableShell({
)}
</div>
</div>
<Skeleton className="h-7 w-7 rounded" />
<div className="flex items-center gap-2">
{columnVisibility.status && (
<Skeleton className="h-5 w-5 rounded-full" />
)}
<Skeleton className="h-7 w-7 rounded" />
</div>
</div>
</div>
))}
</div>
</>
) : error ? (
<div className="flex h-[400px] w-full items-center justify-center">
<div className="flex h-[50vh] w-full items-center justify-center">
<div className="flex flex-col items-center gap-3">
<AlertCircle className="h-8 w-8 text-destructive/60" />
<p className="text-sm text-destructive">{t("error_loading")}</p>
<Button variant="outline" size="sm" onClick={() => onRefresh()}>
{t("retry")}
</Button>
</div>
</div>
) : sorted.length === 0 ? (
<div className="flex h-[400px] w-full items-center justify-center">
<div className="flex h-[50vh] w-full items-center justify-center">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}

View file

@ -140,22 +140,6 @@ export default function DocumentsTable() {
setPageIndex(0);
};
const [isRefreshing, setIsRefreshing] = useState(false);
const refreshCurrentView = useCallback(async () => {
if (isRefreshing) return;
setIsRefreshing(true);
try {
if (isSearchMode) {
await refetchSearch();
}
// Real-time view doesn't need manual refresh - Electric handles it
toast.success(t("refresh_success") || "Documents refreshed");
} finally {
setIsRefreshing(false);
}
}, [isSearchMode, refetchSearch, t, isRefreshing]);
const onBulkDelete = async () => {
if (selectedIds.size === 0) {
toast.error(t("no_rows_selected"));
@ -293,7 +277,6 @@ export default function DocumentsTable() {
documents={displayDocs}
loading={!!loading}
error={!!error}
onRefresh={refreshCurrentView}
selectedIds={selectedIds}
setSelectedIds={setSelectedIds}
columnVisibility={columnVisibility}

View file

@ -92,7 +92,7 @@ export const getConnectorIcon = (connectorType: EnumConnectorName | string, clas
case "FILE":
return <File {...iconProps} />;
case "GOOGLE_DRIVE_FILE":
return <File {...iconProps} />;
return <Image src="/connectors/google-drive.svg" alt="Google Drive" {...imgProps} />;
case "COMPOSIO_GOOGLE_DRIVE_CONNECTOR":
return <Image src="/connectors/google-drive.svg" alt="Google Drive" {...imgProps} />;
case "COMPOSIO_GMAIL_CONNECTOR":

View file

@ -328,7 +328,6 @@
"filter_placeholder": "Filter by title...",
"rows_per_page": "Rows per page",
"refresh": "Refresh",
"refresh_success": "Documents refreshed",
"upload_documents": "Upload Documents",
"create_shared_note": "Create Shared Note",
"processing_documents": "Processing documents...",

View file

@ -313,7 +313,6 @@
"filter_placeholder": "按标题筛选...",
"rows_per_page": "每页行数",
"refresh": "刷新",
"refresh_success": "文档已刷新",
"upload_documents": "上传文档",
"create_shared_note": "创建共享笔记",
"processing_documents": "正在处理文档...",