Skip to content

Support solo buttons in table row #1840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions apps/webapp/app/components/primitives/Table.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChevronRightIcon } from "@heroicons/react/24/solid";
import { Link } from "@remix-run/react";
import React, { ReactNode, forwardRef, useState, useContext, createContext } from "react";
import React, { type ReactNode, forwardRef, useState, useContext, createContext } from "react";
import { cn } from "~/utils/cn";
import { Popover, PopoverContent, PopoverVerticalEllipseTrigger } from "./Popover";
import { InfoIconTooltip } from "./Tooltip";
Expand All @@ -21,7 +21,7 @@ const variants = {
stickyCell: "group-hover/table-row:bg-charcoal-800",
menuButton:
"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",
menuButtonDivider: "group-hover/table-row:border-grid-dimmed",
menuButtonDivider: "group-hover/table-row:border-grid-bright",
rowSelected: "bg-charcoal-750 group-hover/table-row:bg-charcoal-750",
},
} as const;
Expand Down Expand Up @@ -344,11 +344,12 @@ export const TableCellMenu = forwardRef<
{hiddenButtons && (
<div
className={cn(
"hidden pr-0.5 group-hover/table-row:block group-hover/table-row:border-r",
"hidden group-hover/table-row:block",
popoverContent && "pr-0.5 group-hover/table-row:border-r",
variants[variant].menuButtonDivider
)}
>
{hiddenButtons}
<div className={cn("flex items-center gap-x-0.5")}>{hiddenButtons}</div>
</div>
)}
{/* Always visible buttons */}
Expand All @@ -368,18 +369,6 @@ export const TableCellMenu = forwardRef<
</PopoverContent>
</Popover>
)}
{/* Optionally pass in children to render in a popover */}
{!visibleButtons && !hiddenButtons && !popoverContent && (
<Popover onOpenChange={(open) => setIsOpen(open)}>
<PopoverVerticalEllipseTrigger isOpen={isOpen} />
<PopoverContent
className="w-fit max-w-[10rem] overflow-y-auto p-0 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600"
align="end"
>
<div className="flex flex-col gap-1 p-1">{children}</div>
</PopoverContent>
</Popover>
)}
</div>
</div>
</TableCell>
Expand Down
4 changes: 2 additions & 2 deletions apps/webapp/app/components/runs/v3/TaskRunsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ function RunActionsCell({ run, path }: { run: RunListItem; path: string }) {
</>
}
hiddenButtons={
<div className="flex items-center">
<>
{run.isCancellable && (
<SimpleTooltip
button={
Expand Down Expand Up @@ -518,7 +518,7 @@ function RunActionsCell({ run, path }: { run: RunListItem; path: string }) {
disableHoverableContent
/>
)}
</div>
</>
}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,12 @@ export default function Page() {
iconClassName="text-indigo-500"
variant="info"
accessory={
<LinkButton to="https://trigger.dev/docs/v3/tasks-scheduled" variant="docs/small">
Docs
<LinkButton
to="https://trigger.dev/docs/v3/tasks-scheduled"
variant="docs/small"
LeadingIcon={BookOpenIcon}
>
Schedules docs
</LinkButton>
}
panelClassName="max-w-full"
Expand Down