Skip to content

Commit

Permalink
refactor project nav options
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanglen committed Nov 7, 2023
1 parent 35fbfad commit 8555c6a
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 131 deletions.
3 changes: 2 additions & 1 deletion apps/potlock/bos.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"appAccount": "potlock.near",
"aliases": {
"nui": "nearui.near"
"nui": "nearui.near",
"there": []
}
}
2 changes: 0 additions & 2 deletions apps/potlock/widget/Project/Actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ const Container = styled.div`
flex-direction: row;
align-items: center;
justify-content: space-between';
// background: green;
width: 100%;
// flex: 1;
@media screen and (max-width: 768px) {
flex-direction: column;
Expand Down
20 changes: 8 additions & 12 deletions apps/potlock/widget/Project/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ const BodyContainer = styled.div`
align-items: flex-start;
justify-content: flex-start;
gap: 48px;
// background: red;
// @media screen and (max-width: 768px) {
// width: 100%;
// }
// width: 100%;
`;

const NameContainer = styled.div`
Expand Down Expand Up @@ -149,11 +143,13 @@ return (
/>
</div>
<Actions />
<Widget
src={`${ownerId}/widget/Project.About`}
props={{
...props,
}}
/>
<div style={{ width: "100%" }}>
<Widget
src={props.navOptions.find((option) => option.id == props.nav).source}
props={{
...props,
}}
/>
</div>
</BodyContainer>
);
50 changes: 33 additions & 17 deletions apps/potlock/widget/Project/Detail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,41 @@ const Container = styled.div`
`;

const BodyContainer = styled.div`
// display: flex;
// flex: 1;
// background: pink;
// @media screen and (min-width: 768px) {
// // display: flex;
// // flex: 1;
// }
flex: 1;
`;

// const BodyContainerMobile = styled.div`
// padding: 240px 16px;
// display: none;

// @media screen and (max-width: 768px) {
// display: block;
// padding: ;
// }
// `;
// these will be passed down to child components
props.navOptions = [
{
label: "Home",
id: "home",
disabled: false,
source: `${ownerId}/widget/Project.About`,
},
{
label: "Social Feed",
id: "feed",
disabled: false,
source: `${ownerId}/widget/Project.Feed`,
},
{
label: "Pots",
id: "pots",
disabled: true,
},
{
label: "Attestations",
id: "attestations",
disabled: true,
},
{
label: "Funding Raised",
id: "funding",
disabled: true,
},
];

if (!props.nav) props.nav = "home"; // default to home tab

const imageHeightPx = 120;
const profileImageTranslateYPx = 220;
Expand Down
10 changes: 7 additions & 3 deletions apps/potlock/widget/Project/DonationsInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const donationContractId = "donate.potlock.near";

const loraCss = fetch("https://fonts.cdnfonts.com/css/lora").body;

const Container = styled.div`
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -36,11 +38,13 @@ const InfoCard = styled.div`

const InfoTextPrimary = styled.div`
color: #2e2e2e;
font-size: 24px;
font-weight: 600;
line-height: 32px;
font-size: 32px;
font-weight: 400;
line-height: 40px;
// word-wrap: break-word;
text-align: flex-end;
font-family: "Lora";
${loraCss}
`;

