mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
* Icon and IconName * Button and ButtonGroup * UserAvatar * AvatarGroup * Avatar * WizardLayout * Dialogs * EmptyScreen * showToast and TextField * Editor * Skeleton * Skeleton * TopBanner and showToast * Button again * more * perf: Remove app-store reference from @calcom/ui * more * Fixing types * Icon * Fixed casing * dropdown * more * Select * more * Badge * List * more * Divider * more * fix * fix type check * refactor * fix * fix * fix * fix * fix * fix * fix * fix type check * fix * fix * fix * fix * more * more * more * more * add index file to components/command * fix * fix * fix * fix imports * fix * fix * fix * fix * fix * fix * fix * fix build errors * fix build errors * fix --------- Co-authored-by: Keith Williams <[email protected]>
31 lines
932 B
TypeScript
31 lines
932 B
TypeScript
import { fiat } from "@getalby/lightning-tools";
|
|
import React from "react";
|
|
|
|
import { SatSymbol } from "@calcom/ui/components/icon";
|
|
import { Tooltip } from "@calcom/ui/components/tooltip";
|
|
|
|
type AlbyPriceComponentProps = {
|
|
displaySymbol: boolean;
|
|
price: number;
|
|
formattedPrice: string;
|
|
};
|
|
|
|
export function AlbyPriceComponent({ displaySymbol, price, formattedPrice }: AlbyPriceComponentProps) {
|
|
const [fiatValue, setFiatValue] = React.useState<string>("loading...");
|
|
React.useEffect(() => {
|
|
(async () => {
|
|
const unformattedFiatValue = await fiat.getFiatValue({ satoshi: price, currency: "USD" });
|
|
setFiatValue(`$${unformattedFiatValue.toFixed(2)}`);
|
|
})();
|
|
}, [price]);
|
|
|
|
return (
|
|
<Tooltip content={fiatValue}>
|
|
<div className="inline-flex items-center justify-center">
|
|
{displaySymbol && <SatSymbol className="h-4 w-4" />}
|
|
{formattedPrice}
|
|
</div>
|
|
</Tooltip>
|
|
);
|
|
}
|