This commit is contained in:
2026-04-16 01:36:18 +03:00
parent ef9d6fc40a
commit bac925b5bc
67 changed files with 275 additions and 82 deletions

12
scratch/list_images.py Normal file
View File

@@ -0,0 +1,12 @@
import os
def list_files(startpath):
for root, dirs, files in os.walk(startpath):
level = root.replace(startpath, '').count(os.sep)
indent = ' ' * 4 * (level)
print('{}{}/'.format(indent, os.path.basename(root)))
subindent = ' ' * 4 * (level + 1)
for f in files:
print('{}{}'.format(subindent, f))
list_files('public/images')

34
scratch/update_images.py Normal file
View File

@@ -0,0 +1,34 @@
import os
import re
# Mapping of service title to subdirectory name
mapping = {
"Sandiviç Panel İndirme Kaldırma": "sandiviçpanelindirmekaldırma",
"Konteyner Nakliyesi & Tiny House Kaldırma": "Konteyner nakliyesi Tiny house kaldırma",
"Jet Ground Kaldırma Taşıma": "Jet ground kaldırma taşıma",
"Vinç Hizmetleri": "Vinç hizmetleri",
"Sepetli Platform Hizmetleri": "Sepetli platform hizmetleri",
"Tekne ve Yat Kaldırma": "Tekne yat kaldırma",
"Nakliyat ve Taşımacılık": "Nakliyat-Taşımacılık"
}
data_file = 'lib/data.ts'
with open(data_file, 'r', encoding='utf-8') as f:
content = f.read()
for title, subdir in mapping.items():
image_dir = os.path.join('public/images', subdir)
if os.path.exists(image_dir):
files = [f for f in os.listdir(image_dir) if f.lower().endswith(('.png', '.jpg', '.jpeg', '.webp'))]
if files:
# Use the first image found
image_path = f"/images/{subdir}/{files[0]}"
# Escape for regex
escaped_title = re.escape(title)
pattern = rf'(title:\s*"{escaped_title}",\s*description:\s*".*?",\s*image:\s*")([^"]+)(")'
content = re.sub(pattern, rf'\1{image_path}\3', content)
with open(data_file, 'w', encoding='utf-8') as f:
f.write(content)
print("Successfully updated lib/data.ts with local images.")

View File

@@ -0,0 +1,45 @@
import os
import re
# Mapping for ServicesPreview since it has different titles/structure
preview_mapping = {
"ır Nakliyat": "Nakliyat-Taşımacılık",
"Mobil Vinç": "Vinç hizmetleri",
"Sepetli Platform": "Sepetli platform hizmetleri"
}
preview_file = 'components/ServicesPreview.tsx'
if os.path.exists(preview_file):
with open(preview_file, 'r', encoding='utf-8') as f:
content = f.read()
for title, subdir in preview_mapping.items():
image_dir = os.path.join('public/images', subdir)
if os.path.exists(image_dir):
files = [f for f in os.listdir(image_dir) if f.lower().endswith(('.png', '.jpg', '.jpeg', '.webp'))]
if files:
image_path = f"/images/{subdir}/{files[0]}"
escaped_title = re.escape(title)
pattern = rf'(title:\s*"{escaped_title}",\s*description:\s*".*?",\s*image:\s*")([^"]+)(")'
content = re.sub(pattern, rf'\1{image_path}\3', content)
with open(preview_file, 'w', encoding='utf-8') as f:
f.write(content)
print("Updated ServicesPreview.tsx")
# Also update Hero.tsx with a local crane image
hero_file = 'components/Hero.tsx'
if os.path.exists(hero_file):
with open(hero_file, 'r', encoding='utf-8') as f:
content = f.read()
# Use one of the crane images for Hero
image_dir = 'public/images/Vinç hizmetleri'
if os.path.exists(image_dir):
files = [f for f in os.listdir(image_dir) if f.lower().endswith(('.png', '.jpg', '.jpeg', '.webp'))]
if files:
image_path = f"/images/Vinç hizmetleri/{files[0]}"
content = re.sub(r'(src=")(https://[^"]+)(")', rf'\1{image_path}\3', content, count=1)
with open(hero_file, 'w', encoding='utf-8') as f:
f.write(content)
print("Updated Hero.tsx")