diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb25fe7..f3bf3e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,5 +83,5 @@ jobs: - name: Build env: DATABASE_URL: "postgresql://dummy:dummy@localhost:5432/dummy" - BETTER_AUTH_SECRET: "dummy_token" + BETTER_AUTH_SECRET: "dummy_token_p0WBNW62p4EpbUF6HxOzmRYhSbSc98LjPaD8umwduY8=" run: yarn admin:build diff --git a/apps/admin/src/layouts/pagination-layout/index.ts b/apps/admin/src/layouts/pagination-layout/index.ts deleted file mode 100644 index 0f85080..0000000 --- a/apps/admin/src/layouts/pagination-layout/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./pagination-layout"; diff --git a/apps/admin/src/layouts/pagination-layout/pagination-layout.module.scss b/apps/admin/src/layouts/pagination-layout/pagination-layout.module.scss deleted file mode 100644 index ec62b15..0000000 --- a/apps/admin/src/layouts/pagination-layout/pagination-layout.module.scss +++ /dev/null @@ -1,90 +0,0 @@ -@use "styles/utils" as utils; - -.container { - height: 100%; - background-color: #fff; - border: 1px solid utils.$borderColor; - border-radius: 8px; -} - -.condition { - background-color: #f5f5f5; - border-radius: 8px 8px 0 0; - border-bottom: 1px solid utils.$borderColor; -} - -.content { - height: calc(100vh - 300px); - padding: 1rem 1rem 2rem; -} - -.results { - margin: 0 0 1rem; - font-weight: bold; -} - -.table { - width: 100%; - margin-bottom: 1rem; - - thead { - position: sticky; - top: 0; - z-index: 1; - } - - .header { - display: flex; - font-weight: bold; - padding-top: 0.5rem; - text-align: left; - border-bottom: 1px solid; - border-bottom-color: utils.$borderColor; - } - - .body { - // TODO: ajust scroll - height: calc(100% - 100px); - overflow-y: scroll; - - &::-webkit-scrollbar { - display: none; - } - } - - td { - padding: 0.5rem; - text-align: left; - line-height: 1.5; - - .icon { - width: 24px; - vertical-align: bottom; - } - } - - .row { - display: flex; - align-items: center; - } -} - -.row { - border-bottom: 1px solid utils.$borderColor; - display: flex; - align-items: center; - text-align: left; - padding: 0.5rem 0; -} - -.paginationBox { - display: flex; - justify-content: center; - width: 100%; - - .pagination { - position: absolute; - width: 500px; - bottom: 120px; - } -} diff --git a/apps/admin/src/layouts/pagination-layout/pagination-layout.tsx b/apps/admin/src/layouts/pagination-layout/pagination-layout.tsx deleted file mode 100644 index 59b1d72..0000000 --- a/apps/admin/src/layouts/pagination-layout/pagination-layout.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import { type Dispatch, type SetStateAction, useCallback, useEffect, useRef, useState } from "react"; -import { usePathname, useRouter, useSearchParams } from "next/navigation"; -import { type ParsedUrlQuery } from "querystring"; -import { Pagination } from "@/components/pagination"; -import { PER_PAGE } from "@/constants/application"; -import { type OffsetPaginator } from "@/types/app"; -import ss from "./pagination-layout.module.scss"; - -export type RowProps = { data: T }; - -type Props = { - data: OffsetPaginator | undefined; - errorMessage?: string; - isLoading: boolean; - page: number; - setPage: Dispatch>; // TODO: Isn't it unnecessary if I fly it? - // query: ParsedUrlQuery; - // setQuery: Dispatch>; - - Condition?: React.ReactNode; - Header?: React.ReactNode; - headers?: { name: string; width?: string }[]; - Row: ({ data }: RowProps) => React.ReactNode; -}; - -export const PaginationLayout = function (props: Props) { - const router = useRouter(); - const pathname = usePathname(); - // const params = useSearchParams(); - // const currentPage = params.get('page'); - // const [page, setPage] = useState(currentPage ? parseInt(currentPage) : 0); - // const [query, setQuery] = useState(new URLSearchParams(params)); - const ref = useRef(null); - const scrollTop = useCallback(() => { - ref?.current?.scrollIntoView({ - behavior: "smooth", - block: "end", - }); - }, [ref]); - - // useEffect(() => { - // query.set('page', page.toString()); - // setQuery(query); - // }, [page]); - - // useEffect(() => { - // router.push(`${pathname}?${query}`); - // }, [pathname, query, router]); - - const total = props.data?.total ?? 0; - const countMessage = `${total} results`; - - if (props.errorMessage) { - return <>{props.errorMessage}; - } - - return ( -
-
{props.Condition}
-
-

{countMessage}

- - {props.Header && ( - - {props.Header} - - )} - - {props.isLoading ? ( - - - - ) : props.data && props.data.total > 0 ? ( - props.data.rows.map((v: T, i: number) => ( - - - - )) - ) : ( - - - - )} - -
Loading...
No results
- {total > 0 && ( -
- { - props.setPage(page); - scrollTop(); - }} - /> -
- )} -
-
- ); -};