diff --git a/src/components/catalog/CatalogCard.astro b/src/components/catalog/CatalogCard.astro new file mode 100644 index 00000000..67da997a --- /dev/null +++ b/src/components/catalog/CatalogCard.astro @@ -0,0 +1,58 @@ +--- +interface Props { + page: number | string | undefined; + lang: string; +} +interface Asset { + title: string; + description: string; + author: string; + image: string; + tags: []; + version: string; + background_image: string | null; + background_video: string | null; + payload: string; + type: "theme" | "plugin-sw" | "plugin-page"; +} +const { page, lang } = Astro.props; +const getAssets = async () => { + const res = await fetch(new URL(`/api/catalog-assets?page=${page}`, Astro.url)); + const data = await res.json(); + return data.assets; +}; +const assets = await getAssets(); +--- +
+ {Object.keys(assets).length > 0 && ( +
+ {Object.entries(assets).map((asset) => { + const pName = asset[0]; + const a = asset[1] as unknown as Asset; + return ( + +
+ {a.title} +
+

{a.title}

+

{a.description}

+
+ {a.tags.map((tag) => ( +

{ tag }

+ ))} +
+

+ Version: { a.version } +

+

+ Type: { a.type === "plugin-page" || a.type === "plugin-sw" ? "plugin" : a.type } +

+
+
+
+ ) + } + )} +
+ )} +
diff --git a/src/components/catalog/CatalogCard.svelte b/src/components/catalog/CatalogCard.svelte deleted file mode 100644 index ffc46233..00000000 --- a/src/components/catalog/CatalogCard.svelte +++ /dev/null @@ -1,50 +0,0 @@ - - -
- - {#snippet loading()} -

Loading...

- {/snippet} - {#snippet children(suspend)} - {#await suspend(assets) then data} - {#if Object.keys(data).length > 0} - - {/if} - {/await} - {/snippet} -
-
diff --git a/src/pages/[lang]/catalog/[...page].astro b/src/pages/[lang]/catalog/[...page].astro index 8962d04d..693183ee 100644 --- a/src/pages/[lang]/catalog/[...page].astro +++ b/src/pages/[lang]/catalog/[...page].astro @@ -1,5 +1,5 @@ --- -import CatalogCard from "@components/catalog/CatalogCard.svelte"; +import CatalogCard from "@components/catalog/CatalogCard.astro"; import Layout from "@layouts/Layout.astro"; import { getLangFromUrl, useTranslations } from "../../../i18n/utils"; import Pagnation from "./pagnation.astro"; @@ -22,7 +22,7 @@ const lastPage = assetsJson.pages;

Nebula Catalog

The Nebula Catalog is a place for you to find user-created themes and plugins.

- +
{/* The first page. If the user is on this page, or the one after it, don't show it. */} {parseInt(page!) > 2 && (