Skip to content

Commit

Permalink
Merge pull request #9 from itexpert120/homepage
Browse files Browse the repository at this point in the history
Fix Homepage Issues
  • Loading branch information
elliotBraem authored Nov 9, 2023
2 parents b294841 + d6e3fbc commit 7b5920d
Show file tree
Hide file tree
Showing 12 changed files with 364 additions and 56 deletions.
80 changes: 80 additions & 0 deletions apps/homepage/widget/components/button/join-now.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const daoId = "build.sputnik-dao.near";
const accountId = context.accountId;

// get DAO policy, deposit, and group
const policy = Near.view(daoId, "get_policy");

if (policy === null) {
return "";
}

const deposit = policy.proposal_bond;
const roleId = "community";
const group = policy.roles
.filter((role) => role.name === roleId)
.map((role) => role.kind.Group);

const proposalId = Near.view(daoId, "get_last_proposal_id") - 1;

// get data from last proposal
const proposal = Near.view(daoId, "get_proposal", {
id: proposalId,
});

if (proposal === null) {
return "";
}

// check if the potential member submitted last proposal
const canJoin = accountId && accountId !== proposal.proposer;

const Button = styled.a`
width: max-content;
all: unset;
display: flex;
padding: 10px 20px;
justify-content: center;
align-items: center;
gap: 4px;
&:hover {
text-decoration: none;
color: #000 !important;
cursor: pointer;
background: var(--Yellow, #ffaf51);
}
border-radius: 8px;
background: var(--Yellow, #ffaf51);
color: var(--black-100, #000);
/* Other/Button_text */
font-size: 14px;
font-style: normal;
font-weight: 500;
line-height: normal;
@media screen and (max-width: 768px) {
flex: 1 1 0;
}
`;

const Container = styled.div`
width: max-content;
margin-left: auto;
@media screen and (max-width: 768px) {
margin: 0;
width: 100%;
display: flex;
justify-content: center;
}
`;

