Skip to content

feat(table): add getCopyDeepLinkAction utility and TableAction type#1656

Merged
leecalcote merged 4 commits into
masterfrom
claude/gifted-cray-lmof5l
Jun 24, 2026
Merged

feat(table): add getCopyDeepLinkAction utility and TableAction type#1656
leecalcote merged 4 commits into
masterfrom
claude/gifted-cray-lmof5l

Conversation

@hortison

@hortison hortison commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a TableAction type and a getCopyDeepLinkAction(onCopy, title?) helper that returns a pre-built row-action descriptor (with CopyLinkIcon and the provided callback); title defaults to 'Copy link' and is overridable for i18n
  • Exports both from the package root so any consumer can drop a "Copy link" entry into a ResponsiveDataTable actionsList

Changes

  • src/custom/TableActions.tsx (new) - holds the TableAction type and getCopyDeepLinkAction helper
  • src/custom/ResponsiveDataTable.tsx - imports TableAction from the leaf for the Column.options.actionsList typing
  • src/custom/index.tsx - re-exports both from the leaf module
  • src/index.tsx - explicit root re-export of the leaf so the symbols land in the published declaration bundle

Why a separate TableActions leaf module

The type and helper were originally inline in ResponsiveDataTable, reaching the entry only through export * from './custom'. rollup-plugin-dts (used by tsup for the declaration bundle) drops such nested re-exports, so import { getCopyDeepLinkAction, TableAction } from '@sistent/sistent' resolved to nothing in consumers even though the runtime export existed. Re-exporting directly from ResponsiveDataTable is not viable - it imports the untyped @sistent/mui-datatables, which makes the dts build resolve that module and fail (TS7016). Moving the symbols into a leaf module free of untyped imports lets the explicit root re-export force them into the published bundle (the same workaround already used for FeedbackButton).

Usage

import { getCopyDeepLinkAction } from '@sistent/sistent';

const actions = [
  getCopyDeepLinkAction(() => copyToClipboard(buildRowUrl(rowId))),
  // ... other actions
];

Test plan

  • getCopyDeepLinkAction returns a descriptor with title, icon, onClick (default title 'Copy link')
  • Runtime bundle exports getCopyDeepLinkAction (dist/index.js)
  • Published dist/index.d.ts declares both TableAction and getCopyDeepLinkAction at the package root
  • tsup build (JS + declaration bundle) exits 0
  • CopyLinkIcon renders in the DataTableEllipsisMenu action list - visual, exercised by consumers

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new TableAction type and a helper function getCopyDeepLinkAction to standardise the "Copy link" action within the ResponsiveDataTable component, exporting them from the module's entry point. Feedback suggests making the action's title configurable with a default value to avoid hardcoded UI strings and support internationalization (i18n).

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/custom/ResponsiveDataTable.tsx Outdated
Comment on lines +157 to +161
export const getCopyDeepLinkAction = (onCopy: () => void): TableAction => ({
title: 'Copy link',
icon: <CopyLinkIcon width={20} height={20} />,
onClick: onCopy,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Avoid hardcoding UI strings in shared components and utilities. To support internationalization (i18n) and localization, expose the title string as a configurable parameter with a default value of 'Copy link' to maintain backward compatibility.

Suggested change
export const getCopyDeepLinkAction = (onCopy: () => void): TableAction => ({
title: 'Copy link',
icon: <CopyLinkIcon width={20} height={20} />,
onClick: onCopy,
});
export const getCopyDeepLinkAction = (onCopy: () => void, title = 'Copy link'): TableAction => ({
title,
icon: <CopyLinkIcon width={20} height={20} />,
onClick: onCopy,
});
References
  1. Avoid hardcoding UI strings (such as button labels) in shared components. Expose these strings as configurable props to support internationalization (i18n) and localization.
  2. When exposing UI strings as configurable props in shared components to support localization, provide a default value to maintain backward compatibility.

@hortison hortison Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call — fixed in the follow-up commit. getCopyDeepLinkAction now accepts an optional title parameter (default 'Copy link') so consumers can pass a localized string without breaking existing call sites.

Expose a pre-built TableAction descriptor that produces a 'Copy link'
row-action menu entry. Callers pass an onCopy callback; the action
renders CopyLinkIcon and a 'Copy link' label.

Export getCopyDeepLinkAction and the TableAction type from the custom
index so Meshery UI and other consumers can use them without reaching
into the component internals.


Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
@hortison hortison force-pushed the claude/gifted-cray-lmof5l branch 4 times, most recently from 95fb225 to d64abf3 Compare June 24, 2026 17:03
Expand the custom directory description in CONTRIBUTING.md to cover
ResponsiveDataTable: key exports, getCopyDeepLinkAction helper signature
and i18n title param, and the steps for adding a new responsive column.

Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
@leecalcote leecalcote force-pushed the claude/gifted-cray-lmof5l branch from df7b0fa to cb03dd2 Compare June 24, 2026 17:57
The helper and its TableAction type were defined inline in ResponsiveDataTable
and reached the package entry only through 'export * from ./custom'.
rollup-plugin-dts drops such nested re-exports from the bundled declarations,
so 'import { getCopyDeepLinkAction, TableAction } from @sistent/sistent'
resolved to nothing in consumers despite the runtime export existing.

Re-exporting them directly from ResponsiveDataTable is not viable: it imports
the untyped @sistent/mui-datatables, which makes the dts build resolve that
module and fail (TS7016). Move both into a new leaf module TableActions (free
of untyped imports) and re-export it explicitly from src/index.tsx, the same
workaround already used for FeedbackButton, so both the value and the type land
in the published bundle.

Verified: build exits 0 and dist/index.d.ts declares both symbols.
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
@leecalcote leecalcote merged commit 83eb7ac into master Jun 24, 2026
5 checks passed
@leecalcote leecalcote deleted the claude/gifted-cray-lmof5l branch June 24, 2026 18:12
leecalcote added a commit that referenced this pull request Jun 24, 2026
feat(table): add getCopyDeepLinkAction utility and TableAction type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants