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