All files / src/apps/user/pages Reviews.tsx

85.13% Statements 63/74
83.46% Branches 106/127
72.41% Functions 21/29
85.71% Lines 60/70

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623                                                                                                                              2x             2x             2x       2x   2x 40x             2x 41x 41x 41x                                                     2x         39x 39x 39x   39x                                                                                                                                     4x                 1x                                                                                                                                                                                     2x           61x 2x 61x   61x                                   1x                                   2x 83x 83x 83x       83x     83x 83x   83x       83x     83x 83x 23x 1x     23x         83x   83x     27x                           83x 83x     83x   23x     83x   83x                       3x                 3x 3x 3x 3x 3x     3x             83x   83x                                                                                         3x                                                                           1x                                                                                                         39x                         39x       5x                                                        
import {
  FilterSelect,
  ResourceCollection,
  SegmentedFilter,
  useCollectionFilters,
} from "@/components/collection";
import {
  ConfirmDialog,
  encodeResourceId,
  REVIEW_STATUS,
  StatusBadge,
  Strong,
} from "@/components/detail";
import {
  ReviewDecision,
  ReviewFlag,
  ReviewFlagList,
  ReviewKind,
  ReviewSummary,
} from "@/objects/Review";
import { APP_ROUTES, ROUTE_PARAMS } from "@/routes/const";
import { decisionHref } from "@/routes/resourceHref";
import { QUERY_KEYS } from "@/services/query_keys";
import { useApiHandler } from "@/services/useApiHandler";
import { errorDetail } from "@/util/apiError";
import {
  keepPreviousData,
  useMutation,
  useQuery,
  useQueryClient,
} from "@tanstack/react-query";
import {
  Check,
  ChevronLeft,
  ChevronRight,
  Bot,
  EyeOff,
  MessageSquare,
  ScanSearch,
  ScrollText,
  ShieldAlert,
  TrendingDown,
  X,
} from "lucide-react";
import React, { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import toast from "react-hot-toast";
import { parseServerDate } from "@/util/time";
 
/**
 * The governance review queue.
 *
 * Everything that needs a person's decision: an audit rule's
 * `flag_for_review`, and an evaluation run that regressed against its last
 * comparable run. Resolution is terminal —
 * there is no reopen — so a decision is confirmed rather than one click away,
 * and the note a reviewer leaves is the part an audit actually reads.
 *
 * Filtering, searching and paging all happen on the server. A queue is a
 * backlog: filtering the fifty rows the browser happens to hold would answer
 * "is it on this page" while looking like it answered "is it in the queue".
 */
 
const KIND_OPTIONS = [
  { value: "all", label: "Any kind" },
  { value: "rule", label: "Rule flags" },
  { value: "regression", label: "Regressions" },
  { value: "withheld", label: "Withheld answers" },
];
 
const STATUS_OPTIONS = [
  { value: "all", label: "Any status" },
  { value: "pending", label: "Pending" },
  { value: "reviewed", label: "Reviewed" },
  { value: "dismissed", label: "Dismissed" },
];
 
const PAGE_SIZE = 25;
 
/** Long enough that typing does not fire a request per keystroke, short
 *  enough that the list does not feel detached from the box. */
const SEARCH_DEBOUNCE_MS = 300;
 
const formatWhen = (value?: string | null): string =>
  value ? parseServerDate(value).toLocaleString() : "—";
 
// ─── Row ──────────────────────────────────────────────────────────────────────
 
/** A question or an excerpt can run to 2000 characters. Clamped by default
 *  so a queue of flags stays scannable, and openable because the text is the
 *  evidence. */
const Quoted: React.FC<{ label?: string; text: string }> = ({ label, text }) => {
  const [expanded, setExpanded] = useState(false);
  const long = text.length > 280;
  return (
    <div>
      {label && (
        <p className="mb-1 text-[11px] font-medium uppercase tracking-wide text-gray-400 dark:text-gray-500">
          {label}
        </p>
      )}
      <p
        className={`text-xs text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-900/40 rounded-lg p-3 whitespace-pre-wrap ${
          expanded ? "" : "line-clamp-3"
        }`}
      >
        {text}
      </p>
      {long && (
        <button
          type="button"
          onClick={() => setExpanded((open) => !open)}
          className="mt-1 text-[11px] text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors"
        >
          {expanded ? "Show less" : "Show it all"}
        </button>
      )}
    </div>
  );
};
 
const FlagRow: React.FC<{
  flag: ReviewFlag;
  onResolve: (flag: ReviewFlag, decision: ReviewDecision) => void;
  busy: boolean;
}> = ({ flag, onResolve, busy }) => {
  const pending = flag.status === "pending";
  const regression = flag.kind === "regression";
  const withheld = flag.kind === "withheld";
 
  return (
    <div className="rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 p-4 space-y-3">
      <div className="flex items-start justify-between gap-3">
        <div className="min-w-0">
          <div className="flex items-center gap-2 flex-wrap">
            {regression ? (
              <TrendingDown className="size-4 text-rose-500 shrink-0" />
            ) : withheld ? (
              <EyeOff className="size-4 text-gray-500 dark:text-gray-400 shrink-0" />
            ) : (
              <ShieldAlert className="size-4 text-amber-500 shrink-0" />
            )}
            {/* What raised it is the thing a reviewer wants next, so it is the
                link: the regressed run's evaluation, or the rule — but only
                when the rule still exists. */}
            {regression ? (
              flag.experiment_id ? (
                <Link
                  to={APP_ROUTES.USER.GOVERNANCE.EVALUATION.EXPERIMENTS.id.replace(
                    ROUTE_PARAMS.EXPERIMENT.id,
                    encodeResourceId(flag.experiment_id),
                  )}
                  className="text-sm font-semibold text-gray-900 dark:text-white truncate hover:underline"
                >
                  Evaluation regressed
                </Link>
              ) : (
                <span className="text-sm font-semibold text-gray-900 dark:text-white">
                  Evaluation regressed
                </span>
              )
            ) : flag.rule_id ? (
              <Link
                to={APP_ROUTES.USER.GOVERNANCE.RULES.id.replace(
                  ROUTE_PARAMS.RULE.id,
                  encodeResourceId(flag.rule_id),
                )}
                className="text-sm font-semibold text-gray-900 dark:text-white truncate hover:underline"
              >
                {flag.rule_name ?? "Untitled rule"}
              </Link>
            ) : (
              <span className="text-sm font-semibold text-gray-500 dark:text-gray-400 truncate italic">
                {flag.rule_name ?? "Deleted rule"}
              </span>
            )}
            {/* The revision that fired, not the rule's current one: a rule can
                be edited after the fact, and the flag has to stay answerable. */}
            {flag.rule_version != null && (
              <span className="text-[10px] font-mono text-gray-400 dark:text-gray-500">
                v{flag.rule_version}
              </span>
            )}
            <StatusBadge status={flag.status} scale={REVIEW_STATUS} size="xs" />
          </div>
          <p className="mt-1 text-xs text-gray-500 dark:text-gray-400">
            {formatWhen(flag.created_at)}
            {flag.reviewer ? ` · for ${flag.reviewer}` : ""}
            {flag.execution_type ? ` · ${flag.execution_type}` : ""}
          </p>
        </div>
 
        {pending && (
          <div className="flex items-center gap-2 shrink-0">
            <button
              type="button"
              disabled={busy}
              onClick={() => onResolve(flag, "reviewed")}
              className="flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-green-200 dark:border-green-800 text-xs text-green-700 dark:text-green-300 hover:bg-green-50 dark:hover:bg-green-950/30 transition-colors disabled:opacity-50"
            >
              <Check className="size-3.5" />
              Reviewed
            </button>
            <button
              type="button"
              disabled={busy}
              onClick={() => onResolve(flag, "dismissed")}
              className="flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-gray-200 dark:border-gray-600 text-xs text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors disabled:opacity-50"
            >
              <X className="size-3.5" />
              Dismiss
            </button>
          </div>
        )}
      </div>
 
      {/* A flagged answer is judged against what it was asked. Both are
          labelled once the question is known; a regression's excerpt (what
          moved) and an older flag's stand alone, as before. */}
      {flag.question && <Quoted label="Question" text={flag.question} />}
      {flag.excerpt && (
        <Quoted label={flag.question ? "Answer" : undefined} text={flag.excerpt} />
      )}
      {/* The one place a withheld answer is kept: the person who asked was
          shown the rule's message instead. */}
      {withheld && flag.withheld_text && (
        <Quoted label="Withheld answer" text={flag.withheld_text} />
      )}
      {withheld && (
        <p className="text-xs text-gray-500 dark:text-gray-400">
          Withheld by this rule: the person who asked was shown its message
          instead. This queue is the only place the answer is kept.
        </p>
      )}
 
      <div className="flex items-center gap-3 flex-wrap text-xs">
        {/* Conversations have no by-id route — they are reached through the
            agent's chat — so the flag links to the agent that produced it.
            Encoded with the detail kit's helper, never a bare btoa. */}
        {/* A regression is about the agent, not a conversation — so it opens
            the agent, where its history shows what changed. */}
        {flag.agent_id && (
          <Link
            to={(regression
              ? APP_ROUTES.USER.INFERENCE.AGENTS.id
              : APP_ROUTES.USER.INFERENCE.AGENTS.chat
            ).replace(ROUTE_PARAMS.AGENT.id, encodeResourceId(flag.agent_id))}
            className="inline-flex items-center gap-1.5 text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors"
          >
            {regression ? (
              <Bot className="size-3.5" />
            ) : (
              <MessageSquare className="size-3.5" />
            )}
            {regression ? "Open the agent" : "Open agent chat"}
          </Link>
        )}
        {/* Everything behind the flagged answer: what was asked, the rules,
            checks and calls. Opening it as a reviewer is logged, and its
            owner sees that. */}
        {decisionHref(flag.invocation_id) && (
          <Link
            to={decisionHref(flag.invocation_id)!}
            title="Your read is logged, and the answer's owner can see it"
            className="inline-flex items-center gap-1.5 text-gray-500 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors"
          >
            <ScanSearch className="size-3.5" />
            Why did it do this?
          </Link>
        )}
        {!pending && (
          <span className="inline-flex items-center gap-1.5 text-gray-400 dark:text-gray-500">
            <ScrollText className="size-3.5 shrink-0" />
            {flag.status === "reviewed" ? "Reviewed" : "Dismissed"}{" "}
            {formatWhen(flag.reviewed_at)}
            {flag.reviewer_note ? ` — “${flag.reviewer_note}”` : ""}
          </span>
        )}
        {flag.expires_at && (
          <span className="text-gray-400 dark:text-gray-500">
            Retained until {formatWhen(flag.expires_at)}
          </span>
        )}
      </div>
    </div>
  );
};
 
// ─── Paging ───────────────────────────────────────────────────────────────────
 
/**
 * Server-side paging over the queue.
 *
 * Local to this page on purpose: it is the first collection with a backlog big
 * enough to need it, and `components/collection` extracts a piece once a
 * second page wants it.
 */
const Pager: React.FC<{
  offset: number;
  count: number;
  total: number;
  onOffset: (offset: number) => void;
}> = ({ offset, count, total, onOffset }) => {
  if (total <= PAGE_SIZE) return null;
  const first = total === 0 ? 0 : offset + 1;
  const last = offset + count;
 
  return (
    <div className="flex items-center justify-between gap-3 pt-1">
      <span className="text-xs text-gray-500 dark:text-gray-400 tabular-nums">
        {first}–{last} of {total}
      </span>
      <div className="flex items-center gap-2">
        <button
          type="button"
          disabled={offset === 0}
          onClick={() => onOffset(Math.max(0, offset - PAGE_SIZE))}
          className="flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-gray-200 dark:border-gray-600 text-xs text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors disabled:opacity-40"
        >
          <ChevronLeft className="size-3.5" />
          Previous
        </button>
        <button
          type="button"
          disabled={last >= total}
          onClick={() => onOffset(offset + PAGE_SIZE)}
          className="flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-gray-200 dark:border-gray-600 text-xs text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors disabled:opacity-40"
        >
          Next
          <ChevronRight className="size-3.5" />
        </button>
      </div>
    </div>
  );
};
 
// ─── Reviews content (Governance → Rules → Reviews) ──────────────────────────
//
// The queue lives under Governance beside the rules that fill it: a flag is
// the output of an audit rule, and working one is the other half of writing
// one. It used to sit in the top-level "home" nav, one click from Activity and
// several from the rule that raised it.
 
export const ReviewsContent: React.FC = () => {
  const { getApiHandler } = useApiHandler();
  const queryClient = useQueryClient();
  const [pending, setPending] = useState<{
    flag: ReviewFlag;
    decision: ReviewDecision;
  } | null>(null);
  const [note, setNote] = useState("");
  // The reviewer's verdict on the flagged answer itself — the flag can be
  // warranted and the answer still right.
  const [verdict, setVerdict] = useState<"none" | "accepted" | "rejected">("none");
  const [offset, setOffset] = useState(0);
 
  const collection = useCollectionFilters<{ status: string; kind: string }>({
    defaults: { status: "pending", kind: "all" },
    view: "list",
  });
  const { filters, setFilter } = collection;
 
  // Debounced so the queue is not re-queried on every keystroke.
  const [term, setTerm] = useState("");
  useEffect(() => {
    const id = setTimeout(
      () => setTerm(collection.search.trim()),
      SEARCH_DEBOUNCE_MS,
    );
    return () => clearTimeout(id);
  }, [collection.search]);
 
  // Any change to what is being asked for starts at the first page; staying on
  // page 4 of a different filter shows an empty list that looks like no results.
  useEffect(() => setOffset(0), [term, filters.status, filters.kind]);
 
  const { data: queueData, isLoading } = useQuery<ReviewFlagList | null>({
    queryKey: [QUERY_KEYS.GET.REVIEWS, filters.status, filters.kind, term, offset],
    queryFn: () =>
      getApiHandler().review_router.list({
        ...(filters.status === "all"
          ? {}
          : { status: filters.status as ReviewFlag["status"] }),
        ...(filters.kind === "all" ? {} : { kind: filters.kind as ReviewKind }),
        ...(term ? { q: term } : {}),
        limit: PAGE_SIZE,
        offset,
      }),
    // The previous page stays on screen while the next one loads, so paging
    // and filtering do not flash a skeleton over a list the reader is using.
    placeholderData: keepPreviousData,
    staleTime: 30_000,
  });
  const flags: ReviewFlag[] = queueData?.flags ?? [];
  const total = queueData?.total ?? 0;
 
  const { data: summaryData, isLoading: summaryLoading } =
    useQuery<ReviewSummary | null>({
      queryKey: [QUERY_KEYS.GET.REVIEWS_SUMMARY],
      queryFn: () => getApiHandler().review_router.summary(),
      staleTime: 30_000,
    });
  const summary: ReviewSummary | null = summaryData ?? null;
 
  const resolve = useMutation({
    mutationFn: ({
      id,
      decision,
      reviewerNote,
      answerVerdict,
    }: {
      id: string;
      decision: ReviewDecision;
      reviewerNote?: string;
      answerVerdict?: "accepted" | "rejected";
    }) =>
      answerVerdict
        ? getApiHandler().review_router.resolve(
            id,
            decision,
            reviewerNote,
            answerVerdict,
          )
        : getApiHandler().review_router.resolve(id, decision, reviewerNote),
    onSuccess: (_result, { decision }) => {
      toast.success(decision === "reviewed" ? "Marked reviewed" : "Dismissed");
      setPending(null);
      setNote("");
      setVerdict("none");
      void queryClient.invalidateQueries({
        queryKey: [QUERY_KEYS.GET.REVIEWS],
      });
      void queryClient.invalidateQueries({
        queryKey: [QUERY_KEYS.GET.REVIEWS_SUMMARY],
      });
    },
  });
 
  const filtered =
    !!term || filters.status !== "pending" || filters.kind !== "all";
 
  return (
    <div>
      <p className="text-sm text-gray-500 dark:text-gray-400 mb-5">
        Invocations an audit rule asked a person to look at. A decision here is
        a record, not a setting — once a flag is reviewed or dismissed it
        cannot be reopened.
      </p>
      {pending && (
        <ConfirmDialog
          icon={pending.decision === "reviewed" ? Check : X}
          title={
            pending.decision === "reviewed" ? "Mark reviewed" : "Dismiss flag"
          }
          body={
            <>
              Record that{" "}
              <Strong>
                {pending.flag.kind === "regression"
                  ? "this regression"
                  : (pending.flag.rule_name ?? "this flag")}
              </Strong> was{" "}
              {pending.decision === "reviewed" ? "reviewed" : "dismissed"}. This
              cannot be undone — there is no reopen.
            </>
          }
          // Not destructive-red: recording a decision is the job, not a
          // deletion. The warning is in the words.
          destructive={false}
          // Distinct from the row's own "Dismiss": one opens this dialog and
          // one commits an irreversible decision, and a reader — or a screen
          // reader — should not have to infer which from position alone.
          confirmLabel={
            pending.decision === "reviewed" ? "Mark reviewed" : "Dismiss flag"
          }
          loadingLabel="Recording…"
          loading={resolve.isPending}
          error={
            resolve.isError
              ? errorDetail(
                  resolve.error,
                  "Could not record that decision. It may already be resolved.",
                )
              : null
          }
          onConfirm={() =>
            resolve.mutate({
              id: pending.flag.id,
              decision: pending.decision,
              reviewerNote: note.trim() || undefined,
              answerVerdict: verdict === "none" ? undefined : verdict,
            })
          }
          onCancel={() => {
            setPending(null);
            setNote("");
            setVerdict("none");
            resolve.reset();
          }}
        >
          {pending.flag.kind !== "regression" && pending.flag.invocation_id && (
            <div className="mb-3">
              <span className="block mb-1 text-xs text-gray-500 dark:text-gray-400">
                And the answer itself?
              </span>
              <SegmentedFilter<"none" | "accepted" | "rejected">
                value={verdict}
                onChange={setVerdict}
                options={[
                  { value: "none", label: "No verdict" },
                  { value: "accepted", label: "It was right" },
                  { value: "rejected", label: "It was wrong" },
                ]}
              />
            </div>
          )}
          <label className="block">
            <span className="text-xs text-gray-500 dark:text-gray-400">
              Note (optional) — this is what an audit reads
            </span>
            <textarea
              rows={3}
              autoFocus
              value={note}
              onChange={(e) => setNote(e.target.value)}
              placeholder="Why this decision?"
              className="mt-1 w-full rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-gray-400"
            />
          </label>
        </ConfirmDialog>
      )}
 
      <ResourceCollection<ReviewFlag>
        stats={[
          {
            label: "Pending",
            value: summary?.pending ?? 0,
            loading: summaryLoading,
          },
          {
            label: "Reviewed",
            value: summary?.reviewed ?? 0,
            loading: summaryLoading,
          },
          {
            label: "Dismissed",
            value: summary?.dismissed ?? 0,
            loading: summaryLoading,
          },
        ]}
        shown={filtered ? total : undefined}
        filtered={filtered}
        search={{
          value: collection.search,
          onChange: collection.setSearch,
          placeholder: "Search rule, reviewer or excerpt…",
        }}
        filters={
          <>
            <FilterSelect
              value={filters.status}
              onValueChange={(value) => setFilter("status", value)}
              placeholder="Any status"
              options={STATUS_OPTIONS}
              active={filters.status !== "pending"}
            />
            <FilterSelect
              value={filters.kind}
              onValueChange={(value) => setFilter("kind", value)}
              placeholder="Any kind"
              options={KIND_OPTIONS}
              active={filters.kind !== "all"}
            />
          </>
        }
        {...collection.toolbarProps}
        items={flags}
        itemKey={(flag) => flag.id}
        loading={isLoading}
        skeletonCount={3}
        renderCard={(flag) => (
          <FlagRow
            flag={flag}
            busy={resolve.isPending && pending?.flag.id === flag.id}
            onResolve={(target, decision) =>
              setPending({ flag: target, decision })
            }
          />
        )}
        renderRow={(flag) => (
          <FlagRow
            flag={flag}
            busy={resolve.isPending && pending?.flag.id === flag.id}
            onResolve={(target, decision) =>
              setPending({ flag: target, decision })
            }
          />
        )}
        empty={{
          Icon: ShieldAlert,
          title:
            filters.status === "pending" && !term
              ? "Nothing awaiting review"
              : "No flags match",
          hint:
            filters.status === "pending" && !term
              ? "Audit rules with a flag_for_review action send invocations here, and so does an evaluation run that regresses."
              : "Try a different status, or clear the search.",
        }}
      />
 
      <Pager
        offset={offset}
        count={flags.length}
        total={total}
        onOffset={setOffset}
      />
    </div>
  );
};
 
export default ReviewsContent;