Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
1import type { AccountFollowRules, AccountFragment } from "@hey/indexer";
2import { Button } from "@/components/Shared/UI";
3import { getSimplePaymentDetails } from "@/helpers/rules";
4import { useSuperFollowModalStore } from "@/store/non-persisted/modal/useSuperFollowModalStore";
5import Follow from "./Follow";
6
7interface FollowWithRulesCheckProps {
8 buttonClassName: string;
9 account: AccountFragment;
10 small: boolean;
11}
12
13const FollowWithRulesCheck = ({
14 buttonClassName,
15 account,
16 small
17}: FollowWithRulesCheckProps) => {
18 const { setShowSuperFollowModal } = useSuperFollowModalStore();
19 const { assetAddress: requiredSimplePayment } = getSimplePaymentDetails(
20 account.rules as AccountFollowRules
21 );
22
23 if (requiredSimplePayment) {
24 return (
25 <Button
26 aria-label="Super Follow"
27 className={buttonClassName}
28 onClick={() => setShowSuperFollowModal(true, account)}
29 outline
30 size={small ? "sm" : "md"}
31 >
32 Super Follow
33 </Button>
34 );
35 }
36
37 return (
38 <Follow account={account} buttonClassName={buttonClassName} small={small} />
39 );
40};
41
42export default FollowWithRulesCheck;