Skip to content

Commit

Permalink
Merge pull request #260 from PotLock/profile-page
Browse files Browse the repository at this point in the history
profile page
  • Loading branch information
lachlanglen authored Feb 20, 2024
2 parents 30d5569 + 93b2f1c commit 7b53b74
Show file tree
Hide file tree
Showing 34 changed files with 1,286 additions and 1,494 deletions.
838 changes: 0 additions & 838 deletions apps/potlock/widget/Components/DEPRECATED/ModalDonation.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/potlock/widget/Components/DonorsCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ return (
}}
/>{" "}
<a
href={"https://app.potlock.org/near/widget/ProfilePage?accountId=" + id}
href={props.hrefWithEnv(`?tab=profile&accountId=${id}`)}
className="name"
target="_blank"
>
Expand Down
2 changes: 1 addition & 1 deletion apps/potlock/widget/Components/DonorsLeaderboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ return (
<div>#{idx + 1 + page * perPage}</div>

<a
href={"https://app.potlock.org/near/widget/ProfilePage?accountId=" + donor_id}
href={props.hrefWithEnv(`?tab=profile&accountId=${donor_id}`)}
className="address"
target="_blank"
>
Expand Down
8 changes: 3 additions & 5 deletions apps/potlock/widget/Components/DonorsTrx.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ return (
accountId: donor_id,
children: (
<a
href={"https://app.potlock.org/near/widget/ProfilePage?accountId=" + donor_id}
href={props.hrefWithEnv(`?tab=profile&accountId=${donor_id}`)}
className="address"
target="_blank"
>
Expand All @@ -123,10 +123,8 @@ return (
accountId: recipient_id,
children: (
<a
href={
"https://app.potlock.org/near/widget/ProfilePage?accountId=" + recipient_id
}
className="address"
href={props.hrefWithEnv(`?tab=project&projectId=${recipient_id}`)}
Name="address"
target="_blank"
>
{_address(recipient_id)}
Expand Down
2 changes: 1 addition & 1 deletion apps/potlock/widget/Components/Feed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ const Container = styled.div`

return (
<Container>
<Widget key="feed" src={`${ownerId}/widget/Project.Feed`} props={{ accounts: projectIds }} />
<Widget key="feed" src={`${ownerId}/widget/Profile.Feed`} props={{ accounts: projectIds }} />
</Container>
);
2 changes: 2 additions & 0 deletions apps/potlock/widget/Components/NavOptions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ return (
<NavOption selected={selected} disabled={option.disabled}>
{option.label}
</NavOption>
) : !option.label ? (
""
) : (
<NavOptionContainer>
{selected && (
Expand Down
6 changes: 5 additions & 1 deletion apps/potlock/widget/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const POTS_TAB = "pots";
const DEPLOY_POT_TAB = "deploypot";
const POT_DETAIL_TAB = "pot";
const DONORS_TAB = "donors";
const PROFILE_TAB = "profile";

const Theme = styled.div`
position: relative;
Expand Down Expand Up @@ -79,7 +80,9 @@ State.init({
potDetail: null,
},
donationSuccessModal: {
isOpen: (!props.tab || props.tab === PROJECTS_LIST_TAB) && props.transactionHashes,
isOpen:
(!props.tab || props.tab === PROJECTS_LIST_TAB || props.tab === PROJECT_DETAIL_TAB) &&
props.transactionHashes,
successfulDonation: null,
},
});
Expand Down Expand Up @@ -198,6 +201,7 @@ const tabContentWidget = {
[DEPLOY_POT_TAB]: "Pots.Deploy",
[POT_DETAIL_TAB]: "Pots.Detail",
[DONORS_TAB]: "Components.Donors",
[PROFILE_TAB]: "Profile.Detail",
};

const getTabWidget = (tab) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/potlock/widget/Pots/Applications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ return (
) : (
state.filteredApplications.map((application, index) => {
const { project_id, message, status, submitted_at, review_notes } = application;
console.log("status: ", status);
// console.log("status: ", status);

return (
<Row
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { ownerId } = props;
const accountId = props.projectId;
const { ownerId, accountId } = props;

if (!accountId) {
return "No account ID";
}
Expand Down
209 changes: 209 additions & 0 deletions apps/potlock/widget/Profile/Body.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
const {
ownerId,
projectId,
REGISTRY_CONTRACT_ID,
userIsRegistryAdmin,
SUPPORTED_FTS: { NEAR },
getTagsFromSocialProfileData,
} = props;

const accountId = props.accountId ?? context.accountId;

const [statusReview, setStatusReview] = useState({ modalOpen: false, notes: "", newStatus: "" });

const handleUpdateStatus = () => {
Near.call([
{
contractName: REGISTRY_CONTRACT_ID,
methodName: "admin_set_project_status",
args: {
project_id: projectId,
status: statusReview.newStatus,
review_notes: statusReview.notes,
},
deposit: NEAR.toIndivisible(0.01).toString(),
},
]);
};

const Wrapper = styled.div`
display: flex;
flex-direction: column;
`;

const Container = styled.div`
padding-top: 252px;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
@media screen and (max-width: 768px) {
flex-direction: column;
gap: 1rem;
padding-top: 240px;
}
`;

const Details = styled.div`
display: flex;
flex-direction: column;
gap: 2rem;
flex: 1 1 0%;
width: 100%;
overflow-x: scroll;
.nav-view {
width: 100%;
padding: 24px 50px;
background: #f6f5f3;
@media screen and (max-width: 768px) {
padding: 24px 1rem;
}
}
`;

const SidebarContainer = styled.div`
width: 15%;
padding-left: 1rem;
@media screen and (max-width: 768px) {
width: fit-content;
> div:first-of-type {
display: none;
}
}
`;

const ModalTitle = styled.div`
color: #525252;
font-size: 16px;
font-weight: 600;
line-height: 20px;
word-wrap: break-word;
margin-bottom: 8px;
`;

const Row = styled.div`
display: flex;
flex-direction: row;
align-items: center;
`;

return (
<Wrapper>
<Widget
src={`${ownerId}/widget/Profile.BannerHeader`}
props={{
...props,
accountId: projectId || accountId,
backgroundStyle: {
objectFit: "cover",
left: 0,
top: 0,
height: "280px",
},
}}
/>
<Container>
{/* Side Nav */}
<Widget
src={`${ownerId}/widget/Project.NavOptionsMobile`}
props={{
...props,
}}
/>
<SidebarContainer>
<Widget
src={`${ownerId}/widget/Components.NavOptions`}
props={{
...props,
}}
/>
<Widget
src={`${ownerId}/widget/Profile.Linktree`}
props={{
...props,
}}
/>
</SidebarContainer>

{/* Body */}
<Details>
<Widget
src={`${ownerId}/widget/Profile.BodyHeader`}
props={{
...props,
accountId,
}}
/>
{userIsRegistryAdmin && projectId && (
<Widget
src={`${ownerId}/widget/Inputs.Select`}
props={{
noLabel: true,
options: props.PROJECT_STATUSES.map((status) => ({
value: status,
text: status,
})),
value: { text: props.project.status, value: props.project.status },
onChange: (status) => {
if (status.value != project.status) {
setStatusReview({ ...statusReview, newStatus: status.value, modalOpen: true });
}
},
containerStyles: {
padding: "16px 24px",
},
}}
/>
)}
<div className="nav-view">
<Widget
src={props.navOptions.find((option) => option.id == props.nav).source}
props={{
...props,
}}
/>
</div>
</Details>
</Container>
<Widget
src={`${ownerId}/widget/Components.Modal`}
props={{
...props,
isModalOpen: statusReview.modalOpen,
onClose: () => setStatusReview({ ...statusReview, modalOpen: false }),
children: (
<>
<ModalTitle>Enter Notes for changing status to {statusReview.newStatus}</ModalTitle>
<Widget
src={`${ownerId}/widget/Inputs.TextArea`}
props={{
noLabel: true,
inputRows: 5,
inputStyle: {
background: "#FAFAFA",
},
placeholder: "Your notes here...",
value: statusReview.notes,
onChange: (notes) => setStatusReview({ ...statusReview, notes }),
validate: () => {
// none necessary
},
}}
/>
<Row style={{ justifyContent: "flex-end", marginTop: "12px" }}>
<Widget
src={`${ownerId}/widget/Components.Button`}
props={{
type: "primary",
text: "Submit",
onClick: handleUpdateStatus,
}}
/>
</Row>
</>
),
}}
/>
</Wrapper>
);
Loading

0 comments on commit 7b53b74

Please sign in to comment.