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

Feature/988 sunset announcements #1017

Merged
merged 67 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
b5e9375
feat: fetch from devhub-cache-api-rs.fly.dev
Tguntenaar Nov 6, 2024
48d8365
@Megha-Dev-19 WIP
Tguntenaar Nov 13, 2024
c6fde60
wip
Tguntenaar Nov 13, 2024
97d10d5
fmt
Tguntenaar Nov 13, 2024
c4d856e
wip
Tguntenaar Nov 15, 2024
32965d6
events and devhub are ready to be reviewed
Tguntenaar Nov 15, 2024
bc05626
feat: infra proposals
Tguntenaar Nov 15, 2024
f126fc8
fmt
Tguntenaar Nov 15, 2024
a4980a5
feat: rfps infra
Tguntenaar Nov 15, 2024
d9a8b6a
remove comments
Tguntenaar Nov 15, 2024
e796489
fix: spelling
Tguntenaar Nov 19, 2024
ec7c610
fix: spelling
Tguntenaar Nov 20, 2024
96ab80c
replace all nearqueryapi in devhub related to proposals and rfps
Tguntenaar Nov 20, 2024
6d9bbdf
devhub: simplemde, acceptedTerms, passing instance
Tguntenaar Nov 21, 2024
e721ee6
fix: devhub
Tguntenaar Nov 21, 2024
e17e72c
refactor events: deleted SimpleMDE and LinkedProposalsDropdown for both
Tguntenaar Nov 21, 2024
0d25bac
test: replace all references of queryapi in tests
Tguntenaar Nov 21, 2024
f63612a
test: fix linkedProposals and simpleMDE test :)
Tguntenaar Nov 21, 2024
0484689
test: skip discussions test for now
Tguntenaar Nov 21, 2024
7546c0f
clean up SimpleMDE
Tguntenaar Nov 22, 2024
330476a
infra: SimpleMDE, LinkedDropdown rfp + proposal, Proposal + Rfp.jsx, …
Tguntenaar Nov 22, 2024
a6a28a3
test: fix events test, 1. had to deploy events with new cors policy, …
Tguntenaar Nov 22, 2024
f744909
test: infra -- fix: should show correct linked RFP to a proposal in f…
Tguntenaar Nov 22, 2024
7f6a2f4
test: infra -- fix: should create proposal and link an RFP
Tguntenaar Nov 22, 2024
f6fa221
remove comments
Tguntenaar Nov 22, 2024
dff2af3
test: @petersalomonsen fixed!
Tguntenaar Nov 22, 2024
d904a6b
fmt
Tguntenaar Nov 22, 2024
99bf15a
test: discussions test back in
Tguntenaar Nov 22, 2024
b08601f
test: skip discussions test
Tguntenaar Nov 23, 2024
4805d33
revert: changes to rfp comment test
Tguntenaar Nov 24, 2024
83785a6
initial commit 1002
Tguntenaar Dec 3, 2024
14a1341
fmt
Tguntenaar Dec 3, 2024
5061189
Merge branch 'main' into feature/1002-feed
petersalomonsen Dec 3, 2024
7edd4ad
test for comparing local feed with production
petersalomonsen Dec 3, 2024
4a8f7b3
add events committee feed components + by-sort component
Tguntenaar Dec 4, 2024
9f4b5f0
fmt
Tguntenaar Dec 4, 2024
a938540
compare links in prod and local
petersalomonsen Dec 4, 2024
d8f882e
test: update events test
Tguntenaar Dec 5, 2024
3d95784
add events committee feed components + by-sort component
Tguntenaar Dec 4, 2024
be199e6
fmt
Tguntenaar Dec 4, 2024
3211999
test: update events test
Tguntenaar Dec 5, 2024
bf4ac5f
Merge branch 'feature/1002-feed' of github.com:Tguntenaar/neardevhub-…
Tguntenaar Dec 5, 2024
ea1d5bb
test: comment spec
Tguntenaar Dec 5, 2024
29ab16a
test: included some test from pr 982
Tguntenaar Dec 5, 2024
98d752a
revert commit
Tguntenaar Dec 6, 2024
444dee5
feat: simpleMDE to new api
Tguntenaar Dec 6, 2024
6fc1d60
fmt
Tguntenaar Dec 6, 2024
c768b10
feat: linkedproposaldropdown to new api
Tguntenaar Dec 6, 2024
8984298
fmt
Tguntenaar Dec 6, 2024
ca5f1e0
test: proposal autolink
Tguntenaar Dec 6, 2024
0292094
Merge branch 'main' of github.com:NEAR-DevHub/neardevhub-bos into fea…
Tguntenaar Dec 7, 2024
dba0972
Merge branch 'feature/replace-indexer-with-api' of github.com:Tgunten…
Tguntenaar Dec 7, 2024
6e310da
fix: simplemde + test
Tguntenaar Dec 8, 2024
2a55cfc
linked dropdowns
Tguntenaar Dec 8, 2024
96dc94c
feature: update feeds with new api
Tguntenaar Dec 8, 2024
7b49c4a
fmt
Tguntenaar Dec 8, 2024
f2a18a8
weird merge conflict
Tguntenaar Dec 8, 2024
aeaf7d8
feat: new api on proposal and rfp page
Tguntenaar Dec 8, 2024
ec28f39
initial changes
Tguntenaar Dec 8, 2024
222c81c
fmt
Tguntenaar Dec 8, 2024
f48b259
Merge branch 'main' of github.com:NEAR-DevHub/neardevhub-bos into fea…
Tguntenaar Dec 9, 2024
8a295b4
fmt
Tguntenaar Dec 9, 2024
812db54
fix: copy after feedback
Tguntenaar Dec 9, 2024
3a1355d
skip tests
Tguntenaar Dec 11, 2024
40f3b81
Merge branch 'main' of github.com:NEAR-DevHub/neardevhub-bos into fea…
Tguntenaar Dec 11, 2024
5aacb6c
fix: events test
Tguntenaar Dec 11, 2024
ae0c96a
remove unused code
Tguntenaar Dec 11, 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
9 changes: 0 additions & 9 deletions instances/devhub.near/widget/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ function Page() {
/>
);
}
// ?page=feed
case "feed": {
return (
<Widget
src={"${REPL_DEVHUB}/widget/devhub.page.feed"}
props={passProps}
/>
);
}
// ?page=create
case "create": {
return (
Expand Down
23 changes: 6 additions & 17 deletions instances/devhub.near/widget/config/data.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,11 @@ const proposalFeedAnnouncement = (
target="_blank"
rel="noopener noreferrer"
>
DevDAO’s New Proposal Feed!
DevDAO’s Proposal Feed!
</a>
</span>
This dedicated space replaces the
<a
href="?page=feed"
className="text-decoration-underline no-space"
target="_blank"
rel="noopener noreferrer"
>
old activity feed
</a>
, making it easier to submit and track funding requests from DevDAO, the
primary organization behind DevHub. To submit a formal proposal, click
New Proposal. See our{" "}
This space makes it easy to submit and track funding requests from
DevDAO. To submit a formal proposal, click New Proposal. See our{" "}
<a
href="?page=community&handle=developer-dao&tab=funding"
className="text-decoration-underline no-space"
Expand All @@ -35,17 +25,16 @@ const proposalFeedAnnouncement = (
>
guidelines
</a>
for details. For discussions and brainstorming, please utilize the
relevant{" "}
for details. You can also explore relevant{" "}
<a
href="?page=communities"
className="text-decoration-underline no-space"
target="_blank"
rel="noopener noreferrer"
>
communities
</a>
.
</a>{" "}
to connect and collaborate with builders.
</div>
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ const MobileMenu = styled.button`
`;

let links = [
{
title: "/feed",
href: "announcements",
links: [],
},
{
title: "/communities",
href: "communities",
Expand Down
76 changes: 2 additions & 74 deletions instances/devhub.near/widget/devhub/entity/addon/blog/Feed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,89 +9,17 @@ const Loader = styled.div`
padding: 20px;
`;

const QUERYAPI_ENDPOINT = `https://near-queryapi.api.pagoda.co/v1/graphql/`;
const DISPLAY_COUNT = 10;

const fetchGraphQL = (operationsDoc, operationName, variables) => {
return asyncFetch(QUERYAPI_ENDPOINT, {
method: "POST",
headers: { "x-hasura-role": `bo_near` },
body: JSON.stringify({
query: operationsDoc,
variables: variables,
operationName: operationName,
}),
});
};

const queryName =
props.queryName ?? `bo_near_devhub_v38_posts_with_latest_snapshot`;

const query = `query DevhubPostsQuery($limit: Int = 100, $offset: Int = 0, $where: ${queryName}_bool_exp = {}) {
${queryName}(
limit: $limit
offset: $offset
order_by: {ts: desc}
where: $where
) {
post_id
}
}
`;

const [postIds, setPostIds] = useState([]);
const [loading, setLoading] = useState(false);
const [cachedItems, setCachedItems] = useState({});
const [hasNext, setHasNext] = useState(true);

const buildWhereClause = () => {
let where = {};
if (props.author) {
where = { author_id: { _eq: props.author }, ...where };
}
if (props.term) {
where = { description: { _ilike: `%${props.term}%` }, ...where };
}
if (props.includeLabels && Array.isArray(props.includeLabels)) {
const labelConditions = props.includeLabels.map((label) => ({
labels: { _contains: label },
}));

where = { _and: [...labelConditions, where] };
}
if (props.excludeLabels && Array.isArray(props.excludeLabels)) {
const labelConditions = props.excludeLabels.map((label) => ({
labels: { _nin: label },
}));

where = { _and: [...labelConditions, where] };
}
if (!props.recency) {
where = { parent_id: { _is_null: true }, ...where };
}
return where;
};

const fetchPostIds = (offset) => {
if (!offset) {
offset = 0;
}
if (loading) return;
setLoading(true);
const variables = { limit: DISPLAY_COUNT, offset, where: buildWhereClause() };
fetchGraphQL(query, "DevhubPostsQuery", variables).then((result) => {
if (result.status === 200) {
if (result.body.data) {
const data = result.body.data[queryName];
const newPostIds = data.map((p) => p.post_id);
setPostIds(offset === 0 ? newPostIds : [...postIds, ...newPostIds]);
setHasNext(data.length >= variables.limit);
} else {
console.error("GraphQL Error:", result.errors);
}
setLoading(false);
}
});

setLoading(false);
};

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,7 @@ const { getPost } = VM.require(

const { Layout, handle } = props;

const QUERYAPI_ENDPOINT = `https://near-queryapi.api.pagoda.co/v1/graphql/`;

const fetchGraphQL = (operationsDoc, operationName, variables) => {
return fetch(QUERYAPI_ENDPOINT, {
method: "POST",
headers: { "x-hasura-role": `bo_near` },
body: JSON.stringify({
query: operationsDoc,
variables: variables,
operationName: operationName,
}),
});
};

const queryName =
props.queryName ?? `bo_near_devhub_v38_posts_with_latest_snapshot`;

const query = `query DevhubPostsQuery($limit: Int = 100, $offset: Int = 0, $where: ${queryName}_bool_exp = {}) {
${queryName}(
limit: $limit
offset: $offset
order_by: {block_height: desc}
where: $where
) {
post_id
}
}
`;

const includeLabels = ["blog", handle];

const buildWhereClause = () => {
let where = {};
if (props.author) {
where = { author_id: { _eq: props.author }, ...where };
}
if (props.term) {
where = { description: { _ilike: `%${props.term}%` }, ...where };
}
if (includeLabels && Array.isArray(includeLabels)) {
const labelConditions = includeLabels.map((label) => ({
labels: { _contains: label },
}));

where = { _and: [...labelConditions, where] };
}
if (props.excludeLabels && Array.isArray(props.excludeLabels)) {
const labelConditions = props.excludeLabels.map((label) => ({
labels: { _nin: label },
}));

where = { _and: [...labelConditions, where] };
}
if (!props.recency) {
where = { parent_id: { _is_null: true }, ...where };
}
return where;
};

const variables = { limit: DISPLAY_COUNT, offset, where: buildWhereClause() };

const posts = fetch(QUERYAPI_ENDPOINT, {
method: "POST",
headers: { "x-hasura-role": `bo_near` },
body: JSON.stringify({
query: query,
variables: variables,
operationName: "DevhubPostsQuery",
}),
});
const posts = [];

const handleOnChange = (v) => {
console.log("onChange", v);
Expand Down
Loading
Loading