-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: post editing for existing posts
- Loading branch information
Showing
4 changed files
with
112 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { apiClient } from "@/app/apiClient"; | ||
import { formatCommunityName } from "@/app/c/formatCommunityName"; | ||
import { PageWithSidebar } from "@/app/PageWithSidebar"; | ||
import { PostEditor } from "@/app/create_post/PostEditor"; | ||
|
||
const EditPostPage = async (props: { readonly params: { id: number } }) => { | ||
const { | ||
post_view: postView, | ||
community_view: communityView, | ||
moderators: mods, | ||
} = await apiClient.getPost({ | ||
id: props.params.id, | ||
}); | ||
|
||
const communityName = formatCommunityName(communityView.community); | ||
|
||
return ( | ||
<PageWithSidebar | ||
communityView={communityView} | ||
hideButtons={true} | ||
mods={mods.map((mod) => mod.moderator)} | ||
stats={communityView.counts} | ||
> | ||
<div className={"m-2 lg:m-4"}> | ||
<h1 className={"mb-4 text-xl font-bold"}> | ||
{"Editing post in "} | ||
{communityName} | ||
{"..."} | ||
</h1> | ||
<PostEditor | ||
communityId={communityView.community.id} | ||
communityName={communityName} | ||
existingPostView={postView} | ||
/> | ||
</div> | ||
</PageWithSidebar> | ||
); | ||
}; | ||
|
||
export default EditPostPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters