Skip to Content
BBRICKSv0.7.4
BlocksMessages

MessagesPanel

The brand's Messages screen, read-only: a 🔒 banner saying TRNDR's team sends messages to creators (with "Contact TRNDR" when there is a URL), the message history card, and an optional "Sent automatically" card for the automatic messages list the app passes in.

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

Examples

One message

The name, channel, status, when it was sent, who sent it, the audience and how many it reached; the body is shown in the page's language when the message has it.

Code
import { MessageHistoryItem, type BrandMessage } from '@ergasti/bricks';

const messages: BrandMessage[] = [
  { id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
  { id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
  { id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];

function Item() {
  return <div style={{ maxWidth: 620 }}><MessageHistoryItem message={messages[0]} /></div>;
}

History with a filter

A list of messages with a "sent by" filter, a pager slot, and loading, error and empty states.

Code
import { MessageHistoryList, type BrandMessage } from '@ergasti/bricks';
import { useState } from 'react';
import type { MessageSentByFilter } from '@ergasti/bricks';

const messages: BrandMessage[] = [
  { id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
  { id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
  { id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];

function History() {
  const [sentBy, setSentBy] = useState<MessageSentByFilter>('all');
  const shown = messages.filter((m) => sentBy === 'all' || m.sent_by === sentBy);
  return <div style={{ maxWidth: 620 }}><MessageHistoryList messages={shown} sentBy={{ value: sentBy, onChange: setSentBy }} /></div>;
}

Messages page

The history plus a way to ask TRNDR to send something (onContact or contactUrl) and a slot for the automatic messages.

Code
import { MessagesPanel, type BrandMessage } from '@ergasti/bricks';

const messages: BrandMessage[] = [
  { id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
  { id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
  { id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];

function Panel() {
  return <div style={{ maxWidth: 680 }}><MessagesPanel onContact={() => {}} history={{ messages }} automatic={<p className="kit-muted">Welcome and payout messages are sent automatically.</p>} /></div>;
}

Loading, error and empty

status="loading" and status="error" (with error for the reason and onRetry for Try again) replace the list; an empty messages says nothing was sent yet.

Code
import { Card, MessageHistoryList, type BrandMessage } from '@ergasti/bricks';

const messages: BrandMessage[] = [
  { id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
  { id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
  { id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];

function States() {
  return (
    <div style={{ maxWidth: 620, display: 'grid', gap: 16 }}>
      <Card><MessageHistoryList messages={[]} status="loading" /></Card>
      <Card><MessageHistoryList messages={[]} status="error" error="Messages could not be loaded. Check your connection." onRetry={() => {}} /></Card>
      <Card><MessageHistoryList messages={[]} /></Card>
    </div>
  );
}

With a pager

pager sits under the list: pass the kit Pager and fetch the page on change. labels and itemLabels override single words (here the list's name and the not-sent line).

Code
import { MessageHistoryList, Pager, type BrandMessage } from '@ergasti/bricks';
import { useState } from 'react';

const messages: BrandMessage[] = [
  { id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
  { id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
  { id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];

function Paged() {
  const [page, setPage] = useState(1);
  return (
    <div style={{ maxWidth: 620 }}>
      <MessageHistoryList
        messages={messages.slice(page - 1, page + 1)}
        pager={<Pager page={page} lastPage={2} total={3} perPage={2} loading={false} label="Messages" onPage={setPage} />}
        labels={{ label: 'Messages to Glow Lab creators' }} itemLabels={{ notSent: 'Waiting to go out' }}
      />
    </div>
  );
}

contactUrl (the API's contact_url) makes "Contact TRNDR" a link; empty or null hides it. The history takes the same states as the list.

Code
import { MessagesPanel, type BrandMessage } from '@ergasti/bricks';

const messages: BrandMessage[] = [
  { id: 1, name: 'Winter glow is live', body_en: 'Our Winter glow challenge starts today. Pick your gift in the app.', body_ar: 'تحدي Winter glow بدأ النهارده. اختار هديتك من التطبيق.', channel: 'whatsapp', status: 'sent', sent_at: '2026-11-12T10:00:00+02:00', sent_by: 'trndr_on_behalf', audience: { kind: 'all' }, recipients: 304, delivered: 298 },
  { id: 2, name: 'Top sellers bonus', body_en: 'You are in the top sellers group: the bonus is on.', body_ar: null, channel: 'sms', status: 'sent', sent_at: '2026-11-08T12:30:00+02:00', sent_by: 'brand', audience: { kind: 'group', groups: [{ id: 'g1', name: 'Top sellers' }] }, recipients: 4, delivered: 4 },
  { id: 3, name: 'Elite creators', body_en: 'A note for our Elite tier.', body_ar: null, channel: 'whatsapp', status: 'queued', sent_at: null, sent_by: 'trndr_on_behalf', audience: { kind: 'tier', tiers: ['elite'] }, recipients: null, delivered: null },
];

function PanelLink() {
  return <div style={{ maxWidth: 680 }}><MessagesPanel contactUrl="https://wa.me/201000000000" history={{ messages: [], status: 'loading' }} /></div>;
}

Props

Prop

Type

Labels

Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key messagesPanel, or with the component's own prop where it has one. A {name} is a value the component fills in.

messagesPanel
KeyEnglishArabic
bannerMessages to creators are sent by the TRNDR team.رسايل صنّاع المحتوى بيبعتها فريق TRNDR.
bannerSubTell TRNDR what your creators should hear and they send it for you. Everything sent shows below.قول لفريق TRNDR عايز صنّاع المحتوى يعرفوا إيه وهم يبعتوها بدالك. كل اللي اتبعت بيظهر تحت.
contactContact TRNDRكلّم TRNDR
historyMessage historyسجل الرسايل
historySubWhat your creators got from TRNDR and from you.اللي وصل لصنّاع المحتوى بتوعك من TRNDR ومنك.
automaticSent automaticallyبتتبعت أوتوماتيك
automaticSubTRNDR sends these for you when something happens.TRNDR بتبعت دي بدالك لما حاجة تحصل.

Design guidance

How the BRICKS design system uses MessagesPanel. Written in docs/content/components/MessagesPanel.md; the props above are read from the code, which wins where the two disagree.

The brand's read-only Messages screen: a lock banner saying the TRNDR team sends messages to creators (with "Contact TRNDR" when there is a URL), the message history card, and an optional "Sent automatically" card.

The v3 brand mock has no Messages screen (its menu notes messages moved to the PR portal); this block was built from the live console so brands can still see what went out. It composes Banner, two Cards and MessageHistoryList.

Anatomy

  1. Banner: Banner tone="info" icon="lock": bold "Messages to creators are sent by the TRNDR team." + "Tell TRNDR what your creators should hear and they send it for you. Everything sent shows below."; action: small "Contact TRNDR" link (new tab) when contactUrl is safe.
  2. History card: Card titled "Message history", sub "What your creators got from TRNDR and from you.", holding MessageHistoryList with history props.
  3. Automatic card (optional): "Sent automatically" / "TRNDR sends these for you when something happens." + your node.

Variants

SetupWhen
contactUrl setBanner has Contact TRNDR.
contactUrl null / unsafeNo action.
automaticAdds the second card.

States

History states come from history.status (loading, error with Try again, empty, filtered empty).

Usage

<PageHeader title="Messages" subtitle="What your creators heard from TRNDR" />
<MessagesPanel contactUrl={bootstrap.contact_url} onContact={() => track('contact_trndr')}
  history={{ messages: list.rows, status: list.status, onRetry: list.reload,
    sentBy: { value: sentBy, onChange: setSentBy },
    pager: <Pager page={list.page} lastPage={list.lastPage} total={list.total} perPage={10} loading={list.status === 'loading'} label="Messages" onPage={list.setPage} /> }}
  automatic={<RowItems label="Automatic messages" items={[
    { id: 1, lead: <span><b>Welcome</b><br /><span className="kit-muted">When a creator joins your program</span></span> },
  ]} />} />

Where it appears

  • Library only: the v3 brand mock has no Messages screen (built for the live console). Missing-brand gallery.

Guidelines

Do

  • Always pass contactUrl when the API has one; it is the brand's only way to ask for a message.

Don't

  • Don't add a compose button for brands.

RTL and Arabic

  • Mirrors. Arabic: "رسايل صنّاع المحتوى بيبعتها فريق TRNDR.", "كلّم TRNDR", "سجل الرسايل", "بتتبعت أوتوماتيك".

Tokens

Through Banner (--sky, --sky-ink) and Card (--card, --line, --r-lg, --ink-3).

Accessibility

  • Cards are named regions (their titles); the contact link opens in a new tab with noopener noreferrer.

Found in the source

  • No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Banner · Card · useLanguage · Pager

Source

src/blocks/messages/MessagesPanel.tsx (line 66) on GitHub.

On this page