This commit is contained in:
babayaga 2025-12-29 21:16:24 +01:00
parent 8ed5f38107
commit 2b7c2de02a
9 changed files with 11103 additions and 281 deletions

View File

@ -23,7 +23,7 @@
"format": "unix-time"
}
],
"default": "2025-12-29T19:13:54.158Z"
"default": "2025-12-29T19:38:48.202Z"
},
"description": {
"type": "string",

26
app.log
View File

@ -120,3 +120,29 @@
{"level":"INFO","time":"2025-12-29T19:13:19.797Z","pid":6092,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:13:20.922Z","pid":6092,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from ./app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:13:46.100Z","pid":14908,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:13:50.391Z","pid":14908,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:13:52.658Z","pid":14908,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:13:52.675Z","pid":14908,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from ./app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:25:32.990Z","pid":17144,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:25:34.127Z","pid":17144,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:25:35.501Z","pid":17144,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:25:35.511Z","pid":17144,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from ./app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:32:52.318Z","pid":14908,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:32:52.330Z","pid":14908,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from ./app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:33:55.326Z","pid":14908,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:35:01.914Z","pid":19948,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:35:02.822Z","pid":19948,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:35:04.184Z","pid":19948,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:35:04.195Z","pid":19948,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from ./app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:35:19.313Z","pid":19948,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:35:19.321Z","pid":19948,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from ./app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:35:19.588Z","pid":19948,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:38:45.381Z","pid":23152,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:38:46.257Z","pid":23152,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:38:47.621Z","pid":23152,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:38:47.630Z","pid":23152,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from ./app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:39:02.773Z","pid":23152,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:39:02.780Z","pid":23152,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from ./app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:39:02.973Z","pid":23152,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale en"}
{"level":"INFO","time":"2025-12-29T19:39:19.507Z","pid":23152,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale es"}
{"level":"INFO","time":"2025-12-29T19:43:41.374Z","pid":14908,"hostname":"DESKTOP-OL563U1","msg":"Loading library config from C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\app-config.json for locale es"}

11055
imagetools-manifest.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,6 @@
# Define local and remote paths
LOCAL_DIR="./dist"
GDRIVE_DIR="library.polymech.info:/httpdocs"
GDRIVE_DIR="library.polymech.info:/"
rclone copy "${LOCAL_DIR}" "${GDRIVE_DIR}" --progress --transfers 4

View File

@ -1,5 +1,5 @@
---
import { IMAGE_SETTINGS } from "config/config.js";
import { IMAGE_SETTINGS } from "../../app/config.js";
import Translate from "@polymech/astro-base/components/i18n.astro";
import { Img } from "imagetools/components";
import { asset_local_rel, IHowto } from "@/model/howto/howto.js";
@ -9,14 +9,15 @@ const classes = `group relative bg-white overflow-hidden group rounded-xl ${sele
const coverLocaleRel = await asset_local_rel(item, item.cover_image);
const { images, gallerySettings = {}, lightboxSettings = {} } = Astro.props;
const mergedGallerySettings = {
SIZES_REGULAR:
gallerySettings.SIZES_REGULAR || IMAGE_SETTINGS.GALLERY.SIZES_REGULAR,
gallerySettings.SIZES_REGULAR || IMAGE_SETTINGS.gallery.sizes_regular,
SIZES_THUMB:
gallerySettings.SIZES_THUMB || IMAGE_SETTINGS.GALLERY.SIZES_THUMB,
SHOW_TITLE: gallerySettings.SHOW_TITLE ?? IMAGE_SETTINGS.GALLERY.SHOW_TITLE,
gallerySettings.SIZES_THUMB || IMAGE_SETTINGS.gallery.sizes_thumb,
SHOW_TITLE: gallerySettings.SHOW_TITLE ?? IMAGE_SETTINGS.gallery.show_title,
SHOW_DESCRIPTION:
gallerySettings.SHOW_DESCRIPTION ?? IMAGE_SETTINGS.GALLERY.SHOW_DESCRIPTION,
gallerySettings.SHOW_DESCRIPTION ?? IMAGE_SETTINGS.gallery.show_description,
};
---

View File

@ -1,270 +0,0 @@
---
import { Img } from "imagetools/components";
import Translate from "@/components/polymech/i18n.astro"
import { translate } from "@/base/i18n"
import { item_keywords } from '@/base/seo.js'
import pMap from 'p-map'
import { toJsonLd } from '@/base/media.js'
import { I18N_SOURCE_LANGUAGE, IMAGE_SETTINGS } from "config/config.js"
import { IComponentConfig } from "@polymech/commons"
interface Image {
alt: string
src: string
title?: string
description?: string
item?:IComponentConfig
}
export interface Props {
images: Image[];
id?: string;
siteKeywords?: string[];
item?: IComponentConfig;
gallerySettings?: {
SIZES_REGULAR?: string;
SIZES_THUMB?: string;
SIZES_LARGE?: string;
SHOW_TITLE?: boolean;
SHOW_DESCRIPTION?: boolean;
};
lightboxSettings?: {
SIZES_REGULAR?: string;
SIZES_THUMB?: string;
SIZES_LARGE?: string;
SHOW_TITLE?: boolean;
SHOW_DESCRIPTION?: boolean;
};
}
const { images, gallerySettings = {}, lightboxSettings = {}, item } = Astro.props;
const mergedGallerySettings = {
SIZES_REGULAR: gallerySettings.SIZES_REGULAR || IMAGE_SETTINGS.GALLERY.SIZES_REGULAR,
SIZES_THUMB: gallerySettings.SIZES_THUMB || IMAGE_SETTINGS.GALLERY.SIZES_THUMB,
SHOW_TITLE: gallerySettings.SHOW_TITLE ?? IMAGE_SETTINGS.GALLERY.SHOW_TITLE,
SHOW_DESCRIPTION: gallerySettings.SHOW_DESCRIPTION ?? IMAGE_SETTINGS.GALLERY.SHOW_DESCRIPTION,
}
const mergedLightboxSettings = {
SIZES_LARGE: lightboxSettings.SIZES_LARGE || IMAGE_SETTINGS.LIGHTBOX.SIZES_LARGE,
SHOW_TITLE: lightboxSettings.SHOW_TITLE ?? IMAGE_SETTINGS.LIGHTBOX.SHOW_TITLE,
SHOW_DESCRIPTION: lightboxSettings.SHOW_DESCRIPTION ?? IMAGE_SETTINGS.LIGHTBOX.SHOW_DESCRIPTION,
}
const locale = Astro.currentLocale || I18N_SOURCE_LANGUAGE
const canonicalURL = new URL(Astro.url.pathname, Astro.site)
const alt = async (altText) => `${altText} - ${await item_keywords(item, locale)}`
const alt_translated = await pMap(images, async (image) => {
const text = await alt(image.alt)
return await translate(text, I18N_SOURCE_LANGUAGE, locale)
}, { concurrency: 1 })
const ld = await toJsonLd(images, Astro.currentLocale || I18N_SOURCE_LANGUAGE, canonicalURL.toString())
---
<div
x-data={`
{
open: false,
currentIndex: 0,
total: ${images.length},
lightboxLoaded: false,
touchStartX: 0,
touchEndX: 0,
mouseStartX: 0,
mouseEndX: 0,
mouseIsDown: false,
minSwipeDistance: 50,
isSwiping: false,
images: ${JSON.stringify(images)},
handleSwipe(isMouseEvent = false) {
if (!this.isSwiping && !this.mouseIsDown) return;
const startX = isMouseEvent ? this.mouseStartX : this.touchStartX;
const endX = isMouseEvent ? this.mouseEndX : this.touchEndX;
const swipeDistance = endX - startX;
if (Math.abs(swipeDistance) >= this.minSwipeDistance) {
if (swipeDistance > 0 && this.currentIndex > 0) {
// Swiped right, show previous image
this.currentIndex--;
} else if (swipeDistance < 0 && this.currentIndex < this.total - 1) {
// Swiped left, show next image
this.currentIndex++;
}
}
this.isSwiping = false;
this.mouseIsDown = false;
},
preloadAndOpen(index = null) {
// If we're in the middle of a swipe gesture, don't open the lightbox
if (this.isSwiping || this.mouseIsDown) return;
// If an index is provided, update the current index
if (index !== null) {
this.currentIndex = index;
}
this.lightboxLoaded = false;
let img = new Image();
img.src = this.images[this.currentIndex].src;
this.lightboxLoaded = true;
this.open = true;
img.onload = () => { };
}
}
`}
@keydown.escape.window="open = false"
@keydown.window="if(open){
if($event.key === 'ArrowRight' && currentIndex < total - 1){
currentIndex++;
lightboxLoaded = false;
preloadAndOpen();
} else if($event.key === 'ArrowLeft' && currentIndex > 0){
currentIndex--;
lightboxLoaded = false;
preloadAndOpen();
}
}"
class="product-gallery"><div class="flex flex-col h-full">
<!-- Main Image (with swipe functionality) -->
<div
class="flex-1 p-1 flex items-center justify-center cursor-pointer rounded-lg"
@click="preloadAndOpen()"
@touchstart="touchStartX = $event.touches[0].clientX; isSwiping = true;"
@touchend="touchEndX = $event.changedTouches[0].clientX; handleSwipe();"
@touchcancel="isSwiping = false;"
@mousedown="mouseStartX = $event.clientX; mouseIsDown = true; $event.preventDefault();"
@mousemove="if(mouseIsDown) { mouseEndX = $event.clientX; }"
@mouseup="if(mouseIsDown) { mouseEndX = $event.clientX; handleSwipe(true); }"
@mouseleave="mouseIsDown = false;"
>
{images.map((image, index) => (
<div x-show={`currentIndex === ${index}`} key={index} class="w-full h-full flex items-center justify-center">
<Img
src={image.src}
alt={alt_translated[index]}
objectFit="contain"
format="avif"
sizes={mergedGallerySettings.SIZES_REGULAR}
loading="lazy"
attributes={{
img: { class: "main-image p-1 rounded-lg max-h-[60vh] aspect-square" }
}}
/>
</div>
))}
</div>
<!-- Image Info -->
{ (mergedGallerySettings.SHOW_TITLE || mergedGallerySettings.SHOW_DESCRIPTION) && (
<div class="text-center py-4">
{images.map((image, index) => (
<div x-show={`currentIndex === ${index}`} key={index}>
{ mergedGallerySettings.SHOW_TITLE && ( <h2 id="imageTitle" class="text-xl font-bold">{image.title}</h2>)}
{ mergedGallerySettings.SHOW_DESCRIPTION && (<p id="imageDescription" class="text-gray-600"><Translate>{ image.description}</Translate></p>)}
</div>
))}
</div>
)}
<!-- Thumbnails - only shown when multiple images exist -->
{images.length > 1 && (
<div class="p-1 overflow-x-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-gray-200">
<div class="flex p-2 mt-2 ml-2 mr-2 gap-2 items-center justify-center">
{images.map((image, index) => (
<button
key={index}
x-on:click={`currentIndex = ${index};`}
:class={`currentIndex === ${index} ? 'ring-2 ring-orange-500' : ''`}
class="thumbnail thumbnail-btn flex-shrink rounded-lg"
>
<Img
src={image.src}
objectFit="cover"
format="avif"
placeholder="blurred"
sizes={mergedGallerySettings.SIZES_THUMB}
alt={alt_translated[index]}
breakpoints={[100]}
attributes={{
img: {
class: "w-32 h-32 rounded-lg hover:ring-2 hover:ring-blue-500 thumbnail-img aspect-square"
}
}}
loading="lazy"
/>
</button>
))}
</div>
</div>
)}
</div>
<!-- Lightbox Modal (with swipe functionality) -->
<div
x-show="open"
x-transition
:class="{ 'lightbox': !lightboxLoaded }"
class="fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center lightbox z-10"
>
<div
class="relative max-w-full max-h-full"
@touchstart="touchStartX = $event.touches[0].clientX; isSwiping = true;"
@touchend="touchEndX = $event.changedTouches[0].clientX; handleSwipe();"
@touchcancel="isSwiping = false;"
@mousedown="mouseStartX = $event.clientX; mouseIsDown = true; $event.preventDefault();"
@mousemove="if(mouseIsDown) { mouseEndX = $event.clientX; }"
@mouseup="if(mouseIsDown) { mouseEndX = $event.clientX; handleSwipe(true); }"
@mouseleave="mouseIsDown = false;"
>
{images.map((image, index) => (
<div x-show={`currentIndex === ${index}`} key={index}>
<Img
src={image.src}
alt={alt_translated[index]}
placeholder="blurred"
format="avif"
objectFit="contain"
sizes={IMAGE_SETTINGS.LIGHTBOX.SIZES_LARGE}
attributes={{
img: { class: "max-w-[90vw] max-h-[90vh] object-contain rounded-lg lightbox-main" }
}}
/>
{ (mergedLightboxSettings.SHOW_TITLE || mergedLightboxSettings.SHOW_DESCRIPTION) &&
(image.title || image.description) && (
<div class="absolute bottom-0 left-1/2 transform -translate-x-1/2 m-[8px] max-h-[32vh] p-2 text-white bg-black/50 rounded-lg" style="width: 90%;">
{ mergedLightboxSettings.SHOW_TITLE && ( <h3 class="text-xl"><Translate>{image.title}</Translate></h3>)}
{ mergedLightboxSettings.SHOW_DESCRIPTION && (<p><Translate>{image.description}</Translate></p>)}
</div>
)}
</div>
))}
<!-- Close Button -->
<button
x-on:click="open = false"
class="absolute top-0 right-0 text-white text-2xl p-4 m-[8px] bg-gray-800/75 bg-opacity-75 rounded-lg lightbox-nav"
aria-label="Close"
>
&times;
</button>
<!-- Navigation Buttons -->
<button
x-show="currentIndex > 0"
x-on:click="currentIndex--; lightboxLoaded = false; preloadAndOpen();"
:disabled="!lightboxLoaded"
class="absolute left-0 top-1/2 transform -translate-y-1/2 p-4 m-[8px] text-white text-3xl bg-gray-800/75 bg-opacity-75 rounded-lg lightbox-nav"
:class="{'opacity-50 cursor-not-allowed': !lightboxLoaded, 'hover:bg-gray-700/75': lightboxLoaded}"
aria-label="Previous"
>
&#10094;
</button>
<button
x-show="currentIndex < total - 1"
x-on:click="currentIndex++; lightboxLoaded = false; preloadAndOpen();"
:disabled="!lightboxLoaded"
class="absolute right-0 top-1/2 transform -translate-y-1/2 p-4 m-[8px] text-white text-3xl bg-gray-800/75 bg-opacity-75 rounded-lg lightbox-nav"
:class="{'opacity-50 cursor-not-allowed': !lightboxLoaded, 'hover:bg-gray-700/50': lightboxLoaded}"
aria-label="Next"
>
&#10095;
</button>
</div>
<script type="application/ld+json" set:html={ JSON.stringify(ld) }></script>
</div>

View File

@ -2,7 +2,8 @@
import { IHowto } from "@/model/howto/howto.js";
import { getCollection } from "astro:content";
import List from "@/components/howtos/List.astro";
import { LANGUAGES_PROD as LANGUAGES } from "config/config.js";
import { LANGUAGES_PROD as LANGUAGES } from "../../../app/config.js";
export async function getStaticPaths() {
const view = "howtos";
@ -36,7 +37,7 @@ export async function getStaticPaths() {
page: item,
locale: lang,
category: item.toLowerCase(),
view
view,
},
});
});
@ -44,8 +45,6 @@ export async function getStaticPaths() {
return all;
}
const { page: page, ...rest } = Astro.props;
import Sidebar2 from "@/components/howtos/Nav.astro";
---
<List {...rest} />

View File

@ -0,0 +1 @@
TEST,TEST
1 TEST TEST

View File

@ -0,0 +1,10 @@
{
"glossaryId": "69314708-719d-425a-9deb-6a9f010606c1",
"name": "OSR-en-es",
"ready": true,
"sourceLang": "en",
"targetLang": "es",
"creationTime": "2025-12-29T19:40:06.852Z",
"entryCount": 1,
"hash": "zDrlayXO43sB98wNoqof0g=="
}