diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx index b0173b5d3..d8840eeac 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/reserves/details/DetailPage.tsx @@ -36,11 +36,12 @@ import { InputDate } from "../../../../components/form/InputDate.js"; import { TextField } from "../../../../components/form/TextField.js"; import { SimpleModal } from "../../../../components/modal/index.js"; import { MerchantBackend } from "../../../../declaration.js"; -import { useTipDetails } from "../../../../hooks/reserves.js"; -import { TipInfo } from "./TipInfo.js"; +import { useRewardDetails } from "../../../../hooks/reserves.js"; +import { RewardInfo } from "./RewardInfo.js"; import { ShowAccountsOfReserveAsQRWithLink } from "../create/CreatedSuccessfully.js"; +import { datetimeFormatForSettings, useSettings } from "../../../../hooks/useSettings.js"; -type Entity = MerchantBackend.Tips.ReserveDetail; +type Entity = MerchantBackend.Rewards.ReserveDetail; type CT = MerchantBackend.ContractTerms; interface Props { @@ -116,14 +117,14 @@ export function DetailPage({ id, selected, onBack }: Props): VNode { <span class="icon"> <i class="mdi mdi-cash-register" /> </span> - <i18n.Translate>Tips</i18n.Translate> + <i18n.Translate>Rewards</i18n.Translate> </p> </header> <div class="card-content"> <div class="b-table has-pagination"> <div class="table-wrapper has-mobile-cards"> - {selected.tips && selected.tips.length > 0 ? ( - <Table tips={selected.tips} /> + {selected.rewards && selected.rewards.length > 0 ? ( + <Table rewards={selected.rewards} /> ) : ( <EmptyTable /> )} @@ -163,7 +164,7 @@ function EmptyTable(): VNode { </p> <p> <i18n.Translate> - No tips has been authorized from this reserve + No reward has been authorized from this reserve </i18n.Translate> </p> </div> @@ -171,10 +172,10 @@ function EmptyTable(): VNode { } interface TableProps { - tips: MerchantBackend.Tips.TipStatusEntry[]; + rewards: MerchantBackend.Rewards.RewardStatusEntry[]; } -function Table({ tips }: TableProps): VNode { +function Table({ rewards }: TableProps): VNode { const { i18n } = useTranslationContext(); return ( <div class="table-container"> @@ -196,8 +197,8 @@ function Table({ tips }: TableProps): VNode { </tr> </thead> <tbody> - {tips.map((t, i) => { - return <TipRow id={t.tip_id} key={i} entry={t} />; + {rewards.map((t, i) => { + return <RewardRow id={t.reward_id} key={i} entry={t} />; })} </tbody> </table> @@ -205,15 +206,16 @@ function Table({ tips }: TableProps): VNode { ); } -function TipRow({ +function RewardRow({ id, entry, }: { id: string; - entry: MerchantBackend.Tips.TipStatusEntry; + entry: MerchantBackend.Rewards.RewardStatusEntry; }) { const [selected, setSelected] = useState(false); - const result = useTipDetails(id); + const result = useRewardDetails(id); + const [settings] = useSettings(); if (result.loading) { return ( <tr> @@ -242,11 +244,11 @@ function TipRow({ <Fragment> {selected && ( <SimpleModal - description="tip" + description="reward" active onCancel={() => setSelected(false)} > - <TipInfo id={id} amount={info.total_authorized} entity={info} /> + <RewardInfo id={id} amount={info.total_authorized} entity={info} /> </SimpleModal> )} <tr> @@ -256,7 +258,7 @@ function TipRow({ <td onClick={onSelect}> {info.expiration.t_s === "never" ? "never" - : format(info.expiration.t_s * 1000, "yyyy/MM/dd HH:mm:ss")} + : format(info.expiration.t_s * 1000, datetimeFormatForSettings(settings))} </td> </tr> </Fragment> |