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 | 4x 22x 22x 11x | import { Link, useLocation } from "react-router"; import { opensearch } from "shared-types"; import { useGetPackageActions } from "@/api"; import { LoadingSpinner } from "@/components"; import { DETAILS_ORIGIN, mapActionLabel, ORIGIN, WAIVER_SUBMISSION_ORIGIN } from "@/utils"; type PackageActionsCardProps = { id: string; submission: opensearch.main.Document; }; export const PackageActionsCard = ({ submission, id }: PackageActionsCardProps) => { const location = useLocation(); const { data, isLoading } = useGetPackageActions(id, { retry: false, }); if (isLoading) return <LoadingSpinner />; if (!data?.actions?.length) { return ( <div className="my-3"> <em className="text-gray-400 my-3"> No actions are currently available for this submission. </em> </div> ); } return ( <div className="my-3 sm:text-nowrap sm:min-w-min"> <ul className="my-3"> {data.actions.map((type, idx) => ( <li className="py-2"> <Link key={`${idx}-${type}`} state={{ from: `${location.pathname}${location.search}`, }} to={{ pathname: `/actions/${type}/${submission.authority}/${id}`, search: new URLSearchParams({ [ORIGIN]: type === "amend-waiver" || type === "temporary-extension" ? WAIVER_SUBMISSION_ORIGIN : DETAILS_ORIGIN, }).toString(), }} className="text-sky-700 font-semibold text-lg hover:underline hover:decoration-inherit" > {mapActionLabel(type)} </Link> </li> ))} </ul> </div> ); }; |