Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added social feed #65

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
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
52 changes: 18 additions & 34 deletions apps/astraplusplus/widget/Feed/index.jsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,27 @@
/*__@import:daoHelpers/getFollowedDAOs__*/
const [followingAccounts, setFollowingAccounts] = useState([]);

const following = getFollowedDAOs(props.accountId ?? context.accountId ?? "");
const graph = context.accountId
? Social.keys(`${context.accountId}/graph/follow/*`, "final")
: {};

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

const feeds = [
{
name: "daos followed",
data: {
sources: [
{
domain: "post",
key: "main",
},
],
typeWhitelist: ["md"],
accountWhitelist: following,
},
},
];
useEffect(() => {
if (graph !== null) {
const accounts = Object.keys(graph[context.accountId].graph.follow || {});
setFollowingAccounts(accounts);
}
}, [graph, context.accountId]);

const renderHeader = () => (
<div>
<h2 className="h2">Social Feed</h2>
<p className="text-muted">Social posts from the DAOs you follow</p>

<h2 className="h2 mb-2">Social Feed</h2>
<div>
{following.length < 1 ? (
<div className="text-muted mt-4">You are not following any DAOs</div>
) : (
<Widget
src="efiz.near/widget/every.post"
props={{
...feeds[0].data,
}}
/>
)}
<Widget
key="reg-feed"
src="near/widget/v1.Posts.Feed"
props={{
accounts: followingAccounts.length > 0 ? followingAccounts : undefined
}}
/>
</div>
</div>
);
Expand Down
Loading