diff --git a/.phase33-state.json b/.phase33-state.json index 748ec80..aba356c 100644 --- a/.phase33-state.json +++ b/.phase33-state.json @@ -1,8 +1,9 @@ { "completed_features": [], - "current_feature": "divider-component", + "current_feature": "pagination-component", "started_at": "2026-05-23T09:43:23.964164", "attempted_features": [ - "avatar-component" + "avatar-component", + "divider-component" ] } \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index fa393f9..40398e1 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -3676,3 +3676,21 @@ src/index.ts(27,25): error TS2769: No overload matches this call. Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. Type 'Promise' provides no match for the signature '(instance: FastifyInstance, +- `09:43:56` **INFO** Committed feature divider-component +- `09:43:57` **INFO** Pushed: rc=0 + +## Phase-3 Feature: pagination-component (2026-05-23 09:43:57) + +- `09:43:57` **INFO** Description: Pagination mit Prev/Next + Page-Numbers +- `09:43:57` **INFO** Generating apps/web/src/components/Pagination.tsx (Pagination-Component. Props: currentPage, totalPages, onPageChange(pag…) +- `09:44:17` **INFO** wrote 2456 chars in 20.7s (attempt 1) +- `09:44:17` **INFO** Running tsc --noEmit on api… +- `09:44:19` **WARN** tsc errors: +src/db/schema.ts(37,14): error TS7022: 'customers' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. +src/db/schema.ts(45,59): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +src/db/schema.ts(49,14): error TS7022: 'projects' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. +src/db/schema.ts(53,56): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +src/index.ts(27,25): error TS2769: No overload matches this call. + Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. + Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. + Type 'Promise' provides no match for the signature '(instance: FastifyInstance, diff --git a/apps/web/src/components/Pagination.tsx b/apps/web/src/components/Pagination.tsx new file mode 100644 index 0000000..374f071 --- /dev/null +++ b/apps/web/src/components/Pagination.tsx @@ -0,0 +1,72 @@ +import React from 'react'; + +interface PaginationProps { + currentPage: number; + totalPages: number; + onPageChange: (page: number) => void; +} + +export default function Pagination({ currentPage, totalPages, onPageChange }: PaginationProps) { + if (totalPages <= 1) return null; + + const getPageNumbers = () => { + const pages = []; + const maxVisible = 7; + + if (totalPages <= maxVisible) { + for (let i = 1; i <= totalPages; i++) pages.push(i); + } else { + const start = Math.max(1, currentPage - 3); + const end = Math.min(totalPages, start + maxVisible - 1); + + // Adjust start if end hit the boundary + const adjustedStart = Math.max(1, end - maxVisible + 1); + + if (adjustedStart > 1) pages.push('...'); + for (let i = adjustedStart; i <= end; i++) pages.push(i); + if (end < totalPages) pages.push('...'); + } + return pages; + }; + + return ( +
+ + +
+ {getPageNumbers().map((page, index) => ( + + {typeof page === 'number' ? ( + + ) : ( + ... + )} + + ))} +
+ + +
+ ); +} \ No newline at end of file