File size: 2,497 Bytes
e94832e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/** The actor queue: address clusters joined to the peer identities the
 *  evidence links them to (fusion/actors.py). An actor's name is a handle for
 *  that group; it never implies a person or an organisation. */
import { Link } from "react-router-dom";
import type { Actor } from "../api/types";
import { formatId } from "../lib/format";
import { Chip, RiskChip } from "./ui";

export const ACTOR_STATEMENT =
  "An actor is a group of addresses and network identities linked by evidence; it does not name or imply a person or an organisation.";

export function ActorQueue({ actors }: { actors: Actor[] }) {
  return (
    <div className="table-wrap">
    <table className="data" aria-label="Actor queue">
      <thead>
        <tr>
          <th>Actor</th>
          <th className="num">Risk</th>
          <th className="num">Membership confidence</th>
          <th>Member clusters</th>
          <th>Linked peers</th>
          <th>Origin tiers</th>
        </tr>
      </thead>
      <tbody>
        {actors.map((a) => (
          <tr key={a.actor_id}>
            <td>
              <Link to={`/actors/${encodeURIComponent(a.actor_id)}`}>{a.name}</Link>
            </td>
            <td className="num">
              {a.risk_score.toFixed(3)} <RiskChip score={a.risk_score} />
            </td>
            <td className="num">{a.membership_confidence.toFixed(2)}</td>
            <td>
              {a.members.slice(0, 3).map((m) => (
                <Link key={m} className="mono" to={`/entities/${encodeURIComponent(m)}`}>
                  {formatId(m)}{" "}
                </Link>
              ))}
              {a.members.length > 3 && <span className="soft">+{a.members.length - 3}</span>}
            </td>
            <td>
              {a.links.slice(0, 3).map((l) => (
                <Chip key={`${l.peer}-${l.cluster_id}`} title={l.evidence_chain}>
                  <Link to={`/peers/${encodeURIComponent(l.peer)}`}>{l.peer}</Link> · {l.basis} ·{" "}
                  {l.confidence.toFixed(2)}
                  {l.joins ? "" : " · attached, not joining"}
                </Chip>
              ))}
              {a.links.length === 0 && <span className="soft">none</span>}
              {a.links.length > 3 && <span className="soft"> +{a.links.length - 3}</span>}
            </td>
            <td>{a.origin_tiers.length ? a.origin_tiers.join(", ") : <span className="soft">—</span>}</td>
          </tr>
        ))}
      </tbody>
    </table>
    </div>
  );
}