diff --git a/package.json b/package.json index b62c301..f39358d 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "src/server.js", "scripts": { "dev": "npm run build && node --watch --es-module-specifier-resolution=node --no-warnings src/server.node.js", + "dev:local-images": "USE_LOCAL_IMAGES=true npm run dev", "watch": "node esbuild.js --watch", "build": "node esbuild.js", "lint": "eslint .", @@ -31,4 +32,4 @@ "prettier": "^3.2.5", "wrangler": "^3.34.0" } -} +} \ No newline at end of file diff --git a/public/cdn/img/scene/1000/autonomous.webp b/public/cdn/img/scene/1000/autonomous.webp new file mode 100644 index 0000000..d03c3b2 Binary files /dev/null and b/public/cdn/img/scene/1000/autonomous.webp differ diff --git a/public/cdn/img/scene/1000/classics.webp b/public/cdn/img/scene/1000/classics.webp new file mode 100644 index 0000000..ccb2149 Binary files /dev/null and b/public/cdn/img/scene/1000/classics.webp differ diff --git a/public/cdn/img/scene/500/autonomous.webp b/public/cdn/img/scene/500/autonomous.webp new file mode 100644 index 0000000..5d824a5 Binary files /dev/null and b/public/cdn/img/scene/500/autonomous.webp differ diff --git a/public/cdn/img/scene/500/classics.webp b/public/cdn/img/scene/500/classics.webp new file mode 100644 index 0000000..a0f59f5 Binary files /dev/null and b/public/cdn/img/scene/500/classics.webp differ diff --git a/public/cdn/img/scene/autonomous.jpg b/public/cdn/img/scene/autonomous.jpg deleted file mode 100644 index 3180ccb..0000000 Binary files a/public/cdn/img/scene/autonomous.jpg and /dev/null differ diff --git a/public/cdn/img/scene/classics.jpg b/public/cdn/img/scene/classics.jpg deleted file mode 100644 index 427b244..0000000 Binary files a/public/cdn/img/scene/classics.jpg and /dev/null differ diff --git a/public/cdn/img/scene/convert.sh b/public/cdn/img/scene/convert.sh new file mode 100755 index 0000000..42f83a5 --- /dev/null +++ b/public/cdn/img/scene/convert.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Directory containing the original PNG images +input_directory="./full" +# Array of target widths +declare -a sizes=(500 1000) + +# Iterate through each file in the input directory +for file in "$input_directory"/*.jpg; do + # Extract filename without extension + filename=$(basename -- "$file") + filename="${filename%.*}" + + # Iterate through each size + for size in "${sizes[@]}"; do + # Create output directory if it doesn't exist + output_directory="./$size" + mkdir -p "$output_directory" + + # Define output filename + output_file="$output_directory/${filename}.webp" + + # Convert and resize the image + convert "$file" -resize "${size}x${size}" - | cwebp -m 6 -q 80 -o "$output_file" -- - + done +done + +echo "Conversion completed." diff --git a/public/cdn/img/scene/full/autonomous.jpg b/public/cdn/img/scene/full/autonomous.jpg new file mode 100644 index 0000000..e9f5222 Binary files /dev/null and b/public/cdn/img/scene/full/autonomous.jpg differ diff --git a/public/cdn/img/scene/full/classics.jpg b/public/cdn/img/scene/full/classics.jpg new file mode 100644 index 0000000..4a64acf Binary files /dev/null and b/public/cdn/img/scene/full/classics.jpg differ diff --git a/src/explore/pages/HomePage.js b/src/explore/pages/HomePage.js index 77222d9..946faac 100644 --- a/src/explore/pages/HomePage.js +++ b/src/explore/pages/HomePage.js @@ -1,7 +1,7 @@ import Header from "../components/Header.js"; import Footer from "../components/Footer.js"; import Recommendations from "../components/Recommendations.js"; -import { html, IMAGE_SERVER } from "../utils.js"; +import { html, src, srcset } from "../utils.js"; import Meta from "../components/Meta.js"; /** @@ -11,6 +11,19 @@ import Meta from "../components/Meta.js"; * @returns {string} The HomePage component markup. */ export default ({ c }) => { + const teaser = [ + { + title: "Classic Tractors", + image: "/cdn/img/scene/[size]/classics.webp", + url: "/products/classic", + }, + { + title: "Autonomous Tractors", + image: "/cdn/img/scene/[size]/autonomous.webp", + url: "/products/autonomous", + }, + ]; + return html` @@ -23,20 +36,20 @@ export default ({ c }) => { ${Header({ c })}
- Classic Tractor - Classic Tractors - - Autonomous Tractor - Autonomous Tractors + ${teaser + .map( + ({ title, image, url }) => + html` + ${title} + ${title} + `, + ) + .join("")}
${Recommendations({ skus: ["CL-01-GY", "AU-07-MT"],