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 | 21x 23x 23x 23x 19x 4x 4x | import type React from "react";
import { useTranslation } from "react-i18next";
import type { Receipt } from "~app/trpc-types";
import { Icon } from "~components/icons";
import { ButtonLink } from "~components/link";
type Props = {
receipt: Receipt;
};
export const ReceiptGuestControlButton: React.FC<Props> = ({ receipt }) => {
const { t } = useTranslation("receipts");
Iif (receipt.debts.direction === "outcoming") {
throw new Error("Unexpected guest control button with outcoming debt");
}
if (!receipt.debts.id) {
return null;
}
const commonProps = {
children: <Icon name="money" className="size-6" />,
title: t("receipt.controlButton.incomingDebt"),
variant: "bordered",
color: "primary",
isIconOnly: true,
} as const;
return receipt.debts.hasMine ? (
<ButtonLink
to="/debts/$id"
hash={receipt.debts.id}
params={{ id: receipt.debts.id }}
{...commonProps}
/>
) : (
<ButtonLink to="/debts/intentions" {...commonProps} />
);
};
|