Skip to content

Commit

Permalink
Fix request feed modal for projects route
Browse files Browse the repository at this point in the history
  • Loading branch information
itexpert120 committed Feb 1, 2024
1 parent 3a80645 commit 39d22d4
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 101 deletions.
17 changes: 9 additions & 8 deletions apps/builddao/widget/Compose.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,15 @@ 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 = 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);
});
Expand Down Expand Up @@ -394,7 +391,7 @@ return (
<TextareaWrapper
className="markdown-editor"
data-value={postContent || ""}
key={props.feed.name}
key={props.feed.name || "Editor"}
>
<Widget
src="mob.near/widget/MarkdownEditorIframe"
Expand Down Expand Up @@ -438,7 +435,11 @@ return (
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
1 change: 1 addition & 0 deletions apps/builddao/widget/Feed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ return (
draftKey: feedName,
template: template,
requiredHashtags: requiredHashtags,
feed: { ...props },
}}
/>
)}
Expand Down
30 changes: 0 additions & 30 deletions apps/builddao/widget/config/feed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,36 +177,6 @@ return {
requiredHashtags: ["build", "feedback"],
},
},
request: {
path: "buildhub.near/widget/Feed",
blockHeight: "final",
init: {
name: "Request",
icon: "bi-file-earmark-text",
requiredHashtags: ["build", "request"],
template: `## REQUEST TITLE
(posted via [${daoName} Gateway](${feedLink}?tab=request))
**What are you requesting?**
- [Describe your request]
**Context or additional information:**
- [Provide any context or details]
`,
customActions: [
{
type: "modal",
icon: "bi-file-earmark-text",
label: "Propose",
onClick: (modalToggles) => {
console.log(modalToggles);
const toggle = modalToggles.propose;
toggle();
},
},
],
},
},
bookmarks: {
path: "buildhub.near/widget/OrderedGraphFeed",
blockHeight: "final",
Expand Down
24 changes: 14 additions & 10 deletions apps/builddao/widget/config/project-routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ return {
requiredHashtags: ["build", "request"],
customActions: [
{
label: "Propose",
icon: "bi-file-earmark-text",
type: "modal",
onClick: (modalToggle) => modalToggle() // want to fix
}
icon: "bi-file-earmark-text",
label: "Propose",
onClick: (modalToggles) => {
console.log(modalToggles);
const toggle = modalToggles.propose;
toggle();
},
},
],
template: `## REQUEST TITLE
(posted via [${daoName} Gateway](${feedLink}?tab=request))
Expand All @@ -34,17 +38,17 @@ return {
#### Why This Proposal?
[Explanation of why this proposal is necessary or beneficial.]
`
}
`,
},
},
proposals: {
path: "buildhub.near/widget/Proposals",
blockHeight: "final",
init: {
name: "Proposals",
icon: "bi-file-earmark-text",
daoId: "build.sputnik-dao.near"
}
}
}
daoId: "build.sputnik-dao.near",
},
},
},
};
4 changes: 2 additions & 2 deletions apps/builddao/widget/home/join.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ const CTAContainer = styled.div`
color: var(--white-100, #fff);
/* H2/Large */
font-family: Satoshi;
font-family: Satoshi, sans-serif;
font-size: 40px;
font-style: normal;
font-weight: 500;
Expand Down Expand Up @@ -282,7 +282,7 @@ const CTAContent = styled.div`
p {
color: var(--Sea-Blue, #51ffea);
/* Body/Large */
font-family: Satoshi;
font-family: Satoshi, sans-serif;
font-size: 1rem;
font-style: normal;
font-weight: 400;
Expand Down
7 changes: 3 additions & 4 deletions src/components/Editor/FileTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function FileTab(props) {
color: var(--black-100, #000);
/* Other/Button_text */
font-family: Satoshi;
font-family: Satoshi, sans-serif;
font-size: 0.875rem;
font-style: normal;
font-weight: 500;
Expand Down Expand Up @@ -148,9 +148,8 @@ export function FileTab(props) {
</sup>
)}
<CloseButton
className={`ms-1 ${
active ? "btn-outline-light" : "btn-outline-secondary"
}`}
className={`ms-1 ${active ? "btn-outline-light" : "btn-outline-secondary"
}`}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
Expand Down
85 changes: 38 additions & 47 deletions src/pages/EditorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const Button = styled.button`
gap: 4px;
/* Other/Button_text */
font-family: Satoshi;
font-family: Satoshi, sans-serif;
font-size: 0.875rem;
font-style: normal;
font-weight: 500;
Expand Down Expand Up @@ -437,20 +437,20 @@ export default function EditorPage(props) {
(uncommittedPreviews) => {
return uncommittedPreviews
? {
redirectMap: Object.fromEntries(
Object.entries(allSaved)
.filter(([jpath, code]) => code !== true)
.map(([jpath, code]) => {
const path = JSON.parse(jpath);
return [
pathToSrc(path),
{
code,
},
];
})
),
}
redirectMap: Object.fromEntries(
Object.entries(allSaved)
.filter(([jpath, code]) => code !== true)
.map(([jpath, code]) => {
const path = JSON.parse(jpath);
return [
pathToSrc(path),
{
code,
},
];
})
),
}
: undefined;
},
[allSaved, pathToSrc]
Expand All @@ -466,7 +466,7 @@ export default function EditorPage(props) {
color: "black",
padding: "10px 20px",
borderRadius: 8,
fontFamily: "Satoshi",
fontFamily: "Satoshi, sans-serif",
fontWeight: "500",
fontSize: "0.875rem",
}}
Expand Down Expand Up @@ -696,9 +696,8 @@ export default function EditorPage(props) {
<button
className={`nav-link ${tab === Tab.Editor ? "active" : ""}`}
style={{
background: `${
tab === Tab.Editor ? "#23242b" : "#0b0c14"
}`,
background: `${tab === Tab.Editor ? "#23242b" : "#0b0c14"
}`,
color: "white",
border: "none",
}}
Expand All @@ -712,9 +711,8 @@ export default function EditorPage(props) {
<button
className={`nav-link ${tab === Tab.Props ? "active" : ""}`}
style={{
background: `${
tab === Tab.Props ? "#23242b" : "#0b0c14"
}`,
background: `${tab === Tab.Props ? "#23242b" : "#0b0c14"
}`,
color: "white",
border: "none",
}}
Expand All @@ -728,15 +726,13 @@ export default function EditorPage(props) {
<li className="nav-item">
<button
style={{
background: `${
tab === Tab.Metadata ? "#23242b" : "#0b0c14"
}`,
background: `${tab === Tab.Metadata ? "#23242b" : "#0b0c14"
}`,
color: "white",
border: "none",
}}
className={`nav-link ${
tab === Tab.Metadata ? "active" : ""
}`}
className={`nav-link ${tab === Tab.Metadata ? "active" : ""
}`}
aria-current="page"
onClick={() => setTab(Tab.Metadata)}
>
Expand All @@ -748,15 +744,13 @@ export default function EditorPage(props) {
<li className="nav-item">
<button
style={{
background: `${
tab === Tab.Widget ? "#23242b" : "#0b0c14"
}`,
background: `${tab === Tab.Widget ? "#23242b" : "#0b0c14"
}`,
color: "white",
border: "none",
}}
className={`nav-link ${
tab === Tab.Widget ? "active" : ""
}`}
className={`nav-link ${tab === Tab.Widget ? "active" : ""
}`}
aria-current="page"
onClick={() => {
renderPreview(code);
Expand Down Expand Up @@ -859,11 +853,10 @@ export default function EditorPage(props) {
)}
</div>
<div
className={`${
tab === Tab.Metadata && props.widgets.widgetMetadataEditor
? ""
: "visually-hidden"
}`}
className={`${tab === Tab.Metadata && props.widgets.widgetMetadataEditor
? ""
: "visually-hidden"
}`}
>
<div
className="mb-3"
Expand Down Expand Up @@ -892,12 +885,11 @@ export default function EditorPage(props) {
</div>
</div>
<div
className={`${
tab === Tab.Widget ||
className={`${tab === Tab.Widget ||
(layout === Layout.Split && tab !== Tab.Metadata)
? layoutClass
: "visually-hidden"
}`}
? layoutClass
: "visually-hidden"
}`}
>
<div className="container mt-4">
<div className="row">
Expand All @@ -917,9 +909,8 @@ export default function EditorPage(props) {
</div>
</div>
<div
className={`${
tab === Tab.Metadata ? layoutClass : "visually-hidden"
}`}
className={`${tab === Tab.Metadata ? layoutClass : "visually-hidden"
}`}
>
<div className="container">
<div className="row">
Expand Down

0 comments on commit 39d22d4

Please sign in to comment.