MCPcopy Create free account
hub / github.com/dailydotdev/apps / BuyCore

Function BuyCore

packages/shared/src/components/cores/BuyCore.tsx:26–68  ·  view source on GitHub ↗
({
  onBuyCoresClick,
  amount,
  priceFormatted,
  origin,
  pid,
}: BuyCoreProps)

Source from the content-addressed store, hash-verified

24};
25
26export const BuyCore = ({
27 onBuyCoresClick,
28 amount,
29 priceFormatted,
30 origin,
31 pid,
32}: BuyCoreProps): ReactElement => {
33 const isMobile = useViewSize(ViewSize.MobileL);
34 const params = new URLSearchParams();
35 if (pid) {
36 params.append('pid', pid);
37 }
38
39 if (origin) {
40 params.append('origin', origin);
41 }
42
43 const href = getPathnameWithQuery(
44 `${webappUrl}cores${isMobile ? '/payment' : ''}`,
45 params,
46 );
47
48 return (
49 <Link href={href}>
50 <a
51 href={href}
52 className="btn btn-tertiaryFloat flex flex-1 flex-col items-center rounded-14 p-2"
53 onClick={() => onBuyCoresClick({ amount, origin })}
54 >
55 <CoreIcon size={IconSize.XLarge} className="mb-1" />
56 <Typography type={TypographyType.Title3} bold>
57 {formatCoresCurrency(amount)}
58 </Typography>
59 <Typography
60 type={TypographyType.Caption2}
61 color={TypographyColor.Tertiary}
62 >
63 {typeof priceFormatted !== 'undefined' ? priceFormatted : '~'}
64 </Typography>
65 </a>
66 </Link>
67 );
68};

Callers

nothing calls this directly

Calls 3

useViewSizeFunction · 0.90
getPathnameWithQueryFunction · 0.90
formatCoresCurrencyFunction · 0.90

Tested by

no test coverage detected