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 | 72x 147x 5486x 1797x 72x 1213x 72x 23x 866x 865x | import { EllipsisVerticalIcon } from "@heroicons/react/24/outline"; import { Authority, CognitoUserAttributes, opensearch } from "shared-types"; import { getAvailableActions, formatSeatoolDate } from "shared-utils"; import { Link } from "react-router"; import * as POP from "@/components"; import { cn, DASHBOARD_ORIGIN, mapActionLabel, ORIGIN } from "@/utils"; export const renderCellDate = (key: keyof opensearch.main.Document) => function Cell(data: opensearch.main.Document) { if (!data[key]) return null; return formatSeatoolDate(data[key] as string); }; export type CellIdLinkProps = { id: string; authority: Authority | string; }; export const CellDetailsLink = ({ id, authority }: CellIdLinkProps) => ( <Link className="cursor-pointer text-blue-600" to={`/details/${encodeURIComponent(authority)}/${encodeURIComponent(id)}`} > {id} </Link> ); export const renderCellActions = (user: CognitoUserAttributes | null) => { return function Cell(data: opensearch.main.Document) { if (!user) return null; const actions = getAvailableActions(user, data); return ( <POP.Popover> <POP.PopoverTrigger disabled={!actions.length} className="block ml-3" aria-label="Available actions" > <EllipsisVerticalIcon aria-label="record actions" className={cn("w-8 ", actions.length ? "text-blue-700" : "text-gray-400")} /> </POP.PopoverTrigger> <POP.PopoverContent> <div className="flex flex-col"> {actions.map((action, idx) => ( <Link state={{ from: `${location.pathname}${location.search}`, }} to={{ pathname: `/actions/${action}/${data.authority}/${data.id}`, search: new URLSearchParams({ [ORIGIN]: DASHBOARD_ORIGIN, }).toString(), }} key={`${idx}-${action}`} className={cn( "text-blue-500", "relative flex select-none items-center rounded-sm px-2 py-2 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", )} > {mapActionLabel(action)} </Link> ))} </div> </POP.PopoverContent> </POP.Popover> ); }; }; |