← Files DataARCHIVED FILE

templates/data-app/base/src/content/shared/ReportTaskLink.jsx

833 Bytes · Sep 30, 2026 · 23:19 UTC

↓ Download file

import React from "react";

import { Icon, useDataApp } from "../../data-app-public.jsx";
import "./report-task-link.css";

// Optional authored companion to an existing editable recommendation. The
// protected shell owns current saved text, permissions, and task transport.
export function ReportTaskLink({ children, ...followUp }) {
  const { mode, reportFollowUpHref } = useDataApp();
  if (mode === "edit") return null;
  let link;
  try {
    link = reportFollowUpHref(followUp);
  } catch {
    // A cleared/oversized saved recommendation or unavailable task must not
    // prevent reading the report. Leave the runtime's validation in charge.
    return null;
  }
  if (!link?.href) return null;
  return <a className="report-task-link" {...link}>
    <span>{children}</span><Icon name="arrowUpRight" size={20} />
  </a>;
}

SHA-256: 7fc3cabbab44aee60a98b22038842704f7b097d9cb417f38be58133ea4305f88