# Conflict Status

Where an opportunity's conflict check stands: the shield in its colour and its reading, then the Firm Pilot mark. With an assessment the mark is brand and opens it; without one it's grey and asks Firm Pilot to run the check.

- Beta: ready to use; its API can still change in a minor release.
- Category: Patterns · Firm Pilot

```tsx
import { ConflictStatus, ConflictAssessmentCard } from "@leap-crm/design-system";
```

## Best practices

- Do: Pass `assessment` once Firm Pilot has assessed the opportunity, so the brand mark opens its verdict, the lawyer's determination and its reasoning.
- Do: Pass `onRequestCheck` while there is no assessment yet, so the grey mark asks Firm Pilot to run the check. With neither, the mark only shows.
- Do: Write `determination` as what the lawyer has to decide. The card adds “Requires lawyer determination:” and puts it above the reasoning, so the decision is read first.
- Do: Set `floating={false}` on a `ConflictAssessmentCard` placed inside a surface that already has a border and shadow, like a popover or panel, so it doesn't draw a second one.
- Don't: Show a conflict state with a coloured dot or a tinted row. Use `ConflictStatus`: each state has its own shield symbol and words, so it never rests on colour alone.

## Keyboard

| Keys | What they do |
| --- | --- |
| Enter, Space | Opens the popover from its button. |
| Escape | Closes the popover and returns focus to the button. |

## Related

- [Popover](./popover.md)
- [Firm Pilot Mark](./firm-pilot-mark.md)
- [Status Mark](./status-mark.md)
- [Pilot](./pilot.md)

## Examples

What the examples import:

```tsx
import { ConflictAssessmentCard, ConflictStatus, type ConflictAssessment, type ConflictCheckState } from "@leap-crm/design-system";
```

Scaffolding the examples call. It lives in the docs page, not in the library:

```tsx
const states: ConflictCheckState[] = [
  "required",
  "passed",
  "at-risk",
  "detected",
];

const assessment: ConflictAssessment = {
  outcome: "clear",
  age: "22 hours ago",
  determination:
    "Jane Doe is the Other Side on Children for Toby Cumming and Property & Children for Rohan McAdam, both enquiries, matched on name alone.",
  summary:
    "Jane Doe is the Other Side on two enquiries and matched on name alone, with no identifier corroborating the match.\n\n22 other people share only part of the name, matched at low confidence. None is recorded with a corroborating identifier.\n\nCoverage complete.",
};
```

### States

Required in amber, passed in success, at risk in warning, detected in error, each with its own shield symbol so the state never rests on colour alone. Left: no assessment yet, so the grey mark asks Firm Pilot to check. Right: the brand mark opens the assessment.

```tsx
<div className="grid grid-cols-[auto_auto] gap-x-12 gap-y-3">
  {states.map(state => (
    <div key={state} className="contents">
      <ConflictStatus state={state} onRequestCheck={() => undefined} />
      <ConflictStatus state={state} assessment={assessment} />
    </div>
  ))}
</div>
```

### Assessment card

Firm Pilot's verdict and age, then what the lawyer has to decide, led in the Firm Pilot gold, then its reasoning with its paragraphs kept.

```tsx
<ConflictAssessmentCard {...assessment} />
```

## Props

### ConflictStatus

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `state` (required) | `"required" \| "passed" \| "at-risk" \| "detected"` |  | Where the check stands: required, passed, at risk or detected. |
| `label` | `string` |  | Overrides the state's own label. |
| `assessment` | `{ /** What Firm Pilot concluded: clear, matches found or conflicts detected. */ outcome: ConflictAssessmentOutcome; /** Firm Pilot's reasoning; its paragraphs are kept. */ summary: string; /** What the lawyer has to decide, led by "Requires lawyer determination:". */ determination?: string \| null; /** When it was assessed, like "22 hours ago". */ age?: ReactNode; }` |  | Firm Pilot's latest assessment: the mark turns brand and opens it. |
| `onRequestCheck` | `() => void` |  | With no assessment, pressing the grey mark asks Firm Pilot to run the check. |

### ConflictAssessmentCard

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `outcome` (required) | `\| "clear" \| "matches_found" \| "conflicts_detected"` |  | What Firm Pilot concluded: clear, matches found or conflicts detected. |
| `summary` (required) | `string` |  | Firm Pilot's reasoning; its paragraphs are kept. |
| `determination` | `string \| null` |  | What the lawyer has to decide, led by "Requires lawyer determination:". |
| `age` | `ReactNode` |  | When it was assessed, like "22 hours ago". |
| `floating` | `boolean` | `true` | Its own floating surface. Off inside a popover, which brings one. |
