Skip to content

Commit

Permalink
hook up project registration
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanglen committed Oct 17, 2023
1 parent fabeaa7 commit 882e664
Show file tree
Hide file tree
Showing 10 changed files with 682 additions and 32 deletions.
60 changes: 60 additions & 0 deletions apps/potlock/widget/Buttons/ActionButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const getButtonBackground = () => {
if (props.type === "primary") {
if (props.disabled) {
return "#e5e5e5";
}
return "#dd3345";
} else if (props.type === "secondary") {
// TODO: handle disabled
return "#FCE9D5";
}
};

const getButtonColor = () => {
if (props.type === "primary") {
if (props.disabled) {
return "darkgrey";
}
return "white";
}
return "#2E2E2E";
};

const Button = styled.button`
// width: 100%;
height: 100%;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 8px 24px 12px 24px;
background: ${getButtonBackground()};
overflow: hidden;
box-shadow: 0px -2.700000047683716px 0px #4a4a4a inset;
border-radius: 6px;
border: 1px solid #4a4a4a;
gap: 8px;
display: inline-flex;
text-align: center;
color: ${getButtonColor()};
font-size: 14px;
font-weight: 600;
&:hover {
text-decoration: none;
cursor: ${props.disabled ? "not-allowed" : "pointer"};
}
`;

console.log("rendering action button");

return (
<Button
onClick={(e) => {
e.preventDefault();
props.onClick(e);
}}
disabled={props.disabled}
>
{props.text}
</Button>
);
File renamed without changes.
13 changes: 11 additions & 2 deletions apps/potlock/widget/Index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const ownerId = "potlock.near";

const CREATE_PROJECT_TAB = "createproject";

State.init({
tnc: true,
tncIsFetched: false,
Expand Down Expand Up @@ -73,12 +75,19 @@ const getTabWidget = (tab) => {
return "Project.ListPage";
};

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

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

const tabContent = (
<Widget
src={`${ownerId}/widget/${getTabWidget(props.tab)}`}
src={`${ownerId}/widget/${
successfulRegistration ? tabContentWidget.projects : getTabWidget(props.tab)
}`}
props={{
...props,
urlProps: props,
successfulRegistration,
}}
/>
);
Expand Down Expand Up @@ -119,7 +128,7 @@ const Content = styled.div`
// "legal",
// ].includes(props.tab);
const isForm = [
"createproject",
CREATE_PROJECT_TAB,
// "createrequest",
// "createvendor",
// "createbacker",
Expand Down
Loading

0 comments on commit 882e664

Please sign in to comment.