import { Loader2 } from "lucide-react" import { Button } from "../../ui/button" import { Typography } from "../../ui/typography" import { useAppDispatch, useAppSelector } from "@/hooks/hooks" import { getKeyElementsRequested } from "@/state/valkey-features/keys/keyBrowserSlice" import { selectElementsLoadingForKey } from "@/state/valkey-features/keys/keyBrowserSelectors" interface LoadMoreElementsProps { connectionId: string; keyInfo: { name: string; type: string; cursor?: string; collectionSize?: number; elements: unknown[]; }; } export default function LoadMoreElements({ connectionId, keyInfo }: LoadMoreElementsProps) { const dispatch = useAppDispatch() const loading = useAppSelector(selectElementsLoadingForKey(connectionId, keyInfo.name)) const { name, type, cursor, collectionSize, elements } = keyInfo if (cursor === undefined) return null return (
Showing {elements.length.toLocaleString()} {collectionSize !== undefined && ` of ${collectionSize.toLocaleString()}`}
) }