Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
a15a670
init
elliotBraem Jan 23, 2024
a9d9f6c
Use variables to color components
itexpert120 Jan 23, 2024
a89c6a7
Add Feed tabs to general feed
itexpert120 Jan 23, 2024
5eb25c8
Make General Feed functional
itexpert120 Jan 23, 2024
a012775
Pass required dao tag from general feed to compose
itexpert120 Jan 23, 2024
4a78c43
Change feed name back
itexpert120 Jan 23, 2024
db358f8
More style improvements and link navigation
itexpert120 Jan 23, 2024
1e3747e
Add required tag
itexpert120 Jan 23, 2024
b1e8a31
add css variables to config
itexpert120 Jan 23, 2024
5b65548
Abstract theme and aside content of feed to config
itexpert120 Jan 23, 2024
63e16b0
Create Modal for Drafts
itexpert120 Jan 24, 2024
e6921e3
Save drafts
itexpert120 Jan 24, 2024
cceb7a8
Handle deletion of drafts
itexpert120 Jan 24, 2024
5bea5c7
Merge pull request #91 from NEARBuilders/drafts
elliotBraem Jan 24, 2024
b116d13
Revert "Add Post Drafts"
elliotBraem Jan 24, 2024
f66dfdc
Merge pull request #93 from NEARBuilders/revert-91-drafts
elliotBraem Jan 24, 2024
b925adf
Replace old Feed with General Feed
itexpert120 Jan 24, 2024
56a1247
Merge pull request #97 from NEARBuilders/general-feed
elliotBraem Jan 25, 2024
14c4f02
Change sidebar to navbar
itexpert120 Jan 25, 2024
e3d049a
refactor and style changes
itexpert120 Jan 25, 2024
6a6d08e
Style updates to match figma
itexpert120 Jan 25, 2024
ac1025b
Fix navbar variant
itexpert120 Jan 25, 2024
a7e57f7
Fix task feed
itexpert120 Jan 25, 2024
e9e7fdf
fix feed templates
itexpert120 Jan 25, 2024
e4994db
Add request feed with custom propose action
itexpert120 Jan 26, 2024
83378e2
Add Proposal Modal and Text method
itexpert120 Jan 26, 2024
558680c
Don't render modal for other post types
itexpert120 Jan 26, 2024
7aa044d
Fix feed type prop
itexpert120 Jan 26, 2024
d11f96e
Fix default prop in propose modal
itexpert120 Jan 26, 2024
f7456ce
Complete proposal modal
itexpert120 Jan 26, 2024
4d23351
review comments
elliotBraem Jan 28, 2024
beafd2a
Make custom adapter for items in graph
itexpert120 Jan 28, 2024
0b8c958
added proposal list and notification support
Megha-Dev-19 Jan 28, 2024
26a64e9
Rename ProposeModal.jsx to CreateProposal.jsx
itexpert120 Jan 29, 2024
1b69a35
Add Proposal description for Add and Remove Member options of proposal
itexpert120 Jan 29, 2024
26bc2f6
Add Validations
itexpert120 Jan 29, 2024
f3760af
minor css updates
Megha-Dev-19 Jan 29, 2024
c064d43
Merge branch 'proposals' into proposals-list
Megha-Dev-19 Jan 29, 2024
6ddb2da
minor fixes
Megha-Dev-19 Jan 29, 2024
8a3810b
remove prettier
Megha-Dev-19 Jan 29, 2024
c020c1e
remove logs
Megha-Dev-19 Jan 29, 2024
298662b
add theme support
Megha-Dev-19 Jan 29, 2024
95184f6
fix sdk method
Megha-Dev-19 Jan 29, 2024
6159ffe
Merge pull request #108 from Megha-Dev-19/proposals-list
elliotBraem Jan 29, 2024
5454e5e
Merge pull request #103 from NEARBuilders/proposals
elliotBraem Jan 29, 2024
470b64c
Add css variables and props for custom styling
itexpert120 Jan 29, 2024
07e1908
Add missing prop to text widget
itexpert120 Jan 29, 2024
87f29eb
Merge pull request #113 from NEARBuilders/proposals
elliotBraem Jan 29, 2024
f30a018
Add proposals widget to route
itexpert120 Jan 29, 2024
514595c
init
elliotBraem Jan 23, 2024
1cb6bb8
Create Modal for Drafts
itexpert120 Jan 24, 2024
4487f8b
Save drafts
itexpert120 Jan 24, 2024
9a455c8
Handle deletion of drafts
itexpert120 Jan 24, 2024
b1cad45
Revert "Add Post Drafts"
elliotBraem Jan 24, 2024
37bdce2
Use variables to color components
itexpert120 Jan 23, 2024
6e09e7d
Add Feed tabs to general feed
itexpert120 Jan 23, 2024
f1408ec
Make General Feed functional
itexpert120 Jan 23, 2024
050f785
Pass required dao tag from general feed to compose
itexpert120 Jan 23, 2024
6a41b1f
Change feed name back
itexpert120 Jan 23, 2024
edc8a68
More style improvements and link navigation
itexpert120 Jan 23, 2024
02a7692
Add required tag
itexpert120 Jan 23, 2024
7af4a17
add css variables to config
itexpert120 Jan 23, 2024
eba9438
Abstract theme and aside content of feed to config
itexpert120 Jan 23, 2024
49433fe
Replace old Feed with General Feed
itexpert120 Jan 24, 2024
f86e787
Change sidebar to navbar
itexpert120 Jan 25, 2024
160247c
refactor and style changes
itexpert120 Jan 25, 2024
6ee3b1b
Style updates to match figma
itexpert120 Jan 25, 2024
e7f9fca
Fix navbar variant
itexpert120 Jan 25, 2024
cba6923
Fix task feed
itexpert120 Jan 25, 2024
d33769f
fix feed templates
itexpert120 Jan 25, 2024
e6908af
Add request feed with custom propose action
itexpert120 Jan 26, 2024
8e07649
Add Proposal Modal and Text method
itexpert120 Jan 26, 2024
84f4886
Don't render modal for other post types
itexpert120 Jan 26, 2024
ba0be2f
Fix feed type prop
itexpert120 Jan 26, 2024
ee93877
Fix default prop in propose modal
itexpert120 Jan 26, 2024
0a2cf5a
Complete proposal modal
itexpert120 Jan 26, 2024
f25fc4b
review comments
elliotBraem Jan 28, 2024
f2a712e
Make custom adapter for items in graph
itexpert120 Jan 28, 2024
f3fac00
added proposal list and notification support
Megha-Dev-19 Jan 28, 2024
3334b2f
minor css updates
Megha-Dev-19 Jan 29, 2024
a848323
Rename ProposeModal.jsx to CreateProposal.jsx
itexpert120 Jan 29, 2024
19737e2
Add Proposal description for Add and Remove Member options of proposal
itexpert120 Jan 29, 2024
17909dc
Add Validations
itexpert120 Jan 29, 2024
297268a
minor fixes
Megha-Dev-19 Jan 29, 2024
cd63a33
remove prettier
Megha-Dev-19 Jan 29, 2024
ff9925b
remove logs
Megha-Dev-19 Jan 29, 2024
f7e11ab
add theme support
Megha-Dev-19 Jan 29, 2024
b335d19
fix sdk method
Megha-Dev-19 Jan 29, 2024
7c5b3a4
Add css variables and props for custom styling
itexpert120 Jan 29, 2024
44fec78
Add missing prop to text widget
itexpert120 Jan 29, 2024
d43fad0
Add proposals widget to route
itexpert120 Jan 29, 2024
2d5ad6a
Merge branch 'develop' of https://github.com/NEARBuilders/gateway int…
elliotBraem Jan 30, 2024
c9f1a68
move routes
elliotBraem Jan 30, 2024
9abb987
converts Feed into every app pattern
elliotBraem Jan 30, 2024
2120513
clean up
elliotBraem Jan 30, 2024
191bb5f
Fix styles, links, and match desktop navbar
itexpert120 Jan 30, 2024
ede8bce
Add dropdown for mobile navigation
itexpert120 Jan 30, 2024
3683431
Add mobile dropdown items
itexpert120 Jan 30, 2024
85ac5e9
Make login-now forward to /join
itexpert120 Jan 30, 2024
76bacac
Create Post header
itexpert120 Jan 30, 2024
103961f
Convert home widgets into modules
itexpert120 Jan 30, 2024
945fffa
Convert all <a> to <Link>
itexpert120 Jan 30, 2024
2614fea
Add testing about route
itexpert120 Jan 30, 2024
49b1de6
Replace <Link> href with href function
itexpert120 Jan 30, 2024
2a7748e
Fix issues with <Link>
itexpert120 Jan 30, 2024
27a195e
Add loading to widget for smoother loading
itexpert120 Jan 30, 2024
6ad825e
remove useEffect in app
elliotBraem Jan 30, 2024
d77769d
Remove about page
itexpert120 Jan 30, 2024
36ea162
clean nav
elliotBraem Jan 30, 2024
4390e6f
Remove about
itexpert120 Jan 30, 2024
fa3218e
adds theme and router
elliotBraem Jan 30, 2024
1f16d1f
Fix some links
itexpert120 Jan 30, 2024
90eea92
cleanup
elliotBraem Jan 30, 2024
b47cf41
move home
elliotBraem Jan 30, 2024
0647246
Add routes to navbar
itexpert120 Jan 30, 2024
0ca7f2d
proposal feed
elliotBraem Jan 30, 2024
142ffac
Add Userdropdown to navbar
itexpert120 Jan 31, 2024
5ababbb
Merge branch 'develop' of https://github.com/nearbuilders/gateway int…
itexpert120 Jan 31, 2024
0cd32c8
Fix styling on other gateways
itexpert120 Jan 31, 2024
6f20e10
Fix footer text on other gateways
itexpert120 Jan 31, 2024
bfa4992
fix create proposal
Megha-Dev-19 Jan 31, 2024
f85cf7a
uncomment code
Megha-Dev-19 Jan 31, 2024
4492e4a
css update
Megha-Dev-19 Jan 31, 2024
de8da54
minor fixes
Megha-Dev-19 Jan 31, 2024
d749f62
navbar and login flow
elliotBraem Jan 31, 2024
4a186ba
rename proposals to projects
Megha-Dev-19 Jan 31, 2024
8d5cf16
Merge pull request #114 from Megha-Dev-19/fix-create-proposal
elliotBraem Jan 31, 2024
f175eb5
Fix request feed
itexpert120 Feb 1, 2024
eefc30f
Refactor modals out of post to feed
itexpert120 Feb 1, 2024
3a80645
Finish Request Feed
itexpert120 Feb 1, 2024
f34cc07
fix min height of sidebar
Megha-Dev-19 Feb 1, 2024
39d22d4
Fix request feed modal for projects route
itexpert120 Feb 1, 2024
435557c
Fix Library issues and some loading states
itexpert120 Feb 1, 2024
ad9b577
Merge pull request #116 from Megha-Dev-19/fix-sidebar-height
itexpert120 Feb 1, 2024
a3ac55b
Navbar style updates
itexpert120 Feb 1, 2024
b7b1486
Consistant UI for library page
itexpert120 Feb 1, 2024
9b81e7d
Remove console logs
itexpert120 Feb 1, 2024
a6beed6
Add redirects to app
itexpert120 Feb 1, 2024
ce06520
working required hashtag
elliotBraem Feb 1, 2024
1c6764d
some improvements to merged index feed
elliotBraem Feb 2, 2024
d86e5b8
remvoe bos-blocks
elliotBraem Feb 2, 2024
8cc7187
cleanup
elliotBraem Feb 2, 2024
9979b95
Merge branch 'main' of https://github.com/NEARBuilders/gateway into d…
elliotBraem Feb 2, 2024
63f66a1
init bullet
elliotBraem Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions apps/builddao/widget/Bookmarks.jsx

