Settings
Settings discounts
The Discounts pane of space settings, listing discount codes in a filterable, selectable, paginated table with search, bulk delete, and row-level edit/delete/copy actions.
Available
Ports as-is
Examples
Rendered live from the maintained Storybook story. Lantern stores only the story id and embeds Storybook rather than duplicating the component or its demo.
Settings discounts
Rendered live from Storybook
Storybook must be running for this to load — bun run start:storybook from the monorepo root, or set NEXT_PUBLIC_STORYBOOK_URL to a deployed instance.
Props
The component's public API, read from its TypeScript source. Descriptions come from TSDoc on the prop, so this table cannot drift from the component.
| Prop | Type | Default | Description |
|---|---|---|---|
discounts | DiscountData[] | [] | Rows to display. Defaults to an empty list. |
spaceId | string | "founders" | Only rows whose `spaceId` matches are shown. Rows with no `spaceId` count as "founders". |
onManageDiscount | (discountId: string) => void | — | Opens a discount's detail screen. Also the row and "Preview" action. |
onCreateDiscount | () => void | — | Fired by the "Create" button — the app opens the type picker and editor. |
onEditDiscount | (discountId: string) => void | — | Fired by the row menu's "Edit". |
onDeleteDiscount | (discountId: string) => void | — | Fired by the row menu's "Delete". |
onDeleteSelected | (discountIds: string[]) => void | — | Fired by the bulk-actions menu, with every selected id. |
onCopyCode | (code: string) => void | — | Fired when a code chip is clicked. The chip also writes to the clipboard. |
onCopyUrl | (url: string) => void | — | Fired by "Copy URL", with the built checkout link. |
checkoutUrlBase | string | "https://behindthescenes.com/checkout?discount=" | Base the "Copy URL" link is built from. |
searchQuery | string | — | Search text. Controlled when supplied. |
initialSearchQuery | string | "" | Uncontrolled starting query. |
onSearchQueryChange | (query: string) => void | — | Undocumented — add TSDoc to the prop in the library. |
defaultSearchOpen | boolean | false | Renders the expanded search field instead of the icon button. |
defaultSelectionMode | boolean | false | Renders the checkbox column and the bulk-actions header. |
initialSelectedIds | string[] | — | Pre-checked row ids — makes "n selected" a static story. |
page | number | — | Zero-based page. Controlled when supplied. |
onPageChange | (page: number) => void | — | Undocumented — add TSDoc to the prop in the library. |
pageSize | number | 20 | Undocumented — add TSDoc to the prop in the library. |
className | string | — | Undocumented — add TSDoc to the prop in the library. |
Reference
Transcribed from the component audit. If this disagrees with the source, the source is right.
- Source
src/components/settings/SettingsDiscounts.tsx- Portability
- Copies across unchanged — only the utils import path moves.
- Notes
- Use to let space owners manage discount codes; rows are scoped by space id and can be searched by code, and selection mode adds a checkbox column with a bulk-actions menu limited to the current page. Below md the seven-column grid switches to a stacked list and the Create button moves out of this component into the screen's own header.