Skip to content

Commit

Permalink
https://github.com/ecency/vision-next/issues/108
Browse files Browse the repository at this point in the history
Added loading more indicator for profile and communities
  • Loading branch information
dkildar committed Oct 22, 2024
1 parent cb032e0 commit 14fb1a4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { DetectBottom, EntryListContent } from "@/features/shared";
import { DetectBottom, EntryListContent, EntryListContentLoading } from "@/features/shared";
import React, { useMemo } from "react";
import { usePostsFeedQuery } from "@/api/queries";
import { Community, Entry } from "@/entities";
Expand All @@ -11,7 +11,7 @@ interface Props {
}

export function CommunityContentInfiniteList({ section, community }: Props) {
const { fetchNextPage, data } = usePostsFeedQuery(section, community.name);
const { fetchNextPage, data, isFetching } = usePostsFeedQuery(section, community.name);

const entryList = useMemo(
() =>
Expand All @@ -32,6 +32,8 @@ export function CommunityContentInfiniteList({ section, community }: Props) {
showEmptyPlaceholder={false}
/>
<DetectBottom onBottom={() => fetchNextPage()} />

{isFetching && <EntryListContentLoading />}
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { DetectBottom, EntryListContent } from "@/features/shared";
import { DetectBottom, EntryListContent, EntryListContentLoading } from "@/features/shared";
import React, { useMemo } from "react";
import { usePostsFeedQuery } from "@/api/queries";
import { Entry, FullAccount } from "@/entities";
Expand All @@ -11,7 +11,7 @@ interface Props {
}

export function ProfileEntriesInfiniteList({ section, account }: Props) {
const { fetchNextPage, data } = usePostsFeedQuery(section, `@${account.name}`);
const { fetchNextPage, data, isFetching } = usePostsFeedQuery(section, `@${account.name}`);

const entryList = useMemo(
() =>
Expand All @@ -34,6 +34,7 @@ export function ProfileEntriesInfiniteList({ section, account }: Props) {
showEmptyPlaceholder={false}
/>
<DetectBottom onBottom={() => fetchNextPage()} />
{isFetching && <EntryListContentLoading />}
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import i18next from "i18next";

export function EntryListContentLoading() {
return (
<div className="flex items-center justify-center p-4">
{i18next.t("decks.columns.infinite-loading")}
</div>
);
}
2 changes: 2 additions & 0 deletions src/features/shared/entry-list-content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ export function EntryListContent({
</>
);
}

export * from "./entry-list-content-loading";

0 comments on commit 14fb1a4

Please sign in to comment.