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 | 72x 3x 3x 3x 1x | import { useGetItem, useGetPackageActions } from "@/api";
import { LoadingSpinner } from "@/components";
import { WAIVER_SUBMISSION_ORIGIN, DETAILS_ORIGIN, ORIGIN, mapActionLabel } from "@/utils";
import { DetailCardWrapper } from "..";
import { FC } from "react";
import { Link, useLocation } from "react-router";
export const PackageActionsCard: FC<{ id: string }> = ({ id }) => {
const location = useLocation();
const item = useGetItem(id);
const { data, isLoading } = useGetPackageActions(id, {
retry: false,
});
if (isLoading) return <LoadingSpinner />;
Eif (!data?.actions?.length) {
return (
<DetailCardWrapper title={"Package Actions"}>
<div className="my-3">
<em className="text-gray-400 my-3">
No actions are currently available for this submission.
</em>
</div>
</DetailCardWrapper>
);
}
return (
<DetailCardWrapper title={"Package Actions"}>
<div className="my-3">
<ul className="my-3">
{data.actions.map((type, idx) => (
<Link
key={`${idx}-${type}`}
state={{
from: `${location.pathname}${location.search}`,
}}
to={{
pathname: `/actions/${type}/${item.data?._source.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"
>
<li>{mapActionLabel(type)}</li>
</Link>
))}
</ul>
</div>
</DetailCardWrapper>
);
};
|