-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from NEARBuilders/profile-page
Profile page in progress + fixes
- Loading branch information
Showing
7 changed files
with
467 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
if (!context.accountId || !props.accountId) { | ||
return "No Account ID"; | ||
} | ||
|
||
const accountId = props.accountId || context.accountId; | ||
|
||
const profile = Social.getr(`${accountId}/profile`); | ||
if (!profile) { | ||
return ""; | ||
} | ||
|
||
const ProfileContainer = styled.div` | ||
display: grid; | ||
grid-template-columns: repeat(6, minmax(0, 1fr)); | ||
gap: 1rem; | ||
`; | ||
|
||
const SideContainer = styled.div` | ||
grid-column: span 2 / span 1; | ||
`; | ||
|
||
const MainContainer = styled.div` | ||
grid-column: span 4 / span 4; | ||
`; | ||
|
||
return ( | ||
<ProfileContainer> | ||
<SideContainer> | ||
<Widget | ||
src="buildhub.near/widget/components.profile.ProfileInfo" | ||
props={{ accountId }} | ||
/> | ||
</SideContainer> | ||
<MainContainer> | ||
<button | ||
onClick={() => { | ||
Social.set({ | ||
profile: { | ||
location: "Multan, Pakistan", | ||
}, | ||
}); | ||
}} | ||
> | ||
test | ||
</button> | ||
</MainContainer> | ||
</ProfileContainer> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const accountId = props.accountId; | ||
|
||
if (!accountId) { | ||
return ""; | ||
} | ||
|
||
const following = Social.keys(`${accountId}/graph/follow/*`, "final", { | ||
return_type: "BlockHeight", | ||
values_only: true, | ||
}); | ||
|
||
const followers = Social.keys(`*/graph/follow/${accountId}`, "final", { | ||
return_type: "BlockHeight", | ||
values_only: true, | ||
}); | ||
|
||
const numFollowing = following | ||
? Object.keys(following[accountId].graph.follow || {}).length | ||
: null; | ||
const numFollowers = followers ? Object.keys(followers || {}).length : null; | ||
|
||
return ( | ||
<div> | ||
<div className="d-flex flex-row align-items-center"> | ||
<div className="me-3" style={{ fontSize: 14 }}> | ||
<span> | ||
{numFollowing !== null ? ( | ||
<span | ||
className="fw-bolder" | ||
style={{ color: "var(--font-color, #fff)" }} | ||
> | ||
{numFollowing} | ||
</span> | ||
) : ( | ||
"?" | ||
)}{" "} | ||
<span style={{ color: "var(--White-50, #B0B0B0)" }}>Following</span> | ||
</span> | ||
</div> | ||
<div style={{ fontSize: 14 }}> | ||
<span> | ||
{numFollowers !== null ? ( | ||
<span | ||
style={{ color: "var(--font-color, #fff)" }} | ||
className="fw-bolder" | ||
> | ||
{numFollowers} | ||
</span> | ||
) : ( | ||
"?" | ||
)}{" "} | ||
<span style={{ color: "var(--White-50, #B0B0B0)" }}> | ||
Follower{numFollowers !== 1 && "s"} | ||
</span> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
); |
Oops, something went wrong.