return (
<Container>
{canJoin ? <Button href={"/join"}>Join Now</Button> : props.children}
</Container>
);
2 changes: 1 addition & 1 deletion apps/homepage/widget/propose.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ return (
{view === "selection" ? (
<>
<h1>What would you like to do?</h1>
<div className="d-flex gap-4">
<div className="d-flex flex-wrap align-items-center justify-content-center gap-4">
<SelectionBox
title={"Make changes to the existing page"}
selected={selection === 1}
Expand Down
2 changes: 1 addition & 1 deletion apps/homepage/widget/section/cta.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ return (
<Card>
<Logo src={logoLink} />
<h1>Together, we can build a better future.</h1>
<a href="#">Join Now</a>
<a href="/join">Join Now</a>
</Card>
<Grid src={gridLink} />
<LeftBlur src={leftBlur} />
Expand Down
36 changes: 3 additions & 33 deletions apps/homepage/widget/section/footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@ const Footer = styled.div`
}
`;

const InstagramIcon = (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="25"
viewBox="0 0 24 25"
fill="none"
>
<path
d="M12.001 9.75C10.3436 9.75 9.00098 11.0931 9.00098 12.75C9.00098 14.4073 10.3441 15.75 12.001 15.75C13.6583 15.75 15.001 14.4069 15.001 12.75C15.001 11.0927 13.6579 9.75 12.001 9.75ZM12.001 7.75C14.7614 7.75 17.001 9.9871 17.001 12.75C17.001 15.5105 14.7639 17.75 12.001 17.75C9.24051 17.75 7.00098 15.5129 7.00098 12.75C7.00098 9.98953 9.23808 7.75 12.001 7.75ZM18.501 7.49915C18.501 8.18926 17.9402 8.74917 17.251 8.74917C16.5609 8.74917 16.001 8.1884 16.001 7.49915C16.001 6.8099 16.5617 6.25 17.251 6.25C17.9393 6.24913 18.501 6.8099 18.501 7.49915ZM12.001 4.75C9.5265 4.75 9.12318 4.75655 7.97227 4.8078C7.18815 4.84461 6.66253 4.95007 6.17416 5.13967C5.74016 5.30799 5.42709 5.50898 5.09352 5.84255C4.75867 6.1774 4.55804 6.48963 4.3904 6.92383C4.20036 7.41332 4.09493 7.93811 4.05878 8.72115C4.00703 9.8252 4.00098 10.2111 4.00098 12.75C4.00098 15.2245 4.00753 15.6278 4.05877 16.7786C4.0956 17.5624 4.2012 18.0888 4.39034 18.576C4.5591 19.0106 4.7605 19.3244 5.09246 19.6564C5.42863 19.9921 5.74179 20.1934 6.17187 20.3594C6.66619 20.5505 7.19148 20.6561 7.97212 20.6922C9.07618 20.7439 9.46203 20.75 12.001 20.75C14.4755 20.75 14.8788 20.7434 16.0296 20.6922C16.8117 20.6555 17.3385 20.5496 17.827 20.3606C18.2604 20.1923 18.5752 19.9902 18.9074 19.6585C19.2436 19.3218 19.4445 19.0094 19.6107 18.5783C19.8013 18.0858 19.9071 17.5598 19.9432 16.7789C19.9949 15.6748 20.001 15.2889 20.001 12.75C20.001 10.2755 19.9944 9.87221 19.9432 8.72137C19.9064 7.93906 19.8005 7.41149 19.6113 6.92318C19.4434 6.49038 19.2417 6.17635 18.9084 5.84255C18.573 5.50715 18.2616 5.30693 17.8271 5.13942C17.338 4.94954 16.8124 4.84396 16.0298 4.80781C14.9258 4.75605 14.5399 4.75 12.001 4.75ZM12.001 2.75C14.7176 2.75 15.0568 2.76 16.1235 2.81C17.1876 2.85917 17.9135 3.0275 18.551 3.275C19.2101 3.52917 19.7668 3.8725 20.3226 4.42833C20.8776 4.98417 21.221 5.5425 21.476 6.2C21.7226 6.83667 21.891 7.56333 21.941 8.6275C21.9885 9.69417 22.001 10.0333 22.001 12.75C22.001 15.4667 21.991 15.8058 21.941 16.8725C21.8918 17.9367 21.7226 18.6625 21.476 19.3C21.2218 19.9592 20.8776 20.5158 20.3226 21.0717C19.7668 21.6267 19.2076 21.97 18.551 22.225C17.9135 22.4717 17.1876 22.64 16.1235 22.69C15.0568 22.7375 14.7176 22.75 12.001 22.75C9.28431 22.75 8.94514 22.74 7.87848 22.69C6.81431 22.6408 6.08931 22.4717 5.45098 22.225C4.79264 21.9708 4.23514 21.6267 3.67931 21.0717C3.12348 20.5158 2.78098 19.9567 2.52598 19.3C2.27848 18.6625 2.11098 17.9367 2.06098 16.8725C2.01348 15.8058 2.00098 15.4667 2.00098 12.75C2.00098 10.0333 2.01098 9.69417 2.06098 8.6275C2.11014 7.5625 2.27848 6.8375 2.52598 6.2C2.78014 5.54167 3.12348 4.98417 3.67931 4.42833C4.23514 3.8725 4.79348 3.53 5.45098 3.275C6.08848 3.0275 6.81348 2.86 7.87848 2.81C8.94514 2.7625 9.28431 2.75 12.001 2.75Z"
fill="white"
/>
</svg>
);

const XIcon = (
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -57,21 +42,6 @@ const XIcon = (
</svg>
);

const YoutubeIcon = (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="25"
viewBox="0 0 24 25"
fill="none"
>
<path
d="M19.6069 7.74482C19.5307 7.44695 19.3152 7.22221 19.0684 7.15288C18.6299 7.03062 16.501 6.75 12.001 6.75C7.50098 6.75 5.37252 7.03073 4.93225 7.15323C4.68776 7.22123 4.4723 7.44593 4.3951 7.74482C4.2863 8.16923 4.00098 9.94595 4.00098 12.75C4.00098 15.554 4.2863 17.3308 4.3954 17.7564C4.47126 18.0531 4.68676 18.2778 4.93251 18.3468C5.37252 18.4693 7.50098 18.75 12.001 18.75C16.501 18.75 18.6299 18.4694 19.0697 18.3468C19.3142 18.2788 19.5297 18.0541 19.6069 17.7552C19.7157 17.3308 20.001 15.55 20.001 12.75C20.001 9.95 19.7157 8.16923 19.6069 7.74482ZM21.5442 7.24818C22.001 9.03 22.001 12.75 22.001 12.75C22.001 12.75 22.001 16.47 21.5442 18.2518C21.2897 19.2373 20.547 20.0118 19.6056 20.2736C17.8971 20.75 12.001 20.75 12.001 20.75C12.001 20.75 6.10837 20.75 4.39637 20.2736C3.45146 20.0082 2.70879 19.2336 2.45774 18.2518C2.00098 16.47 2.00098 12.75 2.00098 12.75C2.00098 12.75 2.00098 9.03 2.45774 7.24818C2.71227 6.26273 3.45495 5.48818 4.39637 5.22636C6.10837 4.75 12.001 4.75 12.001 4.75C12.001 4.75 17.8971 4.75 19.6056 5.22636C20.5505 5.49182 21.2932 6.26636 21.5442 7.24818ZM10.001 16.25V9.25L16.001 12.75L10.001 16.25Z"
fill="white"
/>
</svg>
);

const SocialContainer = styled.div`
display: flex;
gap: 1.25rem;
Expand All @@ -83,9 +53,9 @@ const date = new Date();
return (
<Footer>
<SocialContainer>
<a href="#">{InstagramIcon}</a>
<a href="#">{XIcon}</a>
<a href="#">{YoutubeIcon}</a>
<a href="https://twitter.com/nearbuilders" target="_blank">
{XIcon}
</a>
</SocialContainer>
<p>{date.getFullYear()} BuildDAO all rights reserved</p>
</Footer>
Expand Down
7 changes: 5 additions & 2 deletions apps/homepage/widget/section/hero.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const HeroContainer = styled.div`
width: 100%;
position: relative;
padding: 6.25rem 3rem;
padding: 9.375rem 3rem;
@media screen and (max-width: 768px) {
padding: 6.25rem 1.5rem;
padding: 9.375rem 1.5rem;
}
`;

Expand All @@ -25,6 +25,7 @@ const LeftBlur = styled.img`
transform: translateY(-50%);
object-fit: cover;
width: 25%;
pointer-events: none;
@media screen and (max-width: 768px) {
width: 50%;
Expand All @@ -39,6 +40,7 @@ const RightBlur = styled.img`
transform: translateY(-50%);
object-fit: cover;
width: 25%;
pointer-events: none;
@media screen and (max-width: 768px) {
width: 50%;
Expand All @@ -54,6 +56,7 @@ const Grid = styled.img`
object-fit: cover;
width: 100%;
height: 100%;
pointer-events: none;
`;

const Logo = styled.img`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"error-polyfill": "^0.1.2",
"local-storage": "^2.0.0",
"near-api-js": "^2.1.3",
"near-social-vm": "git+https://github.com/NearSocial/VM.git#2.5.1",
"near-social-vm": "git+https://github.com/NearSocial/VM.git#2.5.2",
"near-social-vm-types": "^1.0.0",
"prettier": "^2.7.1",
"qrcode.react": "^3.1.0",
Expand Down
8 changes: 4 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import "react-bootstrap-typeahead/css/Typeahead.bs5.css";
import "react-bootstrap-typeahead/css/Typeahead.css";
import { Link, Route, BrowserRouter as Router, Switch } from "react-router-dom";
import { BosLoaderBanner } from "./components/BosLoaderBanner";
import { NavigationWrapper } from "./components/navigation/NavigationWrapper";
import { useEthersProviderContext } from "./data/web3";
import { NetworkId, Widgets } from "./data/widgets";
import { useBosLoaderInitializer } from "./hooks/useBosLoaderInitializer";
Expand All @@ -37,6 +36,7 @@ import SignInPage from "./pages/SignInPage";
import ViewPage from "./pages/ViewPage";
import JoinPage from "./pages/JoinPage";
import ProposePage from "./pages/ProposePage";
import { Navbar } from "./components/navigation/Navbar";

export const refreshAllowanceObj = {};
const documentationHref = "https://github.com/NearBuilders/docs";
Expand Down Expand Up @@ -176,7 +176,7 @@ function App() {
<Flags {...passProps} />
</Route>
<Route path={"/signin"}>
<NavigationWrapper {...passProps} />
<Navbar {...passProps} />
<SignInPage {...passProps} />
</Route>
<Route path={"/join"}>
Expand All @@ -189,12 +189,12 @@ function App() {
<EmbedPage {...passProps} />
</Route>
<Route path={"/edit/:widgetSrc*"}>
<NavigationWrapper {...passProps} />
<Navbar {...passProps} />
<EditorPage {...passProps} />
</Route>
<Route path={"/:widgetSrc*"}>
<BosLoaderBanner />
<NavigationWrapper {...passProps} />
<Navbar {...passProps} />
<ViewPage {...passProps} />
</Route>
</Switch>
Expand Down
1 change: 1 addition & 0 deletions src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

body {
overflow-y: scroll;
background-color: #0b0c14;
}

body, html {
Expand Down
Loading

0 comments on commit 7b5920d

Please sign in to comment.