Skip to content

Commit

Permalink
Merge pull request #61 from PotLock/fix/mvp-fixes
Browse files Browse the repository at this point in the history
Fix/mvp fixes
  • Loading branch information
lachlanglen authored Oct 23, 2023
2 parents 5e41c69 + 1e7ab27 commit b398e28
Show file tree
Hide file tree
Showing 33 changed files with 773 additions and 1,252 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/deploy-mainnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Deploy Components to Mainnet
on:
push:
branches: [main]
jobs:
deploy-mainnet:
uses: FroVolod/bos-cli-rs/.github/workflows/deploy-mainnet.yml@master
with:
deploy-account-address: potlock.near
signer-account-address: potlock.near
signer-public-key: ed25519:3iWoL6haUT3FGd9KJjwpAS8fLqk7hAdyBX8trD3vSh6C
secrets:
SIGNER_PRIVATE_KEY: ${{ secrets.SIGNER_PRIVATE_KEY }}
1 change: 1 addition & 0 deletions apps/potlock/widget/Buttons/ActionButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const Button = styled.button`
text-align: center;
color: ${getButtonTextColor()};
font-size: 14px;
line-height: 16px;
font-weight: 600;
&:hover {
Expand Down
13 changes: 10 additions & 3 deletions apps/potlock/widget/Components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const ownerId = "potlock.near";

const loraCss = fetch("https://fonts.googleapis.com/css2?family=Lora&display=swap").body;

const headerTitleFontSizePx = 88;

const HeaderContainer = styled.div`
width: 100%;
background: #fffaf4;
// background: #fffaf4;
background: white;
padding: 80px 64px;
`;

Expand All @@ -17,15 +20,17 @@ const HeaderContent = styled.div`
const HeaderTitle = styled.div`
color: #2e2e2e;
font-size: ${headerTitleFontSizePx}px;
font-weight: 600;
font-weight: 500;
word-wrap: break-word;
position: relative;
text-align: center;
font-family: "Lora";
${loraCss}
`;

