Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add EoaOwnershipCondition check #4306

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { FC } from 'react';

import { EoaOwnershipCondition } from '@hey/lens';
import formatAddress from '@hey/lib/formatAddress';
import { Tooltip } from '@hey/ui';
import useEnsName from 'src/hooks/useEnsName';

interface EoaOwnershipConditionProps {
condition: EoaOwnershipCondition;
}

const EoaOwnershipCondition: FC<EoaOwnershipConditionProps> = ({
condition
}) => {
const { ens } = useEnsName({
address: condition.address,
enabled: Boolean(condition.address)
});
const ensName = condition.address === ens ? null : ens;

return (
<div className="flex items-center space-x-2">
<div>Must own the EVM Address:</div>
<div>
<Tooltip content={condition.address}>
{formatAddress(condition.address)} {ensName ? `(${ensName})` : null}
</Tooltip>
</div>
</div>
);
};

export default EoaOwnershipCondition;
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ interface SecondTierConditionProps {
const SecondTierCondition: FC<SecondTierConditionProps> = ({ condition }) => {
return (
<div>
<ThirdTierCondition condition={condition as ThirdTierCondition} />

{condition.__typename === 'AndCondition' ? (
<div className="space-y-3">
<div className="font-bold">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { FC } from 'react';
import { ThirdTierCondition } from '@hey/lens';

import ProfileOwnershipCondition from '../ProfileOwnershipCondition';
import EoaOwnershipCondition from '../ProfileOwnershipCondition copy';

interface ThirdTierConditionProps {
condition: ThirdTierCondition;
Expand All @@ -14,6 +15,9 @@ const ThirdTierCondition: FC<ThirdTierConditionProps> = ({ condition }) => {
{condition.__typename === 'ProfileOwnershipCondition' ? (
<ProfileOwnershipCondition condition={condition} />
) : null}
{condition.__typename === 'EoaOwnershipCondition' ? (
<EoaOwnershipCondition condition={condition} />
) : null}
{condition.__typename === 'NftOwnershipCondition' ? (
<div>{condition.contract.address}</div>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ const Criteria: FC<CriteriaProps> = ({ accessCondition }) => {
return null;
}

return (
<div>
{accessCondition?.criteria.map((criterion) => (
<SecondTierCondition condition={criterion} key={criterion.__typename} />
))}
</div>
);
return accessCondition?.criteria.map((criterion) => (
<SecondTierCondition condition={criterion} key={criterion.__typename} />
));
};

export default Criteria;
Loading