Skip to Content
BBRICKSv0.7.4
PR PortalTable presets

useCampaignColumnsCopy

The words with the BricksProvider's labels.prCampaignColumns over the defaults (and own over both), for campaignColumns(language, useCampaignColumnsCopy(language)).

import { useCampaignColumnsCopy } from '@ergasti/bricks';

Examples

The Campaigns tab

One row per brand with its active campaign; waiting requests show as a pill. Rows open the campaign page.

Code
import { DataTable, campaignColumns, useCampaignColumnsCopy, type CampaignRow } from '@ergasti/bricks';

const ROWS: CampaignRow[] = [
  { id: 'glow', brand: { id: 'glow', name: 'Glow Lab', color: '#C7325C' }, campaign: { name: 'Winter glow 2026', from: '1 Nov 2026', to: '31 Jan 2027' }, status: 'active', waiting: 2, commission: '10% of sale', creators: 86, sales: '412300.00', orders: 1284, lastChange: 'Since 1 Oct 2026' },
  { id: 'nile', brand: { id: 'nile', name: 'Nile Threads', color: '#2C45A6' }, campaign: { name: 'Nile autumn', from: '12 Oct 2026', to: '31 Dec 2026' }, status: 'active', waiting: 0, commission: 'EGP 50 per item', creators: 41, sales: '96000.00', orders: 410, lastChange: 'Since 12 Oct 2026' },
];

function Campaigns() {
  const words = useCampaignColumnsCopy();
  return <DataTable label="Campaigns" columns={campaignColumns('en', words, { decimals: 'auto' })} rows={ROWS} rowKey={(r) => r.id} onRowClick={() => {}} />;
}

Wrapping cells

campaignColumns(language, copy, money, { wrap: true }) lets the dates, commission, sales and last change wrap, as on the v3 mock's Affiliate programs page: "1 Nov 2026 → 31 Jan 2027" takes two lines in a narrower column and the rows grow to about 79px. Without it every cell stays on one line.

Code
import { DataTable, campaignColumns, useCampaignColumnsCopy, type CampaignRow } from '@ergasti/bricks';

const ROWS: CampaignRow[] = [
  { id: 'glow', brand: { id: 'glow', name: 'Glow Lab', color: '#C7325C' }, campaign: { name: 'Winter glow 2026', from: '1 Nov 2026', to: '31 Jan 2027' }, status: 'active', waiting: 2, commission: '10% of sale', creators: 86, sales: '412300.00', orders: 1284, lastChange: 'Since 1 Oct 2026' },
  { id: 'nile', brand: { id: 'nile', name: 'Nile Threads', color: '#2C45A6' }, campaign: { name: 'Nile autumn', from: '12 Oct 2026', to: '31 Dec 2026' }, status: 'active', waiting: 0, commission: 'EGP 50 per item', creators: 41, sales: '96000.00', orders: 410, lastChange: 'Since 12 Oct 2026' },
];

function CampaignsWrapping() {
  const words = useCampaignColumnsCopy();
  return <DataTable label="Campaigns" columns={campaignColumns('en', words, { decimals: 'auto' }, { wrap: true })} rows={ROWS} rowKey={(r) => r.id} onRowClick={() => {}} />;
}

Signature

function useCampaignColumnsCopy(language?: Lang | undefined, own?: Partial<{ readonly brand: string; readonly campaign: string; readonly status: string; readonly requests: string; readonly commission: string; readonly creators: string; readonly sales: string; readonly orders: string; readonly lastChange: string; readonly range: (from: string, to: string) => string; readonly waiting: (n: string) => string; readonly none: string; }> | undefined): { readonly brand: string; readonly campaign: string; readonly status: string; readonly requests: string; readonly commission: string; readonly creators: string; readonly sales: string; readonly orders: string; readonly lastChange: string; readonly range: (from: string, to: string) => string; readonly waiting: (n: string) => string; readonly none: string; }

Parameters

Prop

Type

Returns

{ readonly brand: string; readonly campaign: string; readonly status: string; readonly requests: string; readonly commission: string; readonly creators: string; readonly sales: string; readonly orders: string; readonly lastChange: string; readonly range: (from: string, to: string) => string; readonly waiting: (n: string) => string; readonly none: string; }

Money · Pill · BrandCell · PrStatusPill · DataTable · useGiftAnalyticsCopy · useGiftColumnsCopy · usePrColumnsCopy

Source

src/pr/programs/campaignColumns.tsx (line 56) on GitHub.

On this page