fixup pagenation error
This commit is contained in:
@@ -47,6 +47,8 @@ const getLogsUrl = (
|
||||
|
||||
const LogsTable = ({ userId, target }) => {
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
|
||||
const [filters, setFilters] = useState({
|
||||
type: "",
|
||||
ip: "",
|
||||
@@ -195,11 +197,13 @@ const LogsTable = ({ userId, target }) => {
|
||||
<p className="ml-auto text-nowrap text-sm">
|
||||
{nFormatter(data?.total || 0)} logs
|
||||
</p>
|
||||
{data && Math.ceil(data.total / 20) > 1 && (
|
||||
{data && Math.ceil(data.total / pageSize) > 1 && (
|
||||
<PaginationWrapper
|
||||
total={data.total}
|
||||
currentPage={page}
|
||||
setCurrentPage={setPage}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
layout="right"
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -18,7 +18,7 @@ import { siteConfig } from "@/config/site";
|
||||
import { TeamPlanQuota } from "@/config/team";
|
||||
import { UserEmailList } from "@/lib/dto/email";
|
||||
import { reservedAddressSuffix } from "@/lib/enums";
|
||||
import { cn, fetcher, timeAgo } from "@/lib/utils";
|
||||
import { cn, fetcher, nFormatter, timeAgo } from "@/lib/utils";
|
||||
import { useMediaQuery } from "@/hooks/use-media-query";
|
||||
import ApiReference from "@/app/emails/api-reference";
|
||||
|
||||
@@ -88,7 +88,7 @@ export default function EmailSidebar({
|
||||
|
||||
const [showSendsModal, setShowSendsModal] = useState(false);
|
||||
|
||||
const pageSize = 10;
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
|
||||
const { data, isLoading, error, mutate } = useSWR<{
|
||||
list: UserEmailList[];
|
||||
@@ -309,7 +309,7 @@ export default function EmailSidebar({
|
||||
</p>
|
||||
</div>
|
||||
<p className="text-sm font-semibold text-gray-900 dark:text-gray-100">
|
||||
<CountUp count={data ? data.total : 0} />
|
||||
{nFormatter(data ? data.total : 0)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -322,7 +322,7 @@ export default function EmailSidebar({
|
||||
</p>
|
||||
</div>
|
||||
<p className="text-sm font-semibold text-gray-900 dark:text-gray-100">
|
||||
<CountUp count={data ? data.totalInboxCount : 0} />
|
||||
{nFormatter(data ? data.totalInboxCount : 0)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -345,7 +345,7 @@ export default function EmailSidebar({
|
||||
</p>
|
||||
</div>
|
||||
<p className="text-sm font-semibold text-gray-900 dark:text-gray-100">
|
||||
<CountUp count={data ? data.totalUnreadCount : 0} />
|
||||
{nFormatter(data ? data.totalUnreadCount : 0)}
|
||||
</p>
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
@@ -375,7 +375,7 @@ export default function EmailSidebar({
|
||||
</p>
|
||||
</div>
|
||||
<p className="text-sm font-semibold text-gray-900 dark:text-gray-100">
|
||||
<CountUp count={sendEmails || 0} />
|
||||
{nFormatter(sendEmails || 0)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -547,6 +547,8 @@ export default function EmailSidebar({
|
||||
total={data.total}
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
layout="center"
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -21,8 +21,9 @@ export default function SendsEmailList({
|
||||
}: {
|
||||
isAdminModel: boolean;
|
||||
}) {
|
||||
const pageSize = 10;
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
|
||||
const { data, isLoading, error } = useSWR<{
|
||||
@@ -116,9 +117,11 @@ export default function SendsEmailList({
|
||||
{data && totalPages > 1 && (
|
||||
<PaginationWrapper
|
||||
className="m-0 mt-6 scale-75 justify-center"
|
||||
total={totalPages}
|
||||
total={data.total}
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user