// @ts-nocheck import React from 'react'; import intl from 'react-intl-universal'; import styled from 'styled-components'; import clsx from 'classnames'; import { Intent, MenuItem, Menu } from '@blueprintjs/core'; import { safeCallback } from '@/utils'; import { CLASSES } from '@/constants/classes'; import { Icon } from '@/components'; /** * Actions menu. */ export function ActionsMenu({ row: { original }, payload: { onDelete } }) { return ( } text={intl.get('delete_transaction')} intent={Intent.DANGER} onClick={safeCallback(onDelete, original)} /> ); } /** * From transaction table cell. */ export function FromTransactionCell({ row: { original }, payload: { onFromTranscationClick }, }) { // Handle the link click const handleAnchorClick = () => { onFromTranscationClick && onFromTranscationClick(original); }; return ( {original.from_transaction_type} → {original.from_transaction_id} ); } /** * Name accessor. */ export const NameAccessor = (row) => { return ( {row.name} {row.description} ); }; /** * Retrieve bill located landed cost table columns. */ export function useLocatedLandedCostColumns() { return React.useMemo( () => [ { Header: intl.get('name'), accessor: NameAccessor, width: 150, textOverview: true, }, { Header: intl.get('amount'), accessor: 'formatted_amount', width: 100, align: 'right', textOverview: true, className: clsx(CLASSES.FONT_BOLD), }, { id: 'from_transaction', Header: intl.get('From transaction'), Cell: FromTransactionCell, width: 100, textOverview: true, }, { Header: intl.get('allocation_method'), accessor: 'allocation_method_formatted', width: 100, textOverview: true, }, ], [], ); } const LabelName = styled.div``; const LabelDescription = styled.div` font-size: 12px; margin-top: 2px; display: block; opacity: 0.75; `;