Skip to content

Commit

Permalink
Rebase/events (#140)
Browse files Browse the repository at this point in the history
* fix href

* Profile Page

* Try to fix all VM requires

* Replace all VM.require fallbacks to correct object

* Use correct fallback for DaoSDK

* Remove pinned comment as it is duplicate of bio

* Events monthly view and create modal

* Add filter modal

* wip: data fetch and create

* Comments

* fix: events query

* Fetch events and list events

* Filters

* Change filter button names

* Border radius

* Revert "Border radius"

* Login/Onboarding flow update (#125)

* updated navbar, deleted join page

* Clean up (#121)

* Fix post colors to match figma

* Add stroke to compose for more coherent UI

* Profile in progress, some fixes

* rename

* fix href

* Fix post colors to match figma

* Add stroke to compose for more coherent UI

* Profile in progress, some fixes

* rename

* fix href

* Profile Page

* Style updates

* Style updates to profile page

* Fix projects page

* Fix projects page

* Clear compose draft when post

* Resolve comments

* Fix more hrefs

* Change more href

* Remove layout loading text

* Try to fix all VM requires

* Fix flashes on home page

* Replace all VM.require fallbacks to correct object

* Run prettier

* Use correct fallback for DaoSDK

* Remove un needed tag from compose

* Fix compose rerender on commit

* Remove unneeded css

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>

* added onboarding flow screens

* finish setup

* rename files

* minor bug fix

* add following logic

* fix the visibility issue

* suggestive changes

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>
Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>

* rename fetchEvents to fetchThings

* Fix clear filter not clearing date

* Rename image upload widget

* Convert hashtags into component

* Replace events with things in everything sdk

* Add location, organizer, and link to list view

* Replace test with every

* Fix Bullet component in Join section

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>
Co-authored-by: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 11, 2024
1 parent fca5aba commit 9df9df2
Show file tree
Hide file tree
Showing 20 changed files with 1,408 additions and 77 deletions.
24 changes: 12 additions & 12 deletions apps/builddao/widget/OnboardingFlow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { Modal, Button, ProgressState } = VM.require(
) || {
Modal: () => <></>,
Button: () => <></>,
ProgressState: () => <></>
ProgressState: () => <></>,
};

const DaoSDK = VM.require("sdks.near/widget/SDKs.Sputnik.DaoSDK");
Expand All @@ -19,7 +19,7 @@ const sdk = DaoSDK(daoID);
const groupMembers = sdk.getMembersByGroupId({ groupId: "community" }) ?? [];

const StorageKey = {
userCompletedOnboarding: "userCompletedOnboarding"
userCompletedOnboarding: "userCompletedOnboarding",
};

function onFollow(accountId) {
Expand All @@ -30,20 +30,20 @@ function onFollow(accountId) {
key: "follow",
value: {
type,
accountId: accountId
}
accountId: accountId,
},
}),
notify: JSON.stringify({
key: accountId,
value: {
type
}
})
}
type,
},
}),
},
};

Social.set(data, {
force: true
force: true,
});
}

Expand All @@ -60,7 +60,7 @@ function OnboardingFlow() {
`${context.accountId}/graph/follow/${daoID}`,
undefined,
{
values_only: true
values_only: true,
}
);
const userAlreadyFollowDao =
Expand Down Expand Up @@ -125,7 +125,7 @@ function OnboardingFlow() {
`${context.accountId}/graph/follow/${account}`,
undefined,
{
values_only: true
values_only: true,
}
);
if (accountfollowEdge && Object.keys(accountfollowEdge).length > 0) {
Expand Down Expand Up @@ -213,7 +213,7 @@ function OnboardingFlow() {
props={{
template: PostTemplate,
requiredHashtags: requiredHashtags,
postBtnText: "Create Your First Post"
postBtnText: "Create Your First Post",
}}
/>
</div>
Expand Down
4 changes: 4 additions & 0 deletions apps/builddao/widget/components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { Button } = VM.require("buildhub.near/widget/components.Button");
const { ProgressState } = VM.require(
"buildhub.near/widget/components.ProgressState"
);
const { Bullet } = VM.require("buildhub.near/widget/components.Bullet");
const { Step } = VM.require("buildhub.near/widget/components.Step");
const { InputField } = VM.require("buildhub.near/widget/components.InputField");
const { UploadField } = VM.require(
Expand All @@ -12,6 +13,7 @@ const { TextEditor } = VM.require("buildhub.near/widget/components.TextEditor");
const { Checkbox } = VM.require("buildhub.near/widget/components.Checkbox");
const { Avatar } = VM.require("buildhub.near/widget/components.Avatar");
const { Modal } = VM.require("buildhub.near/widget/components.Modal");
const { Hashtag } = VM.require("buildhub.near/widget/components.Hashtag");

function Pagination({
totalPages,
Expand Down Expand Up @@ -60,7 +62,9 @@ return {
Post,
ProgressState,
Modal,
Bullet,
Step,
Hashtag,
InputField,
UploadField,
TextBox,
Expand Down
6 changes: 6 additions & 0 deletions apps/builddao/widget/components/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const StyledButton = styled.button`
return "var(--button-primary-bg, #FFAF51)";
case "outline":
return "var(--button-outline-bg, transparent)";
case "secondary":
return "var(--button-secondary-bg, #23242B)";
default:
return "var(--button-default-bg, #23242B)";
}
Expand All @@ -41,6 +43,8 @@ const StyledButton = styled.button`
return "var(--button-primary-color, #000)";
case "outline":
return "var(--button-outline-color, #fff)";
case "secondary":
return "var(--button-secondary-color, #CDD0D5)";
default:
return "var(--button-default-color, #CDD0D5)";
}
Expand Down Expand Up @@ -79,6 +83,7 @@ function Button({
type,
onClick,
className,
target,
linkClassName,
href,
style,
Expand All @@ -89,6 +94,7 @@ function Button({
to={href}
className={linkClassName}
style={{ textDecoration: "none" }}
target={target}
>
<StyledButton
id={id}
Expand Down
33 changes: 33 additions & 0 deletions apps/builddao/widget/components/Hashtag.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const StyledHashtag = styled.span`
display: flex;
padding: 4px 8px;
justify-content: center;
align-items: center;
align-content: center;
gap: 4px;
flex-wrap: wrap;
border-radius: 2px;
border: 1px solid var(--Yellow, #ffaf51);
color: var(--White-100, #fff);
/* Body/10px */
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: normal;
.tag {
color: var(--Yellow, #ffaf51);
}
`;
const Hashtag = ({ children }) => {
return (
<StyledHashtag>
<span className="tag">#</span> {children}
</StyledHashtag>
);
};

return { Hashtag };
158 changes: 158 additions & 0 deletions apps/builddao/widget/components/ImageUploader.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
const image = props.image;
const onChange = props.onChange;

const Tab = {
Upload: "Upload",
NFT: "NFT",
URL: "URL",
};

const origTab = () =>
image.nft.contractId || image.nft.tokenId
? Tab.NFT
: !image.ipfs_cid && image.url
? Tab.URL
: Tab.Upload;

State.init({
origImage: image,
tab: origTab(),
url: image.url,
nft: image.nft ?? {},
img: { cid: image.ipfs_cid },
});

const setTab = (tab) => State.update({ tab });

if (JSON.stringify(image) !== JSON.stringify(state.image)) {
State.update({
image,
});
}

let localImage = {};

if (state.origImage.nft.contractId || state.origImage.nft.tokenId) {
localImage.nft = {};
if (state.origImage.nft.contractId) {
localImage.nft.contractId = null;
}
if (state.origImage.nft.tokenId) {
localImage.nft.tokenId = null;
}
}
if (state.origImage.ipfs_cid) {
localImage.ipfs_cid = null;
}
if (state.origImage.url) {
localImage.url = null;
}

if (state.tab === Tab.NFT && (state.nft.contractId || state.nft.tokenId)) {
localImage.nft = {
contractId: state.nft.contractId || "",
tokenId: state.nft.tokenId || "",
};
} else if (state.tab === Tab.Upload && state.img.cid) {
localImage.ipfs_cid = state.img.cid;
}
if (state.tab === Tab.URL && state.url) {
localImage.url = state.url;
}

if (onChange && JSON.stringify(image) !== JSON.stringify(localImage)) {
onChange(localImage);
}

const debounce = (func, wait) => {
const pause = wait || 350;
let timeout;

return (args) => {
const later = () => {
clearTimeout(timeout);
func(args);
};

clearTimeout(timeout);
timeout = setTimeout(later, pause);
};
};

const onNFTChange = debounce((e) => {
State.update({
nft: {
...state.nft,
[e.target.id]: e.target.value,
},
});
});
const onImageChange = debounce((e) => {
State.update({
[e.target.id]: e.target.value,
});
});

return (
<div>
<ul className={`nav nav-tabs`}>
<li className="nav-item">
<button
className={`nav-link ${state.tab === Tab.Upload ? "active" : ""}`}
aria-current="page"
onClick={() => setTab(Tab.Upload)}
>
Upload
</button>
</li>
<li className="nav-item">
<button
className={`nav-link ${state.tab === Tab.NFT ? "active" : ""}`}
aria-current="page"
onClick={() => setTab(Tab.NFT)}
>
NFT
</button>
</li>
<li className="nav-item">
<button
className={`nav-link ${state.tab === Tab.URL ? "active" : ""}`}
aria-current="page"
onClick={() => setTab(Tab.URL)}
>
URL
</button>
</li>
</ul>
<div className="p-2">
<div className={`${state.tab === Tab.Upload ? "" : "visually-hidden"}`}>
<IpfsImageUpload image={state.img} />
</div>
<div className={`${state.tab === Tab.NFT ? "" : "visually-hidden"}`}>
NFT contract
<input
type="text"
id="contractId"
defaultValue={state.nft.contractId}
onChange={onNFTChange}
/>
NFT token id
<input
type="text"
id="tokenId"
defaultValue={state.nft.tokenId}
onChange={onNFTChange}
/>
</div>
<div className={`${state.tab === Tab.URL ? "" : "visually-hidden"}`}>
Image URL
<input
type="text"
id="url"
defaultValue={state.url}
onChange={onImageChange}
/>
</div>
</div>
</div>
);
3 changes: 2 additions & 1 deletion apps/builddao/widget/components/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const NoButton = styled.button`
padding: 0;
margin: 0;
box-shadow: none;
display: none;
`;

const CloseContainer = styled.div`
Expand All @@ -61,7 +62,7 @@ function Modal({
toggle,
toggleContainerProps,
key,
hideCloseBtn
hideCloseBtn,
}) {
return (
<Dialog.Root key={key} open={open} onOpenChange={onOpenChange}>
Expand Down
Loading

0 comments on commit 9df9df2

Please sign in to comment.