Skip to content

Commit

Permalink
Add verified human checkmark (#212)
Browse files Browse the repository at this point in the history
* Add verified human checkmark

* Move to own component and add to User component

* fmt

* fix fomatting
  • Loading branch information
itexpert120 authored Mar 8, 2024
1 parent 90c142a commit 1ed2759
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
7 changes: 7 additions & 0 deletions apps/builddao/widget/components/User.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ return (
props={{ isPremium, accountId }}
/>
</div>
<Widget
loading=""
src="buildhub.near/widget/components.VerifiedHuman"
props={{
accountId: accountId,
}}
/>
</div>
<p className="username">{accountId}</p>
</Wrapper>
Expand Down
32 changes: 32 additions & 0 deletions apps/builddao/widget/components/VerifiedHuman.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const accountId = props.accountId;

if (!accountId) {
return "";
}

Near.asyncView("v1.nadabot.near", "is_human", { account_id: accountId }).then(
(result) => {
State.update({ human: result });
},
);

const VerifiedHuman = state.human ? (
<span style={{ verticalAlign: center }}>
<span className="ms-1 text-primary">
<i className="bi bi-check-circle-fill"></i>
</span>
</span>
) : (
""
);

return (
<Widget
loading={VerifiedHuman}
src="mob.near/widget/N.Common.OverlayTrigger"
props={{
popup: <div>Verified Human!</div>,
children: VerifiedHuman,
}}
/>
);
2 changes: 1 addition & 1 deletion apps/builddao/widget/components/modals/DeletePost.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const handleDelete = () => {
};

return (
<>
<>
<div className="mb-3">
<p className="mb-1">Are you sure you want to delete this post?</p>
<small>
Expand Down
11 changes: 9 additions & 2 deletions apps/builddao/widget/components/post/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const customActions = props.customActions ?? [];
const showTime = props.showTime ?? true;
const modalToggles = props.modalToggles;
const setItem = props.setItem;
const content = props.content;
const content = props.content;

const { href } = VM.require("buildhub.near/widget/lib.url") || {
href: () => {},
Expand Down Expand Up @@ -184,6 +184,13 @@ const MemoizedOverlay = useMemo(
props={{ isPremium, accountId }}
/>
</div>
<Widget
loading=""
src="buildhub.near/widget/components.VerifiedHuman"
props={{
accountId: accountId,
}}
/>
</div>
<p className="username">{accountId}</p>
{showTime && (
Expand Down Expand Up @@ -211,7 +218,7 @@ const MemoizedOverlay = useMemo(
</div>
</Overlay>
),
[props.variant, accountId, name, isPremium, blockHeight, link, pinned]
[props.variant, accountId, name, isPremium, blockHeight, link, pinned],
);

const [showModal, setShowModal] = useState(false);
Expand Down

0 comments on commit 1ed2759

Please sign in to comment.