const HeaderDescription = styled.div`
color: #2e2e2e;
font-size: 32px;
font-family: Mona-Sans;
font-weight: 400;
word-wrap: break-word;
max-width: 866px;
Expand All @@ -43,6 +48,7 @@ const ButtonsContainer = styled.div`
`;

return (
// <Theme>
<HeaderContainer>
<HeaderContent>
<HeaderTitle>
Expand Down Expand Up @@ -78,4 +84,5 @@ return (
{props.buttonSecondary && props.buttonSecondary}
</ButtonsContainer>
</HeaderContainer>
// </Theme>
);
140 changes: 17 additions & 123 deletions apps/potlock/widget/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,31 @@ const ownerId = "potlock.near";
const CREATE_PROJECT_TAB = "createproject";
const PROJECT_DETAIL_TAB = "project";

const monaSansCss = fetch("https://fonts.cdnfonts.com/css/mona-sans").body;

if (!monaSansCss) return "";

const Theme = styled.div`
* {
font-family: "Mona-Sans";
}
${monaSansCss}
`;

State.init({
tnc: true,
tncIsFetched: false,
tosAccept: true,
});

// if (context.accountId && !state.tncIsFetched) {
// Near.asyncView(
// "social.near",
// "get",
// {
// keys: [
// `${context.accountId}/profile/horizon_tnc`,
// `${context.accountId}/index/tosAccept`,
// ],
// },
// "final",
// false
// ).then((data) =>
// State.update({
// tnc: data[context.accountId]?.profile?.horizon_tnc === "true",
// tosAccept:
// data[context.accountId]?.index?.tosAccept &&
// data[context.accountId]?.index?.tosAccept.length > 0,
// tncIsFetched: true,
// })
// );
// }

const tabContentWidget = {
// home: "Dashboard",
// inbox: "Inbox",
// manage: "Manage",
// project: "Project.Page",
// request: "Request.Page",
// vendor: "Vendor.Page",
// backer: "Investor.Page",
// contribution: "Contribution.Page",
[CREATE_PROJECT_TAB]: "Project.Create",
// createrequest: "Request.Form",
// createvendor: "Vendor.Form",
// createbacker: "Investor.Form",
// permissions: "Inputs.SetUpPermissions",
// learn: "Learn.Page",
// faq: "FAQ.Page",
// help: "Help.Page",
// legal: "TNCPage",
// admin: "Admin.Page",
projects: "Project.ListPage",
[PROJECT_DETAIL_TAB]: "Project.Detail",
// investors: "Investor.ListPage",
// backers: "Investor.ListPage",
// vendors: "Vendor.ListPage",
// contributors: "Vendor.ListPage",
// requests: "Request.ListPage",
// partners: "Application.Page",
// partner: "Application.DetailPage",
// "my-projects": "Manage.Projects",
// "my-requests": "Manage.Requests",
// "my-contracts": "Manage.Contracts",
// "my-applications": "Manage.Applications",
// events: "Events.Page",
// perks: "Perks.Page",
// profile: "Profile.Page",
};

const successfulRegistration = props.tab == CREATE_PROJECT_TAB && props.transactionHashes;

const getWidget = (props) => {
if (successfulRegistration) {
// user just successfully registered their project
// navigate to the project page
// get the project ID (do this in getWidgetProps)
return tabContentWidget[PROJECT_DETAIL_TAB];
} else if (props.tab in tabContentWidget) {
if (props.tab in tabContentWidget) {
return tabContentWidget[props.tab];
}
// backup (TODO: review)
Expand All @@ -92,51 +42,19 @@ const getTabWidget = (tab) => {
return "Project.ListPage";
};

const getWidgetProps = () => {
const props = {
...props,
urlProps: props,
};
if (successfulRegistration) {
props.successfulRegistration = true;
// get the project ID
// get list of all registered projects
// find the one that matches context.accountId
// pass this project in props to the project page
}
return {
...props,
urlProps: props,
successfulRegistration,
};
}; // TODO: IMPLEMENT

console.log("Index props: ", props);

const tabContent = (
<Widget
src={`${ownerId}/widget/${
successfulRegistration ? tabContentWidget.projects : getTabWidget(props.tab)
}`}
src={`${ownerId}/widget/${getTabWidget(props.tab)}`}
props={{
...props,
urlProps: props,
successfulRegistration,
}}
/>
);

console.log("tab content: ", tabContent);

// const Page = styled.div`
// width: 100%;
// border-radius: 0.5rem;
// border: 1px solid #eaeaea;
// `;

const Content = styled.div`
padding-top: 110px;
width: 100%;
height: 100%;
background: #ffffff;
// padding: 3em;
border-radius: 0rem 0rem 1.5rem 1.5rem;
Expand All @@ -149,35 +67,11 @@ const Content = styled.div`
}
`;

// const showSidebar = ![
// "createproject",
// "createrequest",
// "createvendor",
// "createbacker",
// "permissions",
// "legal",
// ].includes(props.tab);
const isForm = [
CREATE_PROJECT_TAB,
// "createrequest",
// "createvendor",
// "createbacker",
].includes(props.tab);

// const showTncDialog = !state.tnc && state.tosAccept && props.tab !== "legal";
const isForm = [CREATE_PROJECT_TAB].includes(props.tab);

return (
<>
<Theme>
<Widget src={`${ownerId}/widget/Nav`} />
{/* <Widget
src={`${ownerId}/widget/Components.Header`}
props={{
title: "Create new project",
description:
"Lorem ipsum dolor sit amet consectetur. Vel sit nunc in nunc. Viverra arcu eu sed consequat.",
}}
/> */}
{/* <Widget src={`${ownerId}/widget/Project.Form`} /> */}
<Content className={isForm ? "form" : ""}>{tabContent}</Content>
</>
</Theme>
);
Loading

0 comments on commit b398e28

Please sign in to comment.