const InfoTextSecondary = styled.div`
Expand Down
7 changes: 7 additions & 0 deletions apps/potlock/widget/Project/Feed.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return (
<Widget
key="feed"
src="mob.near/widget/MainPage.N.Feed"
props={{ accounts: [props.projectId] }}
/>
);
39 changes: 8 additions & 31 deletions apps/potlock/widget/Project/NavOptions.jsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
const navOptions = [
{
label: "Home",
disabled: false,
},
{
label: "Social Feed",
disabled: true,
},
{
label: "Pots",
disabled: true,
},
{
label: "Attestations",
disabled: true,
},
{
label: "Funding Raised",
disabled: true,
},
];
const { navOptions } = props;

const getSelectedNavOption = () => {
const navOption = navOptions.find((option) => option.label == props.nav);
const navOption = navOptions.find((option) => option.id == props.nav);
return navOption ?? navOptions[0];
};

Expand All @@ -47,7 +26,7 @@ const NavOption = styled.a`
padding: 8px 16px;
font-weight: ${(props) => (props.selected ? 600 : 400)};
color: ${(props) => (props.selected ? "#DD3345" : "#7B7B7B")};
cursor: ${(props) => (props.disabled ? "not-allowed" : props.selected ? "pointer" : "default")};
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
&:hover {
text-decoration: none;
Expand All @@ -57,22 +36,20 @@ const NavOption = styled.a`
return (
<NavOptionsContainer>
{navOptions.map((option) => {
const selected = option.id == getSelectedNavOption().id;
return option.disabled ? (
<NavOption
selected={option.label == getSelectedNavOption().label}
disabled={option.disabled}
>
<NavOption selected={selected} disabled={option.disabled}>
{option.label}
</NavOption>
) : (
<NavOptionContainer>
{option.label == getSelectedNavOption().label && (
{selected && (
<div style={{ width: 2, height: 16, background: "#DD3345", borderRadius: 2 }} />
)}
<NavOption
selected={option.label == getSelectedNavOption().label}
selected={selected}
disabled={option.disabled}
href={`?tab=project&projectId=${props.projectId}&nav=${option.label}`}
href={`?tab=project&projectId=${props.projectId}&nav=${option.id}`}
>
{option.label}
</NavOption>
Expand Down
2 changes: 0 additions & 2 deletions build/potlock/src/Project/Actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ const Container = styled.div`
flex-direction: row;
align-items: center;
justify-content: space-between';
// background: green;
width: 100%;
// flex: 1;
@media screen and (max-width: 768px) {
flex-direction: column;
Expand Down
20 changes: 8 additions & 12 deletions build/potlock/src/Project/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ const BodyContainer = styled.div`
align-items: flex-start;
justify-content: flex-start;
gap: 48px;
// background: red;
// @media screen and (max-width: 768px) {
// width: 100%;
// }
// width: 100%;
`;

const NameContainer = styled.div`
Expand Down Expand Up @@ -149,11 +143,13 @@ return (
/>
</div>
<Actions />
<Widget
src={`${ownerId}/widget/Project.About`}
props={{
...props,
}}
/>
<div style={{ width: "100%" }}>
<Widget
src={props.navOptions.find((option) => option.id == props.nav).source}
props={{
...props,
}}
/>
</div>
</BodyContainer>
);
50 changes: 33 additions & 17 deletions build/potlock/src/Project/Detail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,41 @@ const Container = styled.div`
`;

const BodyContainer = styled.div`
// display: flex;
// flex: 1;
// background: pink;
// @media screen and (min-width: 768px) {
// // display: flex;
// // flex: 1;
// }
flex: 1;
`;

// const BodyContainerMobile = styled.div`
// padding: 240px 16px;
// display: none;

// @media screen and (max-width: 768px) {
// display: block;
// padding: ;
// }
// `;
// these will be passed down to child components
props.navOptions = [
{
label: "Home",
id: "home",
disabled: false,
source: `${ownerId}/widget/Project.About`,
},
{
label: "Social Feed",
id: "feed",
disabled: false,
source: `${ownerId}/widget/Project.Feed`,
},
{
label: "Pots",
id: "pots",
disabled: true,
},
{
label: "Attestations",
id: "attestations",
disabled: true,
},
{
label: "Funding Raised",
id: "funding",
disabled: true,
},
];

if (!props.nav) props.nav = "home"; // default to home tab

const imageHeightPx = 120;
const profileImageTranslateYPx = 220;
Expand Down
10 changes: 7 additions & 3 deletions build/potlock/src/Project/DonationsInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const donationContractId = "donate.potlock.near";

const loraCss = fetch("https://fonts.cdnfonts.com/css/lora").body;

const Container = styled.div`
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -36,11 +38,13 @@ const InfoCard = styled.div`

const InfoTextPrimary = styled.div`
color: #2e2e2e;
font-size: 24px;
font-weight: 600;
line-height: 32px;
font-size: 32px;
font-weight: 400;
line-height: 40px;
// word-wrap: break-word;
text-align: flex-end;
font-family: "Lora";
${loraCss}
`;

const InfoTextSecondary = styled.div`
Expand Down
7 changes: 7 additions & 0 deletions build/potlock/src/Project/Feed.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return (
<Widget
key="feed"
src="mob.near/widget/MainPage.N.Feed"
props={{ accounts: [props.projectId] }}
/>
);
Loading

0 comments on commit 8555c6a

Please sign in to comment.