Skip to content

Commit 73b41c2

Browse files
authored
Support solo buttons in table row (#1840)
* Removed old condition that handled old v2 tables * Adds support for a single button to be shown on hover in a table cell * Makes the “hiddenButtons” support a single button instead of adding a new property * Format the docs link for Schedules like the other for consistency
1 parent f4ef008 commit 73b41c2

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

apps/webapp/app/components/primitives/Table.tsx

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ChevronRightIcon } from "@heroicons/react/24/solid";
22
import { Link } from "@remix-run/react";
3-
import React, { ReactNode, forwardRef, useState, useContext, createContext } from "react";
3+
import React, { type ReactNode, forwardRef, useState, useContext, createContext } from "react";
44
import { cn } from "~/utils/cn";
55
import { Popover, PopoverContent, PopoverVerticalEllipseTrigger } from "./Popover";
66
import { InfoIconTooltip } from "./Tooltip";
@@ -21,7 +21,7 @@ const variants = {
2121
stickyCell: "group-hover/table-row:bg-charcoal-800",
2222
menuButton:
2323
"bg-background-dimmed group-hover/table-row:bg-charcoal-800 group-hover/table-row:ring-grid-bright group-has-[[tabindex='0']:focus]/table-row:bg-background-bright",
24-
menuButtonDivider: "group-hover/table-row:border-grid-dimmed",
24+
menuButtonDivider: "group-hover/table-row:border-grid-bright",
2525
rowSelected: "bg-charcoal-750 group-hover/table-row:bg-charcoal-750",
2626
},
2727
} as const;
@@ -344,11 +344,12 @@ export const TableCellMenu = forwardRef<
344344
{hiddenButtons && (
345345
<div
346346
className={cn(
347-
"hidden pr-0.5 group-hover/table-row:block group-hover/table-row:border-r",
347+
"hidden group-hover/table-row:block",
348+
popoverContent && "pr-0.5 group-hover/table-row:border-r",
348349
variants[variant].menuButtonDivider
349350
)}
350351
>
351-
{hiddenButtons}
352+
<div className={cn("flex items-center gap-x-0.5")}>{hiddenButtons}</div>
352353
</div>
353354
)}
354355
{/* Always visible buttons */}
@@ -368,18 +369,6 @@ export const TableCellMenu = forwardRef<
368369
</PopoverContent>
369370
</Popover>
370371
)}
371-
{/* Optionally pass in children to render in a popover */}
372-
{!visibleButtons && !hiddenButtons && !popoverContent && (
373-
<Popover onOpenChange={(open) => setIsOpen(open)}>
374-
<PopoverVerticalEllipseTrigger isOpen={isOpen} />
375-
<PopoverContent
376-
className="w-fit max-w-[10rem] overflow-y-auto p-0 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600"
377-
align="end"
378-
>
379-
<div className="flex flex-col gap-1 p-1">{children}</div>
380-
</PopoverContent>
381-
</Popover>
382-
)}
383372
</div>
384373
</div>
385374
</TableCell>

apps/webapp/app/components/runs/v3/TaskRunsTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ function RunActionsCell({ run, path }: { run: RunListItem; path: string }) {
472472
</>
473473
}
474474
hiddenButtons={
475-
<div className="flex items-center">
475+
<>
476476
{run.isCancellable && (
477477
<SimpleTooltip
478478
button={
@@ -518,7 +518,7 @@ function RunActionsCell({ run, path }: { run: RunListItem; path: string }) {
518518
disableHoverableContent
519519
/>
520520
)}
521-
</div>
521+
</>
522522
}
523523
/>
524524
);

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.schedules.$scheduleParam/route.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,12 @@ export default function Page() {
358358
iconClassName="text-indigo-500"
359359
variant="info"
360360
accessory={
361-
<LinkButton to="https://trigger.dev/docs/v3/tasks-scheduled" variant="docs/small">
362-
Docs
361+
<LinkButton
362+
to="https://trigger.dev/docs/v3/tasks-scheduled"
363+
variant="docs/small"
364+
LeadingIcon={BookOpenIcon}
365+
>
366+
Schedules docs
363367
</LinkButton>
364368
}
365369
panelClassName="max-w-full"

0 commit comments

Comments
 (0)