if (!context.accountId) { return ""; } const composeData = () => { return { post: { main: JSON.stringify(state.content), }, index: { post: JSON.stringify({ key: "main", value: { type: "md", }, }), }, }; }; State.init({ onChange: ({ content }) => { State.update({ content }); }, }); return ( <> <Widget src="mob.near/widget/Common.Compose" props={{ composeText: "Post", onChange: state.onChange, composeButton: (onCompose) => ( <CommitButton disabled={!state.content} force className="btn btn-dark rounded-3" data={composeData} onCommit={() => { onCompose(); }} > Post </CommitButton> ), }} /> {state.content && ( <div className="mt-3"> <Widget src="mob.near/widget/MainPage.Post" props={{ accountId: context.accountId, content: state.content, blockHeight: "now", }} /> </div> )} </> );