MCPcopy Index your code
hub / github.com/coder/coder / HistorySidebar

Function HistorySidebar

site/src/pages/WorkspacePage/HistorySidebar.tsx:24–70  ·  view source on GitHub ↗
({ workspace })

Source from the content-addressed store, hash-verified

22}
23
24export const HistorySidebar: FC<HistorySidebarProps> = ({ workspace }) => {
25 const buildsQuery = useInfiniteQuery({
26 ...infiniteWorkspaceBuilds(workspace?.id ?? ""),
27 enabled: workspace !== undefined,
28 });
29 const builds = buildsQuery.data?.pages.flat();
30
31 return (
32 <Sidebar>
33 <SidebarCaption>History</SidebarCaption>
34 <ScrollArea>
35 <div className="flex flex-col gap-px">
36 {builds
37 ? builds.map((build) => (
38 <SidebarLink
39 target="_blank"
40 key={build.id}
41 to={`/@${build.workspace_owner_name}/${build.workspace_name}/builds/${build.build_number}`}
42 >
43 <WorkspaceBuildData build={build} />
44 </SidebarLink>
45 ))
46 : Array.from({ length: 15 }, (_, i) => (
47 <SidebarItem key={i}>
48 <WorkspaceBuildDataSkeleton />
49 </SidebarItem>
50 ))}
51 {buildsQuery.hasNextPage && (
52 <div className="p-4">
53 <Button
54 onClick={() => buildsQuery.fetchNextPage()}
55 disabled={buildsQuery.isFetchingNextPage}
56 variant="outline"
57 className="w-full"
58 >
59 <Spinner loading={buildsQuery.isFetchingNextPage}>
60 <ArrowDownIcon />
61 </Spinner>
62 Show more builds
63 </Button>
64 </div>
65 )}
66 </div>
67 </ScrollArea>
68 </Sidebar>
69 );
70};

Callers

nothing calls this directly

Calls 1

infiniteWorkspaceBuildsFunction · 0.90

Tested by

no test coverage detected