Skip to content

Commit

Permalink
wip: Fix errors preventing post spawner rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
carina-akaia committed Oct 10, 2023
1 parent 8bbb8e5 commit e6d49b6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/gigs-board/entity/post/Post.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ const postExtra =
snapshot.post_type == "Sponsorship" ? (
<div key="post-extra">
<h6 class="card-subtitle mb-2 text-muted">
{`Maximum amount: ${snapshot.amount}`}
{`Maximum amount: ${snapshot.amount} `}
{tokenResolver(snapshot.sponsorship_token)}
</h6>
<h6 class="card-subtitle mb-2 text-muted">
Expand Down
20 changes: 10 additions & 10 deletions src/gigs-board/entity/post/editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down Expand Up @@ -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),
}));

Expand Down Expand Up @@ -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(
Expand All @@ -392,7 +392,7 @@ const PostEditor = ({
</div>
);

const nameDiv = (
const titleSection = (
<div className="col-lg-6 mb-2">
<span>Title:</span>

Expand All @@ -409,7 +409,7 @@ const PostEditor = ({
</div>
);

const callDescriptionDiv = () => (
const descriptionSection = (
<div className="col-lg-12 mb-2">
<span>Description:</span>
<br />
Expand Down Expand Up @@ -554,13 +554,13 @@ const PostEditor = ({
)}

{tagEditor}
{fields.includes("name") && nameDiv}
{fields.includes("description") && callDescriptionDiv()}
{fields.includes("name") && titleSection}
{fields.includes("description") && descriptionSection}
</div>
) : (
<div className="row">
{tagEditor}
{fields.includes("name") && nameDiv}
{fields.includes("name") && titleSection}
{fundraisingToggle}

{fields.includes("amount") && (
Expand Down Expand Up @@ -625,7 +625,7 @@ const PostEditor = ({
</div>
)}

{fields.includes("description") && callDescriptionDiv()}
{fields.includes("description") && descriptionSection}

{fields.includes("requested_sponsorship_amount") &&
state.fundraising && (
Expand Down
5 changes: 3 additions & 2 deletions src/gigs-board/entity/post/spawner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand All @@ -124,8 +124,8 @@ const PostSpawner = ({ isHidden, onCancel }) => {
return (
<div
className={`collapse ${isHidden ? "" : "show"}`}
id={`${type}_post_spawner`}
data-bs-parent={`#accordion${postId}`}
id={`${type}_post_spawner`}
>
<div className="d-flex gap-3">
{Object.values(postTypeOptions).map((option) => (
Expand Down Expand Up @@ -154,6 +154,7 @@ const PostSpawner = ({ isHidden, onCancel }) => {
onDraftStateChange,
parent_id: null,
post_type: type,
tags,
})}
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/gigs-board/pages/community/activity.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 })}
Expand Down

0 comments on commit e6d49b6

Please sign in to comment.