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

Function WorkspacesRow

site/src/pages/WorkspacesPage/WorkspacesTable.tsx:313–351  ·  view source on GitHub ↗
({
	workspace,
	children,
	checked,
})

Source from the content-addressed store, hash-verified

311}
312
313const WorkspacesRow: FC<WorkspacesRowProps> = ({
314 workspace,
315 children,
316 checked,
317}) => {
318 const navigate = useNavigate();
319
320 const workspacePageLink = `/@${workspace.owner_name}/${workspace.name}`;
321 const openLinkInNewTab = () => window.open(workspacePageLink, "_blank");
322 const { role, hover, ...clickableProps } = useClickableTableRow({
323 onMiddleClick: openLinkInNewTab,
324 onClick: (event) => {
325 // Order of booleans actually matters here for Windows-Mac compatibility;
326 // meta key is Cmd on Macs, but on Windows, it's either the Windows key,
327 // or the key does nothing at all (depends on the browser)
328 const shouldOpenInNewTab =
329 event.shiftKey || event.metaKey || event.ctrlKey;
330
331 if (shouldOpenInNewTab) {
332 openLinkInNewTab();
333 } else {
334 navigate(workspacePageLink);
335 }
336 },
337 });
338
339 return (
340 <TableRow
341 {...clickableProps}
342 data-testid={`workspace-${workspace.id}`}
343 className={cn([
344 checked ? "bg-surface-secondary hover:bg-surface-secondary" : undefined,
345 clickableProps.className,
346 ])}
347 >
348 {children}
349 </TableRow>
350 );
351};
352
353const TableLoader: FC = () => {
354 return (

Callers

nothing calls this directly

Calls 3

useClickableTableRowFunction · 0.90
cnFunction · 0.90
openLinkInNewTabFunction · 0.85

Tested by

no test coverage detected