From e6d49b6d1516763e2ef035fef88e84d55f4986a1 Mon Sep 17 00:00:00 2001 From: "Carina.Akaia.near" Date: Tue, 10 Oct 2023 17:00:52 +0400 Subject: [PATCH] wip: Fix errors preventing post spawner rendering --- src/gigs-board/entity/post/Post.jsx | 2 +- src/gigs-board/entity/post/editor.jsx | 20 ++++++++++---------- src/gigs-board/entity/post/spawner.jsx | 5 +++-- src/gigs-board/pages/community/activity.jsx | 1 + 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/gigs-board/entity/post/Post.jsx b/src/gigs-board/entity/post/Post.jsx index 60e6e01b6..dcd7dbfe0 100644 --- a/src/gigs-board/entity/post/Post.jsx +++ b/src/gigs-board/entity/post/Post.jsx @@ -549,7 +549,7 @@ const postExtra = snapshot.post_type == "Sponsorship" ? (
- {`Maximum amount: ${snapshot.amount}`} + {`Maximum amount: ${snapshot.amount} `} {tokenResolver(snapshot.sponsorship_token)}
diff --git a/src/gigs-board/entity/post/editor.jsx b/src/gigs-board/entity/post/editor.jsx index 2db5477fe..b3208c4df 100644 --- a/src/gigs-board/entity/post/editor.jsx +++ b/src/gigs-board/entity/post/editor.jsx @@ -255,7 +255,7 @@ const PostEditor = ({ body["post_type"] = state.post_type; - let transactions = []; + const transactions = []; if (mode == "Create") { onDraftStateChange?.({ ...state, parent_post_id: id }); @@ -314,8 +314,8 @@ const PostEditor = ({ })) ); - const setTags = (tagOptions) => { - tagOptions = tagOptions.map((tagOption) => ({ + const setTags = (options) => { + const tagOptions = options.map((tagOption) => ({ name: normalizeTag(tagOption.name), })); @@ -376,7 +376,7 @@ const PostEditor = ({ positionFixed allowNew={(results, params) => !new Set(existingTags).has(params.text) && - selected.filter( + (selected ?? []).filter( (selectedTagOption) => selectedTagOption.name === params.text ).length === 0 && Near.view( @@ -392,7 +392,7 @@ const PostEditor = ({
); - const nameDiv = ( + const titleSection = (
Title: @@ -409,7 +409,7 @@ const PostEditor = ({
); - const callDescriptionDiv = () => ( + const descriptionSection = (
Description:
@@ -554,13 +554,13 @@ const PostEditor = ({ )} {tagEditor} - {fields.includes("name") && nameDiv} - {fields.includes("description") && callDescriptionDiv()} + {fields.includes("name") && titleSection} + {fields.includes("description") && descriptionSection}
) : (
{tagEditor} - {fields.includes("name") && nameDiv} + {fields.includes("name") && titleSection} {fundraisingToggle} {fields.includes("amount") && ( @@ -625,7 +625,7 @@ const PostEditor = ({
)} - {fields.includes("description") && callDescriptionDiv()} + {fields.includes("description") && descriptionSection} {fields.includes("requested_sponsorship_amount") && state.fundraising && ( diff --git a/src/gigs-board/entity/post/spawner.jsx b/src/gigs-board/entity/post/spawner.jsx index bedc07d81..d5439bc51 100644 --- a/src/gigs-board/entity/post/spawner.jsx +++ b/src/gigs-board/entity/post/spawner.jsx @@ -112,7 +112,7 @@ const postTypeOptions = { }, }; -const PostSpawner = ({ isHidden, onCancel }) => { +const PostSpawner = ({ isHidden, onCancel, tags }) => { State.init({ post_type: postTypeOptions.Idea.name }); const typeSwitch = (optionName) => @@ -124,8 +124,8 @@ const PostSpawner = ({ isHidden, onCancel }) => { return (
{Object.values(postTypeOptions).map((option) => ( @@ -154,6 +154,7 @@ const PostSpawner = ({ isHidden, onCancel }) => { onDraftStateChange, parent_id: null, post_type: type, + tags, })}
); diff --git a/src/gigs-board/pages/community/activity.jsx b/src/gigs-board/pages/community/activity.jsx index a66867df4..70e23dbea 100644 --- a/src/gigs-board/pages/community/activity.jsx +++ b/src/gigs-board/pages/community/activity.jsx @@ -189,6 +189,7 @@ const CommunityActivityPage = ({ handle }) => { {widget("entity.post.spawner", { isHidden: state.isSpawnerHidden, onCancel: () => spawnerToggle(false), + tags: [communityData.tag], })} {widget("entity.post.List", { tag: communityData.tag })}