diff --git a/src/components/Header.astro b/src/components/Header.astro index 44b0776..95cd7c3 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -12,9 +12,9 @@ */ import { Taxonomy, db, eq } from 'astro:db'; +import Avatar from '@components/Avatar.astro'; import { type BreadcrumbItem } from '@config'; import Breadcrumbs from '@components/Breadcrumbs.astro'; -import Avatar from '@components/Avatar.astro'; import { highlightUrl } from '@utils/urlHelpers'; export interface Props { breadcrumbArray?: BreadcrumbItem[] | undefined; diff --git a/src/components/Pagination.astro b/src/components/Pagination.astro index 35a336a..458e484 100644 --- a/src/components/Pagination.astro +++ b/src/components/Pagination.astro @@ -48,23 +48,68 @@ const pagePrototype = next ? next.replace(`/${currentPage + 1}`, '') : prev ? pr « Precedenta Pagină ) : ( - « Pagina Precedentă + Ești pe prima pagină )} - {paginationList.map((num) => ( -
  • - - {num} - -
  • - ))} + {lastPage > 15 && (currentPage < 4 || currentPage > lastPage - 3) && ( + <> + {paginationList.slice(0, 4).map((num) => ( +
  • + + {num} + +
  • + ))} +
  • + ... +
  • + {paginationList.slice(-4).map((num) => ( +
  • + + {num} + +
  • + ))} + + )} + {lastPage > 15 && currentPage >= 4 && currentPage <= lastPage - 3 && ( + <> + {paginationList.slice(0, 2).map((num) => ( +
  • + + {num} + +
  • + ))} +
  • + ... +
  • + {paginationList.slice(currentPage - 2, currentPage + 1).map((num) => ( +
  • + + {num} + +
  • + ))} +
  • + ... +
  • + {paginationList.slice(-2).map((num) => ( +
  • + + {num} + +
  • + ))} + + )}
  • {currentPage < lastPage ? ( Următoarea Pagină » ) : ( - Pagina Următoare » + Ești pe ultima pagină )}
  • diff --git a/src/components/ResourceList.astro b/src/components/ResourceList.astro index 217c385..e55d773 100644 --- a/src/components/ResourceList.astro +++ b/src/components/ResourceList.astro @@ -36,9 +36,10 @@ export interface Props { }; }; pageTitle?: string | undefined; + error?: Error | null; } -const { resources, page, pageTitle } = Astro.props satisfies Props; +const { resources, page, pageTitle, error } = Astro.props satisfies Props; let r = resources as unknown as ExtendedResource[]; const allTags = await getCollection('tags'); @@ -164,7 +165,7 @@ if (resources) { Timp necesar - {resource.data.requiredTime}h + {/*resource.requiredTime || '? '*/}h )} @@ -173,7 +174,7 @@ if (resources) { {resource.data.description && (

    - {resource.data.description} + {/*resource.description && resource.description.length > 160 ? resource.description?.substring(0, 160) : resource.description*/}

    )} {resource.data.tags && } @@ -189,5 +190,13 @@ if (resources) { ) } + { + error && ( + + + + ) + } + {page && } diff --git a/src/components/ResourceLocationList.astro b/src/components/ResourceLocationList.astro index f82cd42..5bd24f0 100644 --- a/src/components/ResourceLocationList.astro +++ b/src/components/ResourceLocationList.astro @@ -39,6 +39,9 @@ const shouldRenderSubcategoriesFromCat = subcategories && categories && resource ---
      +
    • + Găsești resursa în: +
    • { resourceSection && (
    • diff --git a/src/config.ts b/src/config.ts index 93d0f75..4e306c3 100644 --- a/src/config.ts +++ b/src/config.ts @@ -6,7 +6,7 @@ import type { CollectionEntry, CollectionKey } from 'astro:content'; const PUBLIC_APP_ENV = import.meta.env.PUBLIC_APP_ENV; const PUBLIC_APP_DEBUG = import.meta.env.PUBLIC_APP_DEBUG; -let u: string = import.meta.env.BASE_URL; +let u: string = import.meta.env.BASE_URL || import.meta.env.VERCEL_URL; if (PUBLIC_APP_ENV === 'local' || PUBLIC_APP_ENV === 'development') { // we are in a local or development environment u = import.meta.env.PUBLIC_APP_URL_LOCAL; @@ -22,7 +22,7 @@ const PUBLIC_APP_URL = u; // @TODO: make variables below asynchronous // My static config variables -export const ENV = PUBLIC_APP_ENV; +export const ENV = PUBLIC_APP_ENV || import.meta.env.VERCEL_ENV; export const DEBUG = PUBLIC_APP_DEBUG; export const URL = PUBLIC_APP_URL; export const SITE_TITLE = 'Centralizator de resurse digitale gratuite pentru învățare'; diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro index a777743..93e3e13 100644 --- a/src/pages/[...slug].astro +++ b/src/pages/[...slug].astro @@ -1,12 +1,12 @@ --- -import { Taxonomy, db, eq } from 'astro:db'; import { DEFAULT_DESCRIPTION, DEFAULT_MENULABEL, DEFAULT_TITLE, DEFAULT_URL, PAGE_SIZE, resourceTypeIcon } from '@config'; -import { taxonomiesFlat } from '@utils/getSortedItems'; +import { Taxonomy, db, eq } from 'astro:db'; import CommentList from '@components/CommentList.astro'; import Layout from '@layouts/Layout.astro'; import ResourceFilter from '@components/ResourceFilter.astro'; // import ResourceList from '@components/ResourceList.astro'; import ResourceTOC from '@components/ResourceTOC.astro'; +import { taxonomiesFlat } from '@utils/getSortedItems'; // @TODO: paginate this according to the number of resources on each taxonomy export async function getStaticPaths() { diff --git a/src/pages/index.astro b/src/pages/index.astro index 5f9ef50..db2e2a5 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,7 +1,7 @@ --- import { Tweet, Vimeo, YouTube } from 'astro-embed'; -import { SocialShare } from 'astro-social-share'; import { Content as Readme } from '../../README.md'; +import { SocialShare } from 'astro-social-share'; import Layout from '@layouts/Layout.astro'; import ResourceTOC from '@components/ResourceTOC.astro'; //import ResponsiveImage from '@components/ResponsiveImage.astro';