Files
immich-redaktions-plugin/src/components/ui/url-pagination.tsx
T
Leon TonhäuserandClaude Opus 5.5 cba70310f9 Release 2.4.0: bulk download rework, toasts and Sakani polish
- ZIP download from the Merkzettel: every photo is a new usage by
  default; only already downloaded photos offer "Neu / Bereits genutzt"
  (SegmentedControl), with thumbnails and a cost summary. "Bild
  auslassen" is gone.
- Toasts (Sakani Toaster) for admin saves, deletes and errors; billing
  errors are readable and use router.refresh instead of reloads. Errors
  inside modal dialogs stay inline (a toast would sit behind the
  backdrop).
- Album overview in blog-listing style, Sakani Pagination for albums,
  search and usage history, skeleton loading states.
- Registration stepper; verification mail lands on step 3.
- Editorials as a searchable, filterable table; audit log with event
  picker, German labels and collapsible details.
- Release notes 2.4.0 seeded (migration 0009).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 00:09:37 +01:00

37 lines
1.1 KiB
TypeScript

"use client";
import { useRouter } from "next/navigation";
import { Pagination } from "@sakaniui/react";
/**
* Sakani pagination driven by the URL. `href` is the current page's URL with
* every active filter; a page change swaps only `param` in it.
* ponytail: the APIs behind it report "has next page", not a page count, so
* the last known page is current + 1. Pass a real total once one exists.
*/
export function UrlPagination({
href,
page,
hasNext,
param = "page",
ariaLabel = "Seiten",
}: Readonly<{ href: string; page: number; hasNext: boolean; param?: string; ariaLabel?: string }>) {
const router = useRouter();
const total = hasNext ? page + 1 : page;
if (total <= 1) return null;
return (
<nav aria-label={ariaLabel} className="mt-6 flex justify-center border-t border-[var(--color-border-subtle)] pt-4">
<Pagination
onPageChange={(next) => {
const url = new URL(href, window.location.origin);
url.searchParams.set(param, String(next));
router.push(`${url.pathname}${url.search}`);
}}
page={page}
total={total}
/>
</nav>
);
}