+
);
return Tile(props);
diff --git a/src/devhub/entity/post/History.jsx b/src/devhub/entity/post/History.jsx
index 644b1ecb5..1eb7a749a 100644
--- a/src/devhub/entity/post/History.jsx
+++ b/src/devhub/entity/post/History.jsx
@@ -7,13 +7,13 @@ props.timestamp: number;
props.referral: any;
*/
const { href } = VM.require("${REPL_DEVHUB}/widget/core.lib.url") || (() => {});
-const { getPost } =
- VM.require("${REPL_DEVHUB}/widget/core.adapter.devhub-contract") ||
- (() => {});
const postId = props.post.id ?? (props.id ? parseInt(props.id) : 0);
-const post = getPost({ post_id: postId });
-
+const post =
+ props.post ??
+ Near.view(nearDevGovGigsContractAccountId, "get_post", {
+ post_id: postId,
+ });
if (!post || !post.snapshot_history) {
return
;
}
@@ -91,7 +91,7 @@ const history = (
{readableDate(item.timestamp / 1000000)}
{
const amountOfResultsToShowFirst = 5;
const buildPostsIndex = () => {
- return Near.asyncView("${REPL_DEVHUB_CONTRACT}", "get_posts").then(
- (posts) => {
- const index = buildIndex(posts);
- const data = posts.reduce((acc, post) => {
- acc[post.id] = post;
- return acc;
- }, {});
- return { index, data };
- }
- );
+ return Near.asyncView("${REPL_DEVHUB_LEGACY}", "get_posts").then((posts) => {
+ const index = buildIndex(posts);
+ const data = posts.reduce((acc, post) => {
+ acc[post.id] = post;
+ return acc;
+ }, {});
+ return { index, data };
+ });
};
const getProcessedPostsCached = () => {
diff --git a/src/devhub/entity/post/Post.jsx b/src/devhub/entity/post/Post.jsx
index 43b696ca7..416097207 100644
--- a/src/devhub/entity/post/Post.jsx
+++ b/src/devhub/entity/post/Post.jsx
@@ -34,7 +34,7 @@ const postId = props.post.id ?? (props.id ? parseInt(props.id) : 0);
const post =
props.post ??
- Near.view("${REPL_DEVHUB_CONTRACT}", "get_post", { post_id: postId });
+ Near.view("${REPL_DEVHUB_LEGACY}", "get_post", { post_id: postId });
if (!post) {
return Loading ...
;
@@ -64,12 +64,12 @@ const compareSnapshot =
// If this post is displayed under another post. Used to limit the size.
const isUnderPost = props.isUnderPost ? true : false;
-const parentId = Near.view("${REPL_DEVHUB_CONTRACT}", "get_parent_id", {
+const parentId = Near.view("${REPL_DEVHUB_LEGACY}", "get_parent_id", {
post_id: postId,
});
const childPostIdsUnordered =
- Near.view("${REPL_DEVHUB_CONTRACT}", "get_children_ids", {
+ Near.view("${REPL_DEVHUB_LEGACY}", "get_children_ids", {
post_id: postId,
}) ?? [];
@@ -111,7 +111,7 @@ const searchKeywords = props.searchKeywords ? (
const allowedToEdit =
!props.isPreview &&
- Near.view("${REPL_DEVHUB_CONTRACT}", "is_allowed_to_edit", {
+ Near.view("${REPL_DEVHUB_LEGACY}", "is_allowed_to_edit", {
post_id: postId,
editor: context.accountId,
});
@@ -270,7 +270,7 @@ let grantNotify = Near.view(
"${REPL_SOCIAL_CONTRACT}",
"is_write_permission_granted",
{
- predecessor_id: "${REPL_DEVHUB_CONTRACT}",
+ predecessor_id: "${REPL_DEVHUB_LEGACY}",
key: context.accountId + "/index/notify",
}
);
@@ -294,7 +294,7 @@ const onLike = () => {
let likeTxn = [
{
- contractName: "${REPL_DEVHUB_CONTRACT}",
+ contractName: "${REPL_DEVHUB_LEGACY}",
methodName: "add_like",
args: {
post_id: postId,
@@ -308,7 +308,7 @@ const onLike = () => {
contractName: "${REPL_SOCIAL_CONTRACT}",
methodName: "grant_write_permission",
args: {
- predecessor_id: "${REPL_DEVHUB_CONTRACT}",
+ predecessor_id: "${REPL_DEVHUB_LEGACY}",
keys: [context.accountId + "/index/notify"],
},
gas: Big(10).pow(14),
diff --git a/src/devhub/entity/post/PostEditor.jsx b/src/devhub/entity/post/PostEditor.jsx
index da795dc8e..43f8908e3 100644
--- a/src/devhub/entity/post/PostEditor.jsx
+++ b/src/devhub/entity/post/PostEditor.jsx
@@ -97,7 +97,7 @@ const [postData, setPostData] = useState(null); // for capturing edit post chang
useEffect(() => {
if (mode == "Edit") {
- const data = Near.view("${REPL_DEVHUB_CONTRACT}", "get_post", {
+ const data = Near.view("${REPL_DEVHUB_LEGACY}", "get_post", {
post_id: postId,
});
if (!postData) {
@@ -109,7 +109,7 @@ useEffect(() => {
setPostData(data);
}
} else {
- const postIds = Near.view("${REPL_DEVHUB_CONTRACT}", "get_all_post_ids");
+ const postIds = Near.view("${REPL_DEVHUB_LEGACY}", "get_all_post_ids");
if (!postIdList) {
setPostIdList(postIds);
}
@@ -272,7 +272,7 @@ let grantNotify = Near.view(
"${REPL_SOCIAL_CONTRACT}",
"is_write_permission_granted",
{
- predecessor_id: "${REPL_DEVHUB_CONTRACT}",
+ predecessor_id: "${REPL_DEVHUB_LEGACY}",
key: context.accountId + "/index/notify",
}
);
@@ -345,7 +345,7 @@ const onSubmit = () => {
Object.assign({}, state, { parent_post_id: parentId })
);
txn.push({
- contractName: "${REPL_DEVHUB_CONTRACT}",
+ contractName: "${REPL_DEVHUB_LEGACY}",
methodName: "add_post",
args: {
parent_id: parentId,
@@ -359,7 +359,7 @@ const onSubmit = () => {
Object.assign({}, state, { edit_post_id: postId })
);
txn.push({
- contractName: "${REPL_DEVHUB_CONTRACT}",
+ contractName: "${REPL_DEVHUB_LEGACY}",
methodName: "edit_post",
args: {
id: postId,
@@ -375,7 +375,7 @@ const onSubmit = () => {
contractName: "${REPL_SOCIAL_CONTRACT}",
methodName: "grant_write_permission",
args: {
- predecessor_id: "${REPL_DEVHUB_CONTRACT}",
+ predecessor_id: "${REPL_DEVHUB_LEGACY}",
keys: [context.accountId + "/index/notify"],
},
gas: Big(10).pow(14),
@@ -387,7 +387,7 @@ const onSubmit = () => {
};
const checkLabel = (label) => {
- Near.asyncView("${REPL_DEVHUB_CONTRACT}", "is_allowed_to_use_labels", {
+ Near.asyncView("${REPL_DEVHUB_LEGACY}", "is_allowed_to_use_labels", {
editor: context.accountId,
labels: [label],
}).then((allowed) => {
@@ -416,7 +416,7 @@ const setLabels = (labels) => {
oldLabels.delete(label.name);
}
let removed = oldLabels.values().next().value;
- Near.asyncView("${REPL_DEVHUB_CONTRACT}", "is_allowed_to_use_labels", {
+ Near.asyncView("${REPL_DEVHUB_LEGACY}", "is_allowed_to_use_labels", {
editor: context.accountId,
labels: [removed],
}).then((allowed) => {
@@ -441,7 +441,7 @@ const setLabels = (labels) => {
}
};
const existingLabelStrings =
- Near.view("${REPL_DEVHUB_CONTRACT}", "get_all_allowed_labels", {
+ Near.view("${REPL_DEVHUB_LEGACY}", "get_all_allowed_labels", {
editor: context.accountId,
}) ?? [];
const existingLabelSet = new Set(existingLabelStrings);
@@ -471,7 +471,7 @@ const labelEditor = (
props.text.toLowerCase() !== "blog" && // dont allow adding "Blog"
props.selected.filter((selected) => selected.name === props.text)
.length == 0 &&
- Near.view("${REPL_DEVHUB_CONTRACT}", "is_allowed_to_use_labels", {
+ Near.view("${REPL_DEVHUB_LEGACY}", "is_allowed_to_use_labels", {
editor: context.accountId,
labels: [props.text],
})
diff --git a/src/devhub/page/admin/index.jsx b/src/devhub/page/admin/index.jsx
index dc9f2fc50..c50bbf2da 100644
--- a/src/devhub/page/admin/index.jsx
+++ b/src/devhub/page/admin/index.jsx
@@ -58,7 +58,7 @@ function createEditTeam({
if (!membersAndTeams.includes(member)) {
// Add member
txn.push({
- contractName: "${REPL_DEVHUB_CONTRACT}",
+ contractName: "${REPL_DEVHUB_LEGACY}",
methodName: "add_member",
args: {
member: member,
@@ -79,7 +79,7 @@ function createEditTeam({
Near.call([
...txn,
{
- contractName: "${REPL_DEVHUB_CONTRACT}",
+ contractName: "${REPL_DEVHUB_LEGACY}",
methodName: contractCall, // add_member || edit_member
args: {
member: `team:${teamName}`,
diff --git a/src/devhub/page/communities.jsx b/src/devhub/page/communities.jsx
index 8e4be3650..29ebaa6cb 100644
--- a/src/devhub/page/communities.jsx
+++ b/src/devhub/page/communities.jsx
@@ -31,10 +31,6 @@ const [sort, setSort] = useState("");
const communitiesMetadata = getAllCommunitiesMetadata();
-if (!communitiesMetadata) {
- return Loading...
;
-}
-
const SortedAndFiltered = (searchKey, sortBy) => {
let communities = (communitiesMetadata ?? []).reverse();
diff --git a/src/devhub/page/community/index.jsx b/src/devhub/page/community/index.jsx
index 66e6d20c5..4600d6084 100644
--- a/src/devhub/page/community/index.jsx
+++ b/src/devhub/page/community/index.jsx
@@ -47,7 +47,7 @@ if (!href) {
}
if (!tab) {
- tab = "Activity";
+ tab = "Announcements";
}
tab = normalize(tab);
@@ -55,6 +55,13 @@ tab = normalize(tab);
const [isLinkCopied, setLinkCopied] = useState(false);
const tabs = [
+ {
+ title: "Announcements",
+ view: "${REPL_DEVHUB}/widget/devhub.entity.community.Announcements",
+ params: {
+ handle: community.handle,
+ },
+ },
{
title: "Activity",
view: "${REPL_DEVHUB}/widget/devhub.entity.community.Activity",
diff --git a/src/devhub/page/profile.jsx b/src/devhub/page/profile.jsx
index bed0cb4f4..c7f986987 100644
--- a/src/devhub/page/profile.jsx
+++ b/src/devhub/page/profile.jsx
@@ -6,6 +6,6 @@ if (!accountId) {
return (
-
+
);
diff --git a/tsconfig.json b/tsconfig.json
deleted file mode 100644
index 367a268ba..000000000
--- a/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "compilerOptions": {
- "skipLibCheck": true,
- "baseUrl": "./src/",
- "paths": { "@/includes/*": ["./includes/*"] },
- "jsx": "preserve",
- "types": ["@types/react", "near-social-vm-types", "./global.d.ts"],
- "strict": true,
- "noImplicitAny": true
- }
-}