Skip to content

Commit

Permalink
πŸ” Rename publication to post for v3 preparation: v9 (#pre-lens-v3)
Browse files Browse the repository at this point in the history
Summary: Renamed "publication" to "post" and added a new reporting feature.

Highlights:

β€’ Renamed components and variables from `Publication` to `Post`.
β€’ Added `Reason` component for selecting report reasons and subreasons.
β€’ Implemented `ReportPost` component for reporting posts with comments.

Read more: https://pierre.co/hey/hey/pre-lens-v3
  • Loading branch information
Yoginth authored and Pierre committed Nov 13, 2024
1 parent 2d64d44 commit ee82cb9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/components/Shared/GlobalModals.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NewPublication from "@components/Composer/NewPublication";
import ReportPublication from "@components/Shared/Modal/ReportPublication";
import ReportPost from "@components/Shared/Modal/ReportPost";
import { Modal } from "@hey/ui";
import type { FC } from "react";
import { useGlobalModalStateStore } from "src/store/non-persisted/useGlobalModalStateStore";
Expand Down Expand Up @@ -56,7 +56,7 @@ const GlobalModals: FC = () => {
show={showPublicationReportModal}
title="Report Publication"
>
<ReportPublication postId={reportingPublicationId} />
<ReportPost postId={reportingPublicationId} />
</Modal>
<Modal
onClose={() => setShowReportProfileModal(false, reportingProfile)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ import { useProfileStatus } from "src/store/non-persisted/useProfileStatus";
import { object, string, type z } from "zod";
import Reason from "./Reason";

const newReportPublicationSchema = object({
const newReportPostSchema = object({
additionalComments: string().max(260, {
message: "Additional comments should not exceed 260 characters"
})
});

interface ReportProps {
interface ReportPostProps {
postId: null | string;
}

const ReportPublication: FC<ReportProps> = ({ postId }) => {
const ReportPost: FC<ReportPostProps> = ({ postId }) => {
const { isSuspended } = useProfileStatus();
const [type, setType] = useState("");
const [subReason, setSubReason] = useState("");

const form = useZodForm({
schema: newReportPublicationSchema
schema: newReportPostSchema
});

const [
Expand All @@ -48,9 +48,9 @@ const ReportPublication: FC<ReportProps> = ({ postId }) => {
}
});

const reportPublication = async ({
const reportPost = async ({
additionalComments
}: z.infer<typeof newReportPublicationSchema>) => {
}: z.infer<typeof newReportPostSchema>) => {
if (isSuspended) {
return toast.error(Errors.Suspended);
}
Expand Down Expand Up @@ -85,7 +85,7 @@ const ReportPublication: FC<ReportProps> = ({ postId }) => {
/>
) : postId ? (
<div className="p-5">
<Form className="space-y-4" form={form} onSubmit={reportPublication}>
<Form className="space-y-4" form={form} onSubmit={reportPost}>
{submitError ? (
<ErrorMessage error={submitError} title="Failed to report" />
) : null}
Expand Down Expand Up @@ -118,4 +118,4 @@ const ReportPublication: FC<ReportProps> = ({ postId }) => {
);
};

export default ReportPublication;
export default ReportPost;

1 comment on commit ee82cb9

@vercel
Copy link

@vercel vercel bot commented on ee82cb9 Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web – ./

heyxyz.vercel.app
web-git-main-heyxyz.vercel.app
hey.xyz
web-heyxyz.vercel.app

Please sign in to comment.