Skip to content

Commit

Permalink
temp resolves to just text
Browse files Browse the repository at this point in the history
elliotBraem committed Dec 29, 2023
1 parent 599f88f commit fbfea5c
Showing 4 changed files with 236 additions and 225 deletions.
32 changes: 16 additions & 16 deletions apps/builddao/widget/Compose.jsx
Original file line number Diff line number Diff line change
@@ -24,23 +24,23 @@ const postToCustomFeed = ({ feed, text, labels }) => {
if (!labels) labels = [];
return Social.set(
{
update: {
[postId]: {
"": JSON.stringify({
type: "md",
text,
labels,
}),
metadata: {
type: feed,
tags: tagsFromLabels(labels),
},
},
},
// update: {
// [postId]: {
// "": JSON.stringify({
// type: "md",
// text,
// labels,
// }),
// metadata: {
// type: feed,
// tags: tagsFromLabels(labels),
// },
// },
// },
post: {
main: JSON.stringify({
type: "md",
text: `[EMBED](${context.accountId}/${feed}/${postId})`,
text,
}),
},
index: {
@@ -237,8 +237,8 @@ return (
) : (
<MarkdownPreview>
<Widget
src="efiz.near/widget/every.markdown.view"
props={{ data: { content: postContent } }}
src="devhub.near/widget/devhub.components.molecule.MarkdownViewer"
props={{ text: postContent } }
/>
</MarkdownPreview>
)}
125 changes: 30 additions & 95 deletions apps/builddao/widget/Feed.jsx
Original file line number Diff line number Diff line change
@@ -2,80 +2,6 @@ const { Feed } = VM.require("devs.near/widget/Module.Feed");

Feed = Feed || (() => <></>); // make sure you have this or else it can break

const StyledPost = styled.div`
margin-bottom: 1rem;
.post {
border-radius: 16px;
border: 1px solid var(--Stroke-color, rgba(255, 255, 255, 0.2));
color: #b6b6b8;
padding: 24px !important;
background-color: #0b0c14;
transition: all 300ms;
&:hover {
background-color: #171929 !important;
.expand-post {
background-image: linear-gradient(
to bottom,
rgb(23, 25, 41, 0),
rgb(23, 25, 41, 1) 25%
) !important;
}
}
.post-header {
span,
.text-muted {
color: #fff !important;
}
}
.buttons {
border-top: 1px solid #3c3d43;
padding: 0.5rem;
}
.expand-post {
background-image: linear-gradient(
to bottom,
rgb(11, 12, 20, 0),
rgb(11, 12, 20, 1) 25%
) !important;
}
}
.dropdown-menu {
background-color: #0b0c14 !important;
color: #fff !important;
li.dropdown-item {
color: #fff !important;
&:hover {
a {
color: #0b0c14 !important;
}
}
}
.link-dark,
.dropdown-item {
color: #fff !important;
&:hover {
color: #0b0c14 !important;
span {
color: #0b0c14 !important;
}
}
}
}
textarea {
color: #b6b6b8 !important;
}
`;

const Container = styled.div`
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
@@ -99,7 +25,7 @@ const [currentFeed, setCurrentFeed] = useState("updates");
const [template, setTemplate] = useState("What did you have in mind?");

const CustomFeed = ({ name }) => {
name = !!name ? name : 'update'
name = !!name ? name : "update";
return (
<Feed
index={[
@@ -117,28 +43,30 @@ const CustomFeed = ({ name }) => {
},
]}
Item={(p) => (
<StyledPost>
<Widget
loading={<div className="w-100" style={{ height: "200px" }} />}
src="/*__@appAccount__*//widget/components.post.post"
props={{
accountId: p.accountId,
blockHeight: p.blockHeight,
noBorder: true,
}}
/>
</StyledPost>
<Widget
loading={<div className="w-100" style={{ height: "200px" }} />}
src="/*__@appAccount__*//widget/components.post.post"
props={{
accountId: p.accountId,
blockHeight: p.blockHeight,
noBorder: true,
}}
/>
)}
/>
);
};

function formatDate(date) {
const options = { year: "numeric", month: "short", day: "numeric" };
return date.toLocaleDateString("en-US", options);
}

const feedsDict = {
"updates": {
updates: {
key: "updates",
name: "update",
template:
`🔔 DAILY UPDATE: TODAY's DATE
template: `🔔 DAILY UPDATE: ${formatDate(new Date())}
📆 YESTERDAY:
- yesterday I did this (hyperlink proof)
@@ -150,13 +78,13 @@ const feedsDict = {
🛑 BLOCKERS:
- @anyone that is causing a blocker or outline any blockers in general`,
},
}
};

const feeds = Object.keys(feedsDict)
const feeds = Object.keys(feedsDict);

const feed = () => {
if (!!feedsDict[currentFeed]) {
return CustomFeed(feedsDict[currentFeed])
return CustomFeed(feedsDict[currentFeed]);
}
};

@@ -165,14 +93,21 @@ return (
<Aside>
<Widget
src="/*__@appAccount__*//widget/aside"
props={{ currentFeed: currentFeed, setCurrentFeed: setCurrentFeed, feeds }}
props={{
currentFeed: currentFeed,
setCurrentFeed: setCurrentFeed,
feeds,
}}
/>
</Aside>
<MainContent>
{context.accountId && (
<Widget
<Widget
src="/*__@appAccount__*//widget/Compose"
props={{ key: feedsDict[currentFeed], template: feedsDict[currentFeed].template }}
props={{
key: feedsDict[currentFeed],
template: feedsDict[currentFeed].template,
}}
/>
)}
{feed()}
Loading

0 comments on commit fbfea5c

Please sign in to comment.