Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fcos-suite-astro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fab City OS Suite
fcos-suite-astro
Commits
a2936cc1
Commit
a2936cc1
authored
1 year ago
by
Moritz Stückler
Browse files
Options
Downloads
Patches
Plain Diff
fix: remove debug output
parent
3c546813
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#7112
passed
1 year ago
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/ImageGalleryWrapper.astro
+10
-16
10 additions, 16 deletions
src/components/ImageGalleryWrapper.astro
src/utils/Images.ts
+1
-5
1 addition, 5 deletions
src/utils/Images.ts
src/utils/Url.ts
+2
-1
2 additions, 1 deletion
src/utils/Url.ts
with
13 additions
and
22 deletions
src/components/ImageGalleryWrapper.astro
+
10
−
16
View file @
a2936cc1
...
...
@@ -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 }]}>
...
...
This diff is collapsed.
Click to expand it.
src/utils/Images.ts
+
1
−
5
View file @
a2936cc1
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
src/utils/Url.ts
+
2
−
1
View file @
a2936cc1
/**
* 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
||
"
/
"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment