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

Function BoostPostButton

packages/shared/src/features/boost/BoostButton.tsx:36–65  ·  view source on GitHub ↗
({
  post,
  buttonProps = {},
  origin: originProp,
}: {
  post: Post;
  buttonProps?: ButtonProps<'button'>;
  origin?: Origin;
})

Source from the content-addressed store, hash-verified

34}
35
36export function BoostPostButton({
37 post,
38 buttonProps = {},
39 origin: originProp,
40}: {
41 post: Post;
42 buttonProps?: ButtonProps<'button'>;
43 origin?: Origin;
44}): ReactElement {
45 const router = useRouter();
46 const { openModal } = useLazyModal();
47 const { origin: contextOrigin } = useBoostOriginContext();
48 const origin = originProp ?? contextOrigin ?? Origin.PostBoostButton;
49 const campaignId = post?.flags?.campaignId ?? undefined;
50
51 const onBoost = () =>
52 openModal({ type: LazyModal.BoostPost, props: { post, origin } });
53
54 const onViewBoost = () => router.push(getBoostManagerUrl(campaignId));
55
56 return (
57 <BoostButton
58 campaignId={campaignId}
59 buttonProps={{
60 ...buttonProps,
61 onClick: campaignId ? onViewBoost : onBoost,
62 }}
63 />
64 );
65}

Callers

nothing calls this directly

Calls 2

useLazyModalFunction · 0.90
useRouterFunction · 0.50

Tested by

no test coverage detected