Skip to content

Commit

Permalink
πŸ” Rename publication to post for v3 preparation: v7 (#pre-lens-v3)
Browse files Browse the repository at this point in the history
Summary: Renamed "publication" to "post" across components and stores for v3 preparation.

Highlights:

β€’ Updated store paths and imports from `publication` to `post`.
β€’ Modified UI text and CSS classes to reflect "post" terminology.
β€’ Added `Posts.tsx` for exporting posts, replacing `Publications.tsx`.

Read more: https://pierre.co/hey/hey/pre-lens-v3
  • Loading branch information
Yoginth authored and Pierre committed Nov 13, 2024
1 parent 1b50e17 commit 169301a
Show file tree
Hide file tree
Showing 51 changed files with 152 additions and 164 deletions.
6 changes: 3 additions & 3 deletions apps/api/src/routes/internal/gardener/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import validateLensAccount from "src/helpers/middlewares/validateLensAccount";
import { invalidBody, noBody } from "src/helpers/responses";
import { array, object, string } from "zod";

export const reportPublication = async (
export const reportPost = async (
id: string,
subreasons: string[],
accessToken: string
Expand Down Expand Up @@ -71,8 +71,8 @@ export const post = [

try {
const accessToken = req.headers["x-access-token"] as string;
await reportPublication(id, subreasons, accessToken);
logger.info(`[Lens] Reported publication ${id}`);
await reportPost(id, subreasons, accessToken);
logger.info(`[Lens] Reported post ${id}`);

return res
.status(200)
Expand Down
12 changes: 6 additions & 6 deletions apps/api/src/routes/internal/profile/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import validateIsStaff from "src/helpers/middlewares/validateIsStaff";
import validateLensAccount from "src/helpers/middlewares/validateLensAccount";
import { invalidBody, noBody } from "src/helpers/responses";
import { array, object, string } from "zod";
import { reportPublication } from "../gardener/report";
import { reportPost } from "../gardener/report";

interface ExtensionRequest {
id: string;
Expand Down Expand Up @@ -39,7 +39,7 @@ export const post = [

try {
const accessToken = req.headers["x-access-token"] as string;
const publication = await lensPg.query(
const post = await lensPg.query(
`
SELECT publication_id AS id
FROM publication.record
Expand All @@ -50,19 +50,19 @@ export const post = [
[id]
);

const publicationId = publication[0]?.id;
const postId = post[0]?.id;

if (!publicationId) {
if (!postId) {
return res.status(404).json({
result: "Nothing to report",
success: true
});
}

await reportPublication(publicationId, subreasons, accessToken);
await reportPost(postId, subreasons, accessToken);
logger.info(`[Lens] Reported profile ${id}`);

return res.status(200).json({ result: publicationId, success: true });
return res.status(200).json({ result: postId, success: true });
} catch (error) {
return catchedError(res, error);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Composer/Actions/Attachment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { ChangeEvent, FC, MutableRefObject } from "react";
import { useId, useState } from "react";
import toast from "react-hot-toast";
import useUploadAttachments from "src/hooks/useUploadAttachments";
import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore";
import { usePostAttachmentStore } from "src/store/non-persisted/post/usePostAttachmentStore";

const ImageMimeType = Object.values(MediaImageMimeType);
const AudioMimeType = Object.values(MediaAudioMimeType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CollectOpenActionModuleType } from "@hey/lens";
import type { CollectModuleType } from "@hey/types/hey";
import { Input, Select } from "@hey/ui";
import type { FC } from "react";
import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore";
import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectModuleStore";
import { useAllowedTokensStore } from "src/store/persisted/useAllowedTokensStore";
import { useProfileStore } from "src/store/persisted/useProfileStore";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { CollectOpenActionModuleType } from "@hey/lens";
import type { CollectModuleType } from "@hey/types/hey";
import { Button } from "@hey/ui";
import type { Dispatch, FC, SetStateAction } from "react";
import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore";
import { usePostLicenseStore } from "src/store/non-persisted/publication/usePostLicenseStore";
import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectModuleStore";
import { usePostLicenseStore } from "src/store/non-persisted/post/usePostLicenseStore";
import { isAddress } from "viem";
import AmountConfig from "./AmountConfig";
import CollectLimitConfig from "./CollectLimitConfig";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StarIcon } from "@heroicons/react/24/outline";
import type { CollectModuleType } from "@hey/types/hey";
import { Input } from "@hey/ui";
import type { FC } from "react";
import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore";
import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectModuleStore";

interface CollectLimitConfigProps {
setCollectType: (data: CollectModuleType) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ToggleWithHelper from "@components/Shared/ToggleWithHelper";
import { UserGroupIcon } from "@heroicons/react/24/outline";
import type { CollectModuleType } from "@hey/types/hey";
import type { FC } from "react";
import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore";
import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectModuleStore";

interface FollowersConfigProps {
setCollectType: (data: CollectModuleType) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CollectOpenActionModuleType } from "@hey/lens";
import type { CollectModuleType } from "@hey/types/hey";
import { RangeSlider } from "@hey/ui";
import type { FC } from "react";
import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore";
import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectModuleStore";

interface ReferralConfigProps {
setCollectType: (data: CollectModuleType) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { CollectModuleType } from "@hey/types/hey";
import { Button, H6, Input } from "@hey/ui";
import type { FC } from "react";
import { useState } from "react";
import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore";
import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectModuleStore";
import { useProfileStore } from "src/store/persisted/useProfileStore";
import { isAddress } from "viem";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getTimeAddedNDay from "@hey/helpers/datetime/getTimeAddedNDay";
import type { CollectModuleType } from "@hey/types/hey";
import { RangeSlider } from "@hey/ui";
import type { FC } from "react";
import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore";
import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectModuleStore";

interface TimeLimitConfigProps {
setCollectType: (data: CollectModuleType) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ShoppingBagIcon } from "@heroicons/react/24/outline";
import { Modal, Tooltip } from "@hey/ui";
import type { FC } from "react";
import { useState } from "react";
import { useCollectModuleStore } from "src/store/non-persisted/publication/useCollectModuleStore";
import { usePostLicenseStore } from "src/store/non-persisted/publication/usePostLicenseStore";
import { useCollectModuleStore } from "src/store/non-persisted/post/useCollectModuleStore";
import { usePostLicenseStore } from "src/store/non-persisted/post/usePostLicenseStore";
import CollectForm from "./CollectForm";

const CollectSettings: FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Composer/Actions/Gif/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Modal, Tooltip } from "@hey/ui";
import cn from "@hey/ui/cn";
import type { FC } from "react";
import { useState } from "react";
import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore";
import { usePostAttachmentStore } from "src/store/non-persisted/post/usePostAttachmentStore";
import GifSelector from "./GifSelector";

interface GifProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import axios from "axios";
import type { FC, ReactNode } from "react";
import { useState } from "react";
import toast from "react-hot-toast";
import { usePostLiveStore } from "src/store/non-persisted/publication/usePostLiveStore";
import { usePostLiveStore } from "src/store/non-persisted/post/usePostLiveStore";

interface WrapperProps {
children: ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { VideoCameraIcon } from "@heroicons/react/24/outline";
import { Tooltip } from "@hey/ui";
import cn from "@hey/ui/cn";
import type { FC } from "react";
import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore";
import { usePostLiveStore } from "src/store/non-persisted/publication/usePostLiveStore";
import { usePostAttachmentStore } from "src/store/non-persisted/post/usePostAttachmentStore";
import { usePostLiveStore } from "src/store/non-persisted/post/usePostLiveStore";

const LivestreamSettings: FC = () => {
const { resetLiveVideoConfig, setShowLiveVideoEditor, showLiveVideoEditor } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Button, Card, Input, Modal, Tooltip } from "@hey/ui";
import plur from "plur";
import type { FC } from "react";
import { useState } from "react";
import { usePostPollStore } from "src/store/non-persisted/publication/usePostPollStore";
import { usePostPollStore } from "src/store/non-persisted/post/usePostPollStore";

const PollEditor: FC = () => {
const { pollConfig, resetPollConfig, setPollConfig, setShowPollEditor } =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Bars3BottomLeftIcon } from "@heroicons/react/24/solid";
import { Tooltip } from "@hey/ui";
import type { FC } from "react";
import { usePostPollStore } from "src/store/non-persisted/publication/usePostPollStore";
import { usePostPollStore } from "src/store/non-persisted/post/usePostPollStore";

const PollSettings: FC = () => {
const { resetPollConfig, setShowPollEditor, showPollEditor } =
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Composer/ChooseThumbnail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Spinner } from "@hey/ui";
import type { ChangeEvent, FC } from "react";
import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore";
import { usePostVideoStore } from "src/store/non-persisted/publication/usePostVideoStore";
import { usePostAttachmentStore } from "src/store/non-persisted/post/usePostAttachmentStore";
import { usePostVideoStore } from "src/store/non-persisted/post/usePostVideoStore";

const DEFAULT_THUMBNAIL_INDEX = 0;
export const THUMBNAIL_GENERATE_COUNT = 4;
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/components/Composer/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useMemo, useRef } from "react";
import useContentChange from "src/hooks/prosekit/useContentChange";
import useFocus from "src/hooks/prosekit/useFocus";
import { usePaste } from "src/hooks/prosekit/usePaste";
import { usePostStore } from "src/store/non-persisted/publication/usePostStore";
import { usePostStore } from "src/store/non-persisted/post/usePostStore";
import { useProfileStore } from "src/store/persisted/useProfileStore";
import { useEditorHandle } from "./EditorHandle";

Expand All @@ -20,8 +20,8 @@ const EditorMenus = dynamic(() => import("./EditorMenus"), { ssr: false });

const Editor: FC = () => {
const { currentProfile } = useProfileStore();
const { publicationContent } = usePostStore();
const defaultMarkdownRef = useRef(publicationContent);
const { postContent } = usePostStore();
const defaultMarkdownRef = useRef(postContent);

const defaultContent = useMemo(() => {
const markdown = defaultMarkdownRef.current;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Composer/LicensePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Select, Tooltip } from "@hey/ui";
import { MetadataLicenseType } from "@lens-protocol/metadata";
import Link from "next/link";
import type { FC } from "react";
import { usePostLicenseStore } from "src/store/non-persisted/publication/usePostLicenseStore";
import { usePostLicenseStore } from "src/store/non-persisted/post/usePostLicenseStore";

const LicensePicker: FC = () => {
const { license, setLicense } = usePostLicenseStore();
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/components/Composer/LinkPreviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import getURLs from "@hey/helpers/getURLs";
import { MetadataAttributeType } from "@lens-protocol/metadata";
import type { FC } from "react";
import { useEffect, useState } from "react";
import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore";
import { usePostAttributesStore } from "src/store/non-persisted/publication/usePostAttributesStore";
import { usePostStore } from "src/store/non-persisted/publication/usePostStore";
import { usePostAttachmentStore } from "src/store/non-persisted/post/usePostAttachmentStore";
import { usePostAttributesStore } from "src/store/non-persisted/post/usePostAttributesStore";
import { usePostStore } from "src/store/non-persisted/post/usePostStore";

const LinkPreviews: FC = () => {
const { publicationContent, quotedPost } = usePostStore();
const { postContent, quotedPost } = usePostStore();
const { attachments } = usePostAttachmentStore((state) => state);
const { addAttribute, getAttribute, removeAttribute } =
usePostAttributesStore();
const [showRemove, setShowRemove] = useState(false);

const urls = getURLs(publicationContent);
const urls = getURLs(postContent);

useEffect(() => {
if (urls.length) {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Composer/NewAttachments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { Image, ProgressBar, Tooltip } from "@hey/ui";
import cn from "@hey/ui/cn";
import type { FC } from "react";
import { useEffect, useRef } from "react";
import { usePostAttachmentStore } from "src/store/non-persisted/publication/usePostAttachmentStore";
import { usePostVideoStore } from "src/store/non-persisted/publication/usePostVideoStore";
import { usePostAttachmentStore } from "src/store/non-persisted/post/usePostAttachmentStore";
import { usePostVideoStore } from "src/store/non-persisted/post/usePostVideoStore";
import Audio from "../Shared/Audio";

const getClass = (attachments: number) => {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/components/Composer/NewPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Card, Image } from "@hey/ui";
import { useRouter } from "next/router";
import type { FC } from "react";
import { useEffect, useState } from "react";
import { usePostStore } from "src/store/non-persisted/publication/usePostStore";
import { usePostStore } from "src/store/non-persisted/post/usePostStore";
import { useProfileStore } from "src/store/persisted/useProfileStore";
import NewPublication from "./NewPublication";

Expand All @@ -15,7 +15,7 @@ interface NewPostProps {
const NewPost: FC<NewPostProps> = ({ tags }) => {
const { isReady, query } = useRouter();
const { currentProfile } = useProfileStore();
const { setPublicationContent, setTags } = usePostStore();
const { setPostContent, setTags } = usePostStore();
const [showComposer, setShowComposer] = useState(false);

const handleOpenModal = () => {
Expand All @@ -42,7 +42,7 @@ const NewPost: FC<NewPostProps> = ({ tags }) => {
}${url ? `\n\n${url}` : ""}${via ? `\n\nvia @${via}` : ""}`;

handleOpenModal();
setPublicationContent(content);
setPostContent(content);
}
}, [query]);

Expand Down
Loading

1 comment on commit 169301a

@vercel
Copy link

@vercel vercel bot commented on 169301a 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
web-heyxyz.vercel.app
hey.xyz

Please sign in to comment.