diff --git a/src/gigs-board/entity/post/CompactPost.jsx b/src/gigs-board/entity/post/CompactPost.jsx deleted file mode 100644 index 51449977a..000000000 --- a/src/gigs-board/entity/post/CompactPost.jsx +++ /dev/null @@ -1,194 +0,0 @@ -/* INCLUDE: "common.jsx" */ -const nearDevGovGigsContractAccountId = - props.nearDevGovGigsContractAccountId || - (context.widgetSrc ?? "devgovgigs.near").split("/", 1)[0]; - -const nearDevGovGigsWidgetsAccountId = - props.nearDevGovGigsWidgetsAccountId || - (context.widgetSrc ?? "devgovgigs.near").split("/", 1)[0]; - -function widget(widgetName, widgetProps, key) { - widgetProps = { - ...widgetProps, - nearDevGovGigsContractAccountId: props.nearDevGovGigsContractAccountId, - nearDevGovGigsWidgetsAccountId: props.nearDevGovGigsWidgetsAccountId, - referral: props.referral, - }; - - return ( - - ); -} - -function href(widgetName, linkProps) { - linkProps = { ...linkProps }; - - if (props.nearDevGovGigsContractAccountId) { - linkProps.nearDevGovGigsContractAccountId = - props.nearDevGovGigsContractAccountId; - } - - if (props.nearDevGovGigsWidgetsAccountId) { - linkProps.nearDevGovGigsWidgetsAccountId = - props.nearDevGovGigsWidgetsAccountId; - } - - if (props.referral) { - linkProps.referral = props.referral; - } - - const linkPropsQuery = Object.entries(linkProps) - .filter(([_key, nullable]) => (nullable ?? null) !== null) - .map(([key, value]) => `${key}=${value}`) - .join("&"); - - return `/#/${nearDevGovGigsWidgetsAccountId}/widget/gigs-board.pages.${widgetName}${ - linkPropsQuery ? "?" : "" - }${linkPropsQuery}`; -} -/* END_INCLUDE: "common.jsx" */ -/* INCLUDE: "core/lib/gui/attractable" */ -const AttractableDiv = styled.div` - box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; - transition: box-shadow 0.6s; - - &:hover { - box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; - } -`; - -const AttractableLink = styled.a` - box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; - transition: box-shadow 0.6s; - - &:hover { - box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; - } -`; - -const AttractableImage = styled.img` - box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; - transition: box-shadow 0.6s; - - &:hover { - box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; - } -`; -/* END_INCLUDE: "core/lib/gui/attractable" */ - -const postId = props.post.id ?? (props.id ? parseInt(props.id) : 0); -const post = - props.post ?? - Near.view(nearDevGovGigsContractAccountId, "get_post", { post_id: postId }); -if (!post) { - return
Loading ...
; -} -const snapshot = post.snapshot; - -const shareButton = ( - -
-
-); - -const header = ( -
- -
- -
-
{shareButton}
-
-
-
-
-); - -const emptyIcons = { - Idea: "bi-lightbulb", - Comment: "bi-chat", - Solution: "bi-rocket", - Attestation: "bi-check-circle", - Sponsorship: "bi-cash-coin", -}; - -const borders = { - Idea: "border-secondary", - Comment: "border-secondary", - Solution: "border-secondary", - Attestation: "border-secondary", - Sponsorship: "border-secondary", -}; - -const postLables = post.snapshot.labels ? ( -
- {post.snapshot.labels.map((label) => ( - - {label} - - ))} -
-) : null; - -const postTitle = - snapshot.post_type == "Comment" ? null : ( -
-
-
- - {snapshot.post_type}: {snapshot.name} -
-
-
- ); - -const LimitedMarkdown = styled.div` - max-height: 6em; -`; - -// Should make sure the posts under the currently top viewed post are limited in size. -const descriptionArea = - snapshot.post_type == "Comment" ? ( - - {widget("components.molecule.markdown-viewer", { - text: snapshot.description, - })} - - ) : null; - -return ( - - {header} -
- {postTitle} - {descriptionArea} - {postLables} -
-
-); diff --git a/src/gigs-board/entity/post/card.jsx b/src/gigs-board/entity/post/card.jsx index 5ddb07013..8f9e05451 100644 --- a/src/gigs-board/entity/post/card.jsx +++ b/src/gigs-board/entity/post/card.jsx @@ -242,7 +242,7 @@ const header = ( {editControl} {timestamp} - {widget("entity.post.History", { + {widget("entity.post.history", { post, timestamp: currentTimestamp, })} @@ -535,7 +535,6 @@ function Editor() { : undefined, mode: "Create", - onDraftStateChange: props.onDraftStateChange, parent_id: postId, post_type: state.post_type, } @@ -548,7 +547,6 @@ function Editor() { draftState?.edit_post_id === postId ? draftState : undefined, mode: "Edit", - onDraftStateChange: props.onDraftStateChange, post_type: state.post_type, sponsorship_token: tokenResolver( @@ -639,7 +637,6 @@ const postsList = { id: childId, isUnderPost: true, - onDraftStateChange: props.onDraftStateChange, draftState, expandParent: () => diff --git a/src/gigs-board/entity/post/editor.jsx b/src/gigs-board/entity/post/editor.jsx index 0cc848b18..da3b8217e 100644 --- a/src/gigs-board/entity/post/editor.jsx +++ b/src/gigs-board/entity/post/editor.jsx @@ -181,7 +181,6 @@ const PostEditor = ({ draftState, github_link, onCancel, - onDraftStateChange, parent_id, referral, requested_sponsor, @@ -208,7 +207,7 @@ const PostEditor = ({ /** * Should always be updated along with `state.tags` */ - tagOptions: tags.map((tag) => ({ name: tag })), + tagOptions: (tags ?? []).map((tag) => ({ name: tag })), name: name ?? "", description: description ?? "", amount: requested_sponsorship_amount ?? amount ?? "0", diff --git a/src/gigs-board/entity/post/search_panel.jsx b/src/gigs-board/entity/post/search_panel.jsx index 2fecb8864..25116e6ad 100644 --- a/src/gigs-board/entity/post/search_panel.jsx +++ b/src/gigs-board/entity/post/search_panel.jsx @@ -760,7 +760,7 @@ return ( )} {state.term && state.term.length > 1 && state.searchResult - ? widget("entity.post.List", { + ? widget("entity.post.list", { searchResult: { postIds: state.searchResult, keywords: Object.fromEntries( @@ -773,7 +773,7 @@ return ( tag: props.tag, author: props.author, }) - : widget("entity.post.List", { + : widget("entity.post.list", { recency: props.recency, tag: props.tag, author: props.author, diff --git a/src/gigs-board/entity/post/spawner.jsx b/src/gigs-board/entity/post/spawner.jsx index 3d6200b7f..8caf99b48 100644 --- a/src/gigs-board/entity/post/spawner.jsx +++ b/src/gigs-board/entity/post/spawner.jsx @@ -149,11 +149,11 @@ const PostSpawner = ({ isHidden, onCancel, tags }) => { ))} - -

- {postTypeOptions[state.post_type].description} -

+

+ {postTypeOptions[state.post_type].description} +

+ {widget("entity.post.editor", { mode: "Create", diff --git a/src/gigs-board/pages/community/activity.jsx b/src/gigs-board/pages/community/activity.jsx index 76c00c8a6..78d8f3698 100644 --- a/src/gigs-board/pages/community/activity.jsx +++ b/src/gigs-board/pages/community/activity.jsx @@ -191,7 +191,7 @@ const CommunityActivityPage = ({ handle }) => { tags: [communityData.tag], })} - {widget("entity.post.List", { tag: communityData.tag })} + {widget("entity.post.list", { tag: communityData.tag })} diff --git a/src/gigs-board/pages/new_post.jsx b/src/gigs-board/pages/new_post.jsx index f616236e6..bd820208e 100644 --- a/src/gigs-board/pages/new_post.jsx +++ b/src/gigs-board/pages/new_post.jsx @@ -122,29 +122,9 @@ const NewPostPage = ({ transactionHashes }) => { })); return widget("components.template.app-layout", { - banner: ( -
- -
- ), - children: (
@@ -162,7 +142,7 @@ const NewPostPage = ({ transactionHashes }) => {

) : ( <> -
+

What do you want to create?

@@ -187,11 +167,11 @@ const NewPostPage = ({ transactionHashes }) => { ))}
-
-

- {postTypeOptions[state.post_type].description} -

+

+ {postTypeOptions[state.post_type].description} +

+
{widget("entity.post.editor", { mode: "Create",