This file was deleted.

205 changes: 33 additions & 172 deletions apps/builddao/widget/Compose.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,17 @@ const { Avatar, Button } = VM.require("buildhub.near/widget/components") || {
Button: () => <></>,
};

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

const autocompleteEnabled = true;

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

State.init({
image: {},
});

const [view, setView] = useState("editor");
const [postContent, setPostContent] = useState("");
const [hideAdvanced, setHideAdvanced] = useState(true);
const [labels, setLabels] = useState([]);
const [showAccountAutocomplete, setShowAccountAutocomplete] = useState(false);
const [mentionsArray, setMentionsArray] = useState([]);
const [mentionInput, setMentionInput] = useState(null);
const [handler, setHandler] = useState("update");

setPostContent(draft || props.template);

Expand All @@ -33,6 +23,16 @@ function generateUID() {
return randomNumber.toString(16).padStart(8, "0");
}

function tagsFromLabels(labels) {
return labels.reduce(
(newLabels, label) => ({
...newLabels,
[label]: "",
}),
{}
);
}

const extractMentions = (text) => {
const mentionRegex =
/@((?:(?:[a-z\d]+[-_])*[a-z\d]+\.)*(?:[a-z\d]+[-_])*[a-z\d]+)/gi;
Expand Down Expand Up @@ -86,28 +86,19 @@ function checkAndAppendHashtag(input, target) {
}

const postToCustomFeed = ({ feed, text, labels }) => {
const postId = generateUID();
if (!labels) labels = [];
// if (!labels) labels = [];

labels = labels.map((label) => label.toLowerCase());
labels.push(feed.name.toLowerCase());
// labels = labels.map((label) => label.toLowerCase());
// labels.push(feed.name.toLowerCase());

const requiredHashtags = ["build"];
const requiredHashtags = props.requiredHashtags || ["build"];
if (feed.hashtag) requiredHashtags.push(feed.hashtag.toLowerCase());
requiredHashtags.push(feed.name.toLowerCase());

text = text + `\n\n`;

requiredHashtags.forEach((hashtag) => {
text = checkAndAppendHashtag(text, hashtag);
});

const content = {
type: "md",
image: state.image.cid ? { ipfs_cid: state.image.cid } : undefined,
text: text,
};

const data = {
// [feed.name]: {
// [postId]: {
Expand All @@ -123,7 +114,12 @@ const postToCustomFeed = ({ feed, text, labels }) => {
// },
// },
post: {
main: JSON.stringify(content),
main: JSON.stringify({
type: "md",
text,
// tags: tagsFromLabels(labels),
// postType: feed.name,
}),
},
index: {
post: JSON.stringify({ key: "main", value: { type: "md" } }),
Expand Down Expand Up @@ -168,98 +164,16 @@ const postToCustomFeed = ({ feed, text, labels }) => {
});
};

function textareaInputHandler(value) {
const words = value.split(/\s+/);
const allMentiones = words
.filter((word) => word.startsWith("@"))
.map((mention) => mention.slice(1));
const newMentiones = allMentiones.filter(
(item) => !mentionsArray.includes(item)
);
setMentionInput(newMentiones?.[0] ?? "");
setMentionsArray(allMentiones);
setShowAccountAutocomplete(newMentiones?.length > 0);
setPostContent(value);
setHandler("update");
Storage.privateSet(draftKey, value || "");
}

function autoCompleteAccountId(id) {
let currentIndex = 0;
const updatedDescription = postContent.replace(
/(?:^|\s)(@[^\s]*)/g,
(match) => {
if (currentIndex === mentionsArray.indexOf(mentionInput)) {
currentIndex++;
return ` @${id}`;
} else {
currentIndex++;
return match;
}
}
);
setPostContent(updatedDescription);
setShowAccountAutocomplete(false);
setMentionInput(null);
setHandler("autocompleteSelected");
Storage.privateSet(draftKey, updatedDescription || "");
}

const PostCreator = styled.div`
display: flex;
flex-direction: column;
gap: 1.5rem;

padding: 1rem;
background: #23242b;
background: var(--compose-bg, #23242b);
border-radius: 12px;

margin-bottom: 1rem;

.upload-image-button {
display: flex;
align-items: center;
justify-content: center;
background: #f1f3f5;
color: #11181c;
border-radius: 40px;
height: 40px;
min-width: 40px;
font-size: 0;
border: none;
cursor: pointer;
transition: background 200ms, opacity 200ms;

&::before {
font-size: 16px;
}

&:hover,
&:focus {
background: #d7dbde;
outline: none;
}

&:disabled {
opacity: 0.5;
pointer-events: none;
}

span {
margin-left: 12px;
}
}

.d-inline-block {
display: flex !important;
gap: 12px;
margin: 0 !important;

.overflow-hidden {
width: 40px !important;
height: 40px !important;
}
}
`;

const TextareaWrapper = styled.div`
Expand Down Expand Up @@ -458,36 +372,6 @@ const MarkdownPreview = styled.div`
}
`;

const LabelSelect = styled.div`
label {
color: #fff;
}

.rbt-input-multi {
background: #23242b !important;
color: #fff !important;
}

.rbt-token {
background: #202020 !important;
color: #fff !important;
}

.rbt-menu {
background: #23242b !important;
color: #fff !important;

.dropdown-item {
color: #fff !important;
transition: all 300ms;

&:hover {
background: #202020;
}
}
}
`;

const avatarComponent = useMemo(() => {
return (
<div className="d-flex align-items-start gap-2">
Expand All @@ -507,57 +391,31 @@ return (
<TextareaWrapper
className="markdown-editor"
data-value={postContent || ""}
key={props.feed.name}
key={props.feed.name || "Editor"}
>
<Widget
src={"buildhub.near/widget/components.MarkdownEditorIframe"}
src="mob.near/widget/MarkdownEditorIframe"
props={{
initialText: postContent,
data: { handler: handler, content: postContent },
onChange: (content) => {
textareaInputHandler(content);
embedCss: props.customCSS || MarkdownEditor,
onChange: (v) => {
setPostContent(v);
Storage.privateSet(draftKey, v || "");
},
embedCss: MarkdownEditor,
}}
/>
{autocompleteEnabled && showAccountAutocomplete && (
<Widget
src="buildhub.near/widget/components.AccountAutocomplete"
props={{
term: mentionInput,
onSelect: autoCompleteAccountId,
onClose: () => setShowAccountAutocomplete(false),
}}
/>
)}
</TextareaWrapper>
) : (
<MarkdownPreview>
<Widget
src="devhub.near/widget/devhub.components.molecule.MarkdownViewer"
props={{ text: postContent }}
/>
{state.image.cid && (
<Widget
src="mob.near/widget/Image"
props={{
image: state.image.cid
? { ipfs_cid: state.image.cid }
: undefined,
}}
/>
)}
</MarkdownPreview>
)}
</div>

<div className="d-flex gap-3 align-self-end">
{view === "editor" && (
<IpfsImageUpload
image={state.image}
className="upload-image-button bi bi-image"
/>
)}
<Button
variant="outline"
onClick={() => setView(view === "editor" ? "preview" : "editor")}
Expand All @@ -574,11 +432,14 @@ return (
)}
</Button>
<Button
disabled={postContent === "" || postContent === props.template}
variant="primary"
style={{ fontSize: 14 }}
onClick={() =>
postToCustomFeed({ feed: props.feed, text: postContent, labels })
postToCustomFeed({
feed: props.feed,
text: postContent,
labels,
})
}
>
Post {props.feed.name}
Expand Down
Loading