fix: some stuff
All checks were successful
Deploy to SFTP Server / build (push) Successful in 24m33s
All checks were successful
Deploy to SFTP Server / build (push) Successful in 24m33s
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import type { ImageMetadata } from "astro";
|
import type { ImageMetadata } from "astro";
|
||||||
import { Picture as AstroImage } from "astro:assets";
|
import { Picture as AstroImage } from "astro:assets";
|
||||||
import { inferRemoteSize, inferSize } from "astro/assets/utils";
|
import { inferRemoteSize } from "astro/assets/utils";
|
||||||
import { getProcessedImage } from "@helpers/image";
|
import { getProcessedImage } from "@helpers/image";
|
||||||
interface Props {
|
interface Props {
|
||||||
src: ImageMetadata & { fsPath?: string; src?: string };
|
src: ImageMetadata & { fsPath?: string; src?: string };
|
||||||
@@ -21,7 +21,7 @@ async function checkImage(
|
|||||||
const src = typeof image === "string" ? image : image.src;
|
const src = typeof image === "string" ? image : image.src;
|
||||||
if (!src) return;
|
if (!src) return;
|
||||||
try {
|
try {
|
||||||
if (src.startsWith("/@fs") || src.startsWith("/_astro")) return {};
|
if (src.startsWith("/@fs") || src.startsWith("/_astro")) return image;
|
||||||
const res = await inferRemoteSize(src);
|
const res = await inferRemoteSize(src);
|
||||||
if (res.format) {
|
if (res.format) {
|
||||||
image.format = res.format;
|
image.format = res.format;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Layout from "@layouts/Layout.astro";
|
|||||||
import { useTranslatedPath } from "@i18n/utils";
|
import { useTranslatedPath } from "@i18n/utils";
|
||||||
import ResourceDisplay from "@components/resources/Display.astro";
|
import ResourceDisplay from "@components/resources/Display.astro";
|
||||||
import * as memorium from "@helpers/memorium";
|
import * as memorium from "@helpers/memorium";
|
||||||
import { resources as resourceTypes } from "../resources.ts";
|
import { resources as resourceTypes } from "@content/resources.ts";
|
||||||
|
|
||||||
const { resourceType, resourceName } = Astro?.params;
|
const { resourceType, resourceName } = Astro?.params;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import Layout from "@layouts/Layout.astro";
|
import Layout from "@layouts/Layout.astro";
|
||||||
import HeroCard from "@components/HeroCard.astro";
|
import HeroCard from "@components/HeroCard.astro";
|
||||||
import * as memorium from "@helpers/memorium";
|
import * as memorium from "@helpers/memorium";
|
||||||
import { resources as resourceTypes } from "../resources.ts";
|
import { resources as resourceTypes } from "@content/resources.ts";
|
||||||
import { useTranslations } from "@i18n/utils";
|
import { useTranslations } from "@i18n/utils";
|
||||||
import ClientSearch from "@components/ClientSearch.svelte";
|
import ClientSearch from "@components/ClientSearch.svelte";
|
||||||
|
|
||||||
@@ -36,13 +36,17 @@ function isValidResource(res: any) {
|
|||||||
|
|
||||||
function buildSearchTerm(res: any) {
|
function buildSearchTerm(res: any) {
|
||||||
if (!res) return "";
|
if (!res) return "";
|
||||||
return Object.keys(res).map((key) => {
|
return Object.keys(res)
|
||||||
|
.map((key) => {
|
||||||
if (key.startsWith("_")) return;
|
if (key.startsWith("_")) return;
|
||||||
const value = res[key];
|
const value = res[key];
|
||||||
if (Array.isArray(value)) return value.join(" ");
|
if (Array.isArray(value)) return value.join(" ");
|
||||||
if (typeof value === "object") return buildSearchTerm(value);
|
if (typeof value === "object") return buildSearchTerm(value);
|
||||||
return value
|
return value;
|
||||||
}).filter(s => !!s?.length).join(" ").toLowerCase();
|
})
|
||||||
|
.filter((s) => !!s?.length)
|
||||||
|
.join(" ")
|
||||||
|
.toLowerCase();
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import Layout from "@layouts/Layout.astro";
|
import Layout from "@layouts/Layout.astro";
|
||||||
import HeroCard from "@components/HeroCard.astro";
|
import HeroCard from "@components/HeroCard.astro";
|
||||||
import { resources } from "./resources.ts";
|
import { resources } from "@content/resources.ts";
|
||||||
import { useTranslations } from "@i18n/utils";
|
import { useTranslations } from "@i18n/utils";
|
||||||
import * as memorium from "@helpers/memorium";
|
import * as memorium from "@helpers/memorium";
|
||||||
|
|
||||||
@@ -13,8 +13,10 @@ async function getCoverImage(resourceName:string){
|
|||||||
let amount = 0;
|
let amount = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
amount++;
|
amount++;
|
||||||
const randomResource = resources?.content[Math.floor(Math.random() * resources?.content.length)];
|
const randomResource =
|
||||||
const cover = randomResource?.content?.cover || randomResource?.content?.image;
|
resources?.content[Math.floor(Math.random() * resources?.content.length)];
|
||||||
|
const cover =
|
||||||
|
randomResource?.content?.cover || randomResource?.content?.image;
|
||||||
if (cover) {
|
if (cover) {
|
||||||
if (cover.startsWith("https://") || cover.startsWith("http://")) {
|
if (cover.startsWith("https://") || cover.startsWith("http://")) {
|
||||||
continue;
|
continue;
|
||||||
@@ -26,15 +28,16 @@ async function getCoverImage(resourceName:string){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Max Richter">
|
<Layout title="Max Richter">
|
||||||
{
|
{
|
||||||
await Promise.all(resources.map(async (resource) => {
|
await Promise.all(
|
||||||
|
resources.map(async (resource) => {
|
||||||
const cover = await getCoverImage(resource.id);
|
const cover = await getCoverImage(resource.id);
|
||||||
console.log({cover})
|
console.log({ cover });
|
||||||
return <HeroCard
|
return (
|
||||||
|
<HeroCard
|
||||||
post={{
|
post={{
|
||||||
...resource,
|
...resource,
|
||||||
body: t(`${resource.id}.description`),
|
body: t(`${resource.id}.description`),
|
||||||
@@ -44,6 +47,8 @@ async function getCoverImage(resourceName:string){
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}))
|
);
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user