Skip to content
Snippets Groups Projects
Commit a2936cc1 authored by Moritz Stückler's avatar Moritz Stückler :cowboy:
Browse files

fix: remove debug output

parent 3c546813
No related branches found
No related tags found
No related merge requests found
Pipeline #7112 passed
......@@ -46,8 +46,6 @@ const processedSliderCaptions: ISliderCaption[] = rawSliderCaptionFiles.map(
const { folder, files, exclude, withLightbox, fullBleed, light } = Astro.props;
console.log("files", files);
let images: string[] = [];
let processedImages: ISlide[] = [];
if (folder) {
......@@ -66,32 +64,29 @@ if (files) {
);
if (onlyHasStringPaths) {
console.log("Only String Paths");
if (onlyHasUrls) {
images = files as string[];
} else {
console.log("Loading Images");
images = loadImages(false, exclude, files as string[]);
}
processedImages = mapCaptions(images, processedSliderCaptions);
} else {
console.log("Else processing");
// Extract only path from passed objects
const filesInput = files.map((file) => {
if (typeof file !== "string") {
return file.img;
}
return file;
});
console.log("Files input", filesInput);
images = loadImages(false, exclude, filesInput);
images = loadImages(
false,
exclude,
files.map((file) => {
if (typeof file !== "string") {
return file.img;
}
return file;
})
);
const passedInCaptions = files.filter(
(file) => typeof file !== "string"
) as ISlide[];
console.log("images", images);
processedImages = mapCaptions(
images,
processedSliderCaptions,
......@@ -99,7 +94,6 @@ if (files) {
);
}
}
console.log("Processed", processedImages);
---
<div class:list={[{ "fc-bg-pearl-500": light }]}>
......
......@@ -12,7 +12,6 @@ export const loadImages = (
files?: string[]
): string[] => {
const baseUrl = getBaseUrl(false);
console.log("BaseURL", baseUrl);
const allRawImages = import.meta.glob(
"/public/images/slider/**/*.{jpg,jpeg,png,webp,gif}"
);
......@@ -20,7 +19,6 @@ export const loadImages = (
(image) => baseUrl + image.replace("/public/", "")
);
console.log("All Images", allImages);
if (folder) {
const filteredImagesBasedOnFolder: string[] = [];
......@@ -75,7 +73,7 @@ export const mapCaptions = (
const handleMappingCaption = (
passedInCaptions: ISliderCaption | ISlide | undefined,
metadata:
| { filename: string; caption: string; subCaption: string; tag: string }
| { filename: string; caption: string; subCaption: string; tag?: string }
| undefined,
type: "caption" | "subCaption" | "tag"
): string => {
......@@ -85,8 +83,6 @@ export const mapCaptions = (
return DEFAULT_CAPTION;
};
console.log("imageUrls", imageUrls);
const imageUrlsResult = imageUrls.map((url) => {
const hasMetadata = filenameWithoutExtension.find((file) =>
url.includes(file.filename)
......
/**
* Return the base URL of the current page with or without trailing slash depending on the given parameter
* Return the base URL of the current page with or without trailing slash depending on the given parameter.#
* This value is read from the Astro config file (it doesn't need to be set in .env file).
*/
export const getBaseUrl = (withoutEndingSlash?: boolean): string => {
const baseUrl = import.meta.env.BASE_URL || "/";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment