> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.pgecom.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 08- Trade Chat

# Trade Chat & Communication

Every trade has a built-in real-time chat so you can communicate directly with the other party. This guide covers messaging, image sharing, templates, and live translation.

---

## Using the Trade Chat

The chat sidebar appears on the **right side** of every trade detail page.

- Messages are delivered in **real-time** — no need to refresh.
- Both the buyer and seller can send messages.
- The chat header shows both participants' first names.
- A **typing indicator** (bouncing dots) appears when the other person is typing.

---

## Sending Messages

1. Go to the trade detail page (**Dashboard > Trades**, then click a trade).
2. Type your message in the text area at the bottom of the chat.
3. Press **Enter** to send (or click the send button).
4. Press **Shift + Enter** to add a new line without sending.

- Character limit: **5,000 characters** per message.
- A counter appears when you approach the limit.

### @Mentioning Participants

You can mention the other party in your message to draw their attention:

1. Type **@** in the message box.
2. A dropdown menu appears showing available participants (buyer/seller).
3. Continue typing to filter by name, or use **Arrow keys** to navigate.
4. Press **Enter** or click a name to insert the mention.
5. The mention appears as `@Name` in your message.

**Keyboard Shortcuts:**
- **Arrow Up/Down** — Navigate through mention suggestions
- **Enter** — Select the highlighted participant
- **Escape** — Close the mention menu

---

## Sending Images

1. Click the **Attach** button below the message input.
2. Select an image file from your device.
3. Supported formats: JPEG, PNG, WebP, GIF (max 10MB).
4. The image is automatically optimized and uploaded.
5. It appears inline in the chat conversation.
6. Click any image in the chat to **view it full size** in a new tab.

---

## Message Templates

Templates let you save frequently used messages for quick access.

### Creating a Template

1. Click **Templates** below the message input.
2. Click **Create new template** at the bottom of the dropdown.
3. Enter a **template name** (e.g., "Payment Reminder").
4. Enter the **message content**.
5. Click **Create Template**.

### Using a Template

1. Click **Templates**.
2. Browse or **search** your templates by name or content.
3. Click a template to load it into the message input.
4. Edit if needed, then send.

### Saving Current Message as Template

1. Type a message in the chat input.
2. Instead of sending it, click **Templates** to save it as a reusable template.

### Deleting a Template

1. Click **Templates**.
2. Click the **trash icon** next to the template you want to remove.

---

## Live Translation

The chat supports automatic translation between English, Spanish, French, and Haitian Creole.

### Enabling Translation

1. Click the **Translate** button below the message input.
2. The button turns **blue** when translation is active.
3. Messages you send are automatically translated into all supported languages.
4. Messages you receive appear in your preferred language.

### Disabling Translation

1. Click the **Translate** button again.
2. The button returns to its default state.
3. Messages are sent without translation.

### Viewing Original vs Translated Text

When you receive a translated message:

1. A **"Show Original"** button appears on the message.
2. Click it to see the message in its original language.
3. Click **"Show Translation"** to switch back.
4. A label shows which language the message was translated from (e.g., "Translated from French").

> **Tip**: Your translation preference is saved automatically. It persists across page refreshes and sessions.

---

## Chat Disabled States

Chat becomes **read-only** in certain situations:

| Situation | Message Shown |
|-----------|--------------|
| Trade is **completed** | "This trade has been completed. Chat is now disabled." |
| Dispute is **resolved** | "This dispute has been resolved. Chat is now disabled." |
| You are a **viewer** (monitoring role) | "You are viewing this trade as a monitoring role. Chat is read-only." |

In these states, you can still read all previous messages but cannot send new ones.

---

## Blocking and Unblocking Users

If you want to prevent someone from trading with you in the future:

### Blocking a User

1. On the trade detail page, expand the **Participants** section.
2. Find the other party (buyer or seller).
3. Click **Block**.
4. Enter a **reason** for blocking (for your records only — not shown to them).
5. Confirm.

Blocked users:
- Cannot see your trade offers.
- Cannot place trades on your offers.
- Cannot interact with your listings.

### Unblocking a User

1. On the trade detail page, expand the **Participants** section.
2. Click **Unblock** next to the blocked user.
3. They regain the ability to see and trade on your offers.

---

## Admin Messages

Escrow administrators can send messages in the trade chat during disputes.

- Admin messages appear in **purple** with a **shield icon**.
- They are labeled **"Escrow Admin"**.
- Admin messages cannot be translated.

---

## Read Receipts

- When the other party reads your message, a **"Read"** indicator appears next to the timestamp.
- This helps you know your messages have been seen.

---

## Trade Comments & Tagging

In addition to real-time chat, trades have a **comments system** where you can tag participants to notify them via email.

### Posting a Comment

1. Go to the trade detail page.
2. Scroll to the **Trade Comments** section.
3. Type your comment in the textarea (up to 2,000 characters).
4. Optionally tag participants (buyer, seller, or escrow).
5. Click **Post Comment**.

### Tagging Participants with @Mentions

You can tag other participants to send them email notifications:

**Method 1: Using @ Symbol (Autocomplete)**

1. Type **@** in the comment box.
2. A dropdown menu appears showing:
   - **Buyer** (with blue badge)
   - **Seller** (with green badge)
3. Continue typing to filter by name, or use **Arrow keys** to navigate.
4. Press **Enter** or click a name to insert the mention.
5. The participant is **automatically tagged** when you insert their mention.
6. They will receive an **email notification** when you post the comment.

**Method 2: Using Checkboxes**

1. Below the comment textarea, you'll see checkboxes for each participant.
2. Check the boxes for participants you want to tag.
3. They will receive an email notification when you post the comment.

**Keyboard Shortcuts:**
- **Arrow Up/Down** — Navigate through mention suggestions
- **Enter** — Select the highlighted participant
- **Escape** — Close the mention menu

### Email Notifications

When you tag someone in a comment:

- They receive an **email** with:
  - The comment content
  - Who tagged them
  - Trade details (amount, asset, status)
  - A link to view the trade
- The email is sent immediately when you post the comment.
- Tagged users see a visual indicator on their comment showing they were tagged.

### Comment Features

- **Auto-refresh**: Comments update every 10 seconds to show new messages.
- **Character limit**: 2,000 characters per comment.
- **Visual indicators**:
  - Tagged users see a blue background on comments where they were mentioned.
  - Role badges show who is buyer, seller, or escrow.
- **Timestamps**: Show when each comment was posted (e.g., "2 minutes ago").

### Who Can Comment?

- **Buyers** can post comments with their role shown as a blue "buyer" badge.
- **Sellers** can post comments with their role shown as a green "seller" badge.
- **Escrow admins** can post comments with their role shown as a purple "escrow" badge.

### Comment vs Chat

**Trade Comments:**
- Persistent record on the trade page
- Email notifications when users are tagged
- Best for important updates and tagging participants
- Updates every 10 seconds (polling)

**Trade Chat:**
- Real-time messaging (instant)
- SMS notifications (if configured)
- Best for quick back-and-forth conversation
- Live updates (WebSocket/Firebase)
