Skip to content

Commit

Permalink
Migrate to Lens v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoginth committed Dec 9, 2024
1 parent cdd8f34 commit fd84250
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/components/Account/FeedType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from "@heroicons/react/24/outline";
import { AccountFeedType } from "@hey/data/enums";
import { TabButton } from "@hey/ui";
import type { Dispatch, FC, SetStateAction } from "react";
import type { Dispatch, FC, JSX, SetStateAction } from "react";
import MediaFilter from "./Filters/MediaFilter";

interface FeedTypeProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import LicensePicker from "@components/Composer/LicensePicker";
import ToggleWithHelper from "@components/Shared/ToggleWithHelper";
import { PostActionType } from "@hey/indexer";
import type { CollectModuleType } from "@hey/types/hey";
import { Button } from "@hey/ui";
import type { Dispatch, FC, SetStateAction } from "react";
Expand All @@ -23,7 +24,7 @@ const CollectForm: FC<CollectFormProps> = ({ setShowModal }) => {
);
const { setLicense } = usePostLicenseStore();

const { SimpleCollectOpenActionModule } = CollectOpenActionModuleType;
const { SimpleCollectAction } = PostActionType;
const recipients = collectModule.recipients || [];
const splitTotal = recipients.reduce((acc, curr) => acc + curr.split, 0);

Expand Down Expand Up @@ -55,7 +56,7 @@ const CollectForm: FC<CollectFormProps> = ({ setShowModal }) => {
setLicense(null);
reset();
} else {
setCollectType({ type: SimpleCollectOpenActionModule });
setCollectType({ type: SimpleCollectAction });
}
};

Expand Down
18 changes: 6 additions & 12 deletions apps/web/src/components/Group/GroupFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,22 @@ import { Virtuoso } from "react-virtuoso";
let virtuosoState: any = { ranges: [], screenTop: 0 };

interface GroupFeedProps {
handle: string;
address: string;
}

const GroupFeed: FC<GroupFeedProps> = ({ handle }) => {
const GroupFeed: FC<GroupFeedProps> = ({ address }) => {
const virtuoso = useRef<VirtuosoHandle>(null);

useEffect(() => {
virtuosoState = { ranges: [], screenTop: 0 };
}, [handle]);
}, [address]);

const request: PostsRequest = {
pageSize: PageSize.Fifty,
filter: { metadata: { tags: { oneOf: [`orbcommunities${handle}`] } } }
pageSize: PageSize.Fifty
};

const { data, error, fetchMore, loading } = usePostsQuery({
skip: !handle,
skip: !address,
variables: { request }
});

Expand Down Expand Up @@ -64,12 +63,7 @@ const GroupFeed: FC<GroupFeedProps> = ({ handle }) => {
return (
<EmptyState
icon={<ChatBubbleBottomCenterIcon className="size-8" />}
message={
<div>
<b className="mr-1">/{handle}</b>
<span>has no posts yet!</span>
</div>
}
message="Group has no posts yet!"
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const ViewGroup: NextPage = () => {
) : (
<>
{currentAccount && group.isMember && <NewPost />}
<GroupFeed handle={group.handle} />
<GroupFeed address={group.address} />
</>
)}
</GridItemEight>
Expand Down
2 changes: 1 addition & 1 deletion packages/data/regex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const Regex = {
};

export const EditorRegex = {
// group looks like: /bonsai or /orbcommunities
// group looks like: /bonsai or /gho
group: new RegExp(`${MATCH_BEHIND}\/(${EDITOR_GROUP})$`, "g"),
emoji: new RegExp(`${MATCH_BEHIND}:\\w*$`, "g"),
mention: new RegExp(`${MATCH_BEHIND}@${EDITOR_MENTION}$`, "g")
Expand Down

0 comments on commit fd84250

Please sign in to comment.