add pagination handling for lists

This commit is contained in:
Ashwin Bhat
2024-10-17 16:59:37 -07:00
parent 5f9d11b3a9
commit 24d005ac84
5 changed files with 41 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ import { FileText, ChevronRight, AlertCircle, RefreshCw } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { TabsContent } from "@/components/ui/tabs";
import { Resource } from "mcp-typescript/types.js";
import { ListResourcesResult, Resource } from "mcp-typescript/types.js";
import ListPane from "./ListPane";
const ResourcesTab = ({
@@ -12,6 +12,7 @@ const ResourcesTab = ({
selectedResource,
setSelectedResource,
resourceContent,
nextCursor,
error,
}: {
resources: Resource[];
@@ -20,6 +21,7 @@ const ResourcesTab = ({
selectedResource: Resource | null;
setSelectedResource: (resource: Resource) => void;
resourceContent: string;
nextCursor: ListResourcesResult["nextCursor"];
error: string | null;
}) => (
<TabsContent value="resources" className="grid grid-cols-2 gap-4">
@@ -40,7 +42,8 @@ const ResourcesTab = ({
</div>
)}
title="Resources"
buttonText="List Resources"
buttonText={nextCursor ? "List More Resources" : "List Resources"}
isButtonDisabled={!nextCursor && resources.length > 0}
/>
<div className="bg-white rounded-lg shadow">