Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Jan 30, 2024
1 parent 9abb987 commit 2120513
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 199 deletions.
10 changes: 5 additions & 5 deletions apps/builddao/widget/Compose.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { Avatar, Button } = VM.require("buildhub.near/widget/components");

Avatar = Avatar || (() => <></>);
Button = Button || (() => <></>);
const { Avatar, Button } = VM.require("buildhub.near/widget/components") || {
Avatar: () => <></>,
Button: () => <></>,
};

const draftKey = props.feed.name || "draft";
const draftKey = props.draftKey || "draft";
const draft = Storage.privateGet(draftKey);

if (draft === null) {
Expand Down
128 changes: 7 additions & 121 deletions apps/builddao/widget/Feed.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
const { Feed } = VM.require("devs.near/widget/Module.Feed") || {
const { Feed } = VM.require("devs.near/widget/Feed") || {
Feed: () => <></>,
};
const { Post, ButtonLink } = VM.require("buildhub.near/widget/components") || {
Post: () => <></>,
ButtonLink: () => <></>,
};

const { template, requiredHashtags, customActions } = props;
const { name, template, requiredHashtags, customActions } = props;

return (
<>
<div key={name}>
{!context.accountId ? ( // if not logged in
<Widget src="buildhub.near/widget/components.login-now" props={props} />
) : (
<Widget
src="buildhub.near/widget/Compose"
props={{
feed: feeds[activeFeed],
draftKey: name,
template: template,
requiredHashtags: requiredHashtags,
}}
Expand All @@ -42,123 +42,9 @@ return (
noBorder={true}
currentPath={`${props.pagePath}`}
customActions={customActions}
feedType={feeds[activeFeed].name}
feedType={name}
/>
)}
/>
</>
);

// const daoName = props.daoName || "Build DAO";
// const feedLink = props.feedLink || "https://nearbuilders.org/feed";
// const daoTag = props.daoTag || "build";

// const feeds = props.feeds || {};

// if (!feeds) {
// return "";
// }

// const tab = props.tab || Object.keys(feeds)[0];
// if (Object.keys(feeds).includes(props.hashtag)) {
// tab = props.hashtag;
// }
// const [activeFeed, setActiveFeed] = useState(tab);

// return (
// <>
// <Widget
// src="buildhub.near/widget/components.AsideWithMainContent"
// props={{
// sideContent: Object.keys(feeds || {}).map((route) => {
// const data = feeds[route];
// return (
// <ButtonLink
// id={route}
// variant={activeFeed === route ? "primary" : "outline"}
// href={`${props.pagePath}&tab=${route}`}
// className={
// "align-self-stretch flex-shrink-0 justify-content-start fw-medium"
// }
// style={{
// fontSize: "14px",
// textDecoration: "none",
// cursor: "pointer",
// padding: "8px 12px",
// gap: "10px",
// }}
// >
// <i className={`bi ${data.icon} `}></i>
// <span>{data.label}</span>
// </ButtonLink>
// );
// }),
// mainContent: (
// <>
// {feeds[activeFeed].hideCompose ? null : context.accountId ? (
// <Widget
// src="buildhub.near/widget/Compose"
// props={{
// feed: feeds[activeFeed],
// template: feeds[activeFeed].template,
// requiredHashtags: [daoTag],
// }}
// />
// ) : (
// <Widget
// src="buildhub.near/widget/components.login-now"
// props={props}
// />
// )}
// {feeds[activeFeed].customWidget ? (
// <Widget
// src={feeds[activeFeed].customWidget}
// props={{ ...props, ...feeds[activeFeed].customProps }}
// />
// ) : (
// <Feed
// index={[
// {
// action: "hashtag",
// key: feeds[activeFeed].hashtag, // resolution
// options: {
// limit: 10,
// order: "desc",
// },
// cacheOptions: {
// ignoreCache: true,
// },
// required: true,
// },
// // fix this
// // {
// // action: "hashtag",
// // key: daoTag, // build
// // options: {
// // limit: 10,
// // order: "desc",
// // },
// // cacheOptions: {
// // ignoreCache: true,
// // },
// // required: true,
// // },
// ]}
// Item={(p) => (
// <Post
// accountId={p.accountId}
// blockHeight={p.blockHeight}
// noBorder={true}
// currentPath={`${props.pagePath}`}
// customActions={feeds[activeFeed].customActions}
// feedType={feeds[activeFeed].name}
// />
// )}
// />
// )}
// </>
// ),
// }}
// />
// </>
// );
</div>
);
50 changes: 0 additions & 50 deletions apps/builddao/widget/components/AsideWithMainContent.jsx

This file was deleted.

8 changes: 4 additions & 4 deletions apps/builddao/widget/components/Post.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { User, Button } = VM.require("buildhub.near/widget/components");

User = User || (() => <></>);
Button = Button || (() => <></>);
const { User, Button } = VM.require("buildhub.near/widget/components") || {
User: () => <></>,
Button: () => <></>,
};

const StyledPost = styled.div`
margin-bottom: 1rem;
Expand Down
29 changes: 10 additions & 19 deletions apps/builddao/widget/config/feed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ return {
name: "Resolutions", // maybe these should be moved to navbar specific
icon: "bi-calendar3",
requiredHashtags: ["build", "resolution", "nearyearresolutions2024"],
template: `
### 🎉 NEAR YEAR RESOLUTIONS: 2024
template: `### 🎉 NEAR YEAR RESOLUTIONS: 2024
(posted via [${daoName} Gateway](${feedLink}))
**🌟 REFLECTIONS ON THE PAST YEAR:**
Expand All @@ -43,8 +42,7 @@ return {
name: "Updates",
icon: "bi-bell",
requiredHashtags: ["build", "update"],
template: `
### BUILDER UPDATE: ${formatDate(new Date())}
template: `### BUILDER UPDATE: ${formatDate(new Date())}
(posted via [${daoName} Gateway](${feedLink}?tab=update))
**✅ DONE**
Expand All @@ -68,8 +66,7 @@ return {
name: "Documentation",
icon: "bi-book",
requiredHashtags: ["build", "documentation"],
template: `
## TITLE
template: `## TITLE
(posted via [${daoName} Gateway](${feedLink}?tab=documentation))
**WHAT IS _____?**
Expand All @@ -93,8 +90,7 @@ return {
name: "Question",
icon: "bi-question-lg",
requiredHashtags: ["build", "question"],
template: `
## what is your question?
template: `## what is your question?
(posted via [${daoName} Gateway](${feedLink}?tab=question))
[what are you thinking about?]
Expand All @@ -109,8 +105,7 @@ return {
name: "Answer",
icon: "bi-journal-code",
requiredHashtags: ["build", "answer"],
template: `
## Share an answer
template: `## Share an answer
(posted via [${daoName} Gateway](${feedLink}?tab=answer))
[please restate the question you are answering]
Expand All @@ -128,8 +123,7 @@ return {
name: "Opportunity",
icon: "bi-briefcase",
requiredHashtags: ["build", "opportunity"],
template: `
## TITLE
template: `## TITLE
(posted via [${daoName} Gateway](${feedLink}?tab=opportunity))
[what is the opportunity?]
Expand All @@ -145,8 +139,7 @@ return {
name: "Idea",
icon: "bi-lightbulb",
requiredHashtags: ["build", "idea"],
template: `
## IDEA TITLE
template: `## IDEA TITLE
(posted via [${daoName} Gateway](${feedLink}?tab=idea))
**What idea are you proposing?**
Expand All @@ -164,8 +157,7 @@ return {
name: "Task",
icon: "bi-check-lg",
requiredHashtags: ["build", "task"],
template: `
## TASK TITLE
template: `## TASK TITLE
(posted via [${daoName} Gateway](${feedLink}?tab=task))
**What needs to be done?**
Expand All @@ -188,11 +180,10 @@ return {
label: "Propose",
icon: "bi-file-earmark-text",
type: "modal",
onClick: (modalToggle) => modalToggle(),
onClick: (modalToggle) => modalToggle(), // want to fix
},
],
template: `
## REQUEST TITLE
template: `## REQUEST TITLE
(posted via [${daoName} Gateway](${feedLink}?tab=request))
#### Description
Expand Down

0 comments on commit 2120513

Please sign in to comment.