Rocky_Mountain_Vending/scripts/one-off/modify_home_page.py

72 lines
4.1 KiB
Python

import re
# Read the home page
with open('app/page.tsx', 'r') as f:
content = f.read()
# Add ArrowRight import if missing
if 'ArrowRight' not in content:
content = content.replace('import Link from \'next/link\';', 'import Link from \'next/link\';\nimport { ArrowRight } from \'lucide-react\';')
# Modify services section to add internal links
services_section_pattern = r'(?i)<section.*?py-20.*?bg-muted.*?>.*?</section>'
services_replacement = ''' {/* Services Section */}
<section className="py-20 md:py-28 bg-muted/30">
<div className="container mx-auto px-4 max-w-6xl">
<div className="text-center mb-12 md:mb-16">
<h2 className="text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl mb-4 text-balance">Our <Link href="/services/repairs" className="text-primary hover:underline font-semibold">Vending Machine Services</Link></h2>
<p className="text-lg text-muted-foreground max-w-2xl mx-auto text-pretty leading-relaxed mb-8">
Rocky Mountain Vending provides comprehensive vending machine solutions across Utah
</p>
</div>
<div className="grid gap-8 md:grid-cols-3">
<Card className="border-border/50 hover:border-secondary/50 transition-colors">
<CardContent className="pt-8 text-center">
<Wrench className="h-12 w-12 text-primary mx-auto mb-4" />
<h3 className="text-xl font-semibold mb-3">Vending Machine <Link href="/services/repairs" className="text-primary hover:underline font-semibold">Repairs</Link></h3>
<p className="text-muted-foreground mb-6">
Expert repair and maintenance services for all vending machine types
</p>
<Link href="/services/repairs" className="inline-flex items-center gap-2 text-primary hover:underline font-medium">
Learn More <ArrowRight className="h-4 w-4" />
</Link>
</CardContent>
</Card>
<Card className="border-border/50 hover:border-secondary/50 transition-colors">
<CardContent className="pt-8 text-center">
<MapPin className="h-12 w-12 text-primary mx-auto mb-4" />
<h3 className="text-xl font-semibold mb-3">Vending Machine <Link href="/services/parts" className="text-primary hover:underline font-semibold">Parts</Link></h3>
<p className="text-muted-foreground mb-6">
Quality replacement parts and components for all major brands
</p>
<Link href="/services/parts" className="inline-flex items-center gap-2 text-primary hover:underline font-medium">
Shop Parts <ArrowRight className="h-4 w-4" />
</Link>
</CardContent>
</Card>
<Card className="border-border/50 hover:border-secondary/50 transition-colors">
<CardContent className="pt-8 text-center">
<Clock className="h-12 w-12 text-primary mx-auto mb-4" />
<h3 className="text-xl font-semibold mb-3">Vending Machine <Link href="/services/moving" className="text-primary hover:underline font-semibold">Moving</Link></h3>
<p className="text-muted-foreground mb-6">
Professional relocation and installation services
</p>
<Link href="/services/moving" className="inline-flex items-center gap-2 text-primary hover:underline font-medium">
Moving Services <ArrowRight className="h-4 w-4" />
</Link>
</CardContent>
</Card>
</div>
</div>
</section>
{/* Original Services Section - Replace with above */'''
# Try to replace existing services section
content = re.sub(services_section_pattern, services_replacement, content, flags=re.DOTALL | re.IGNORECASE)
# Write the modified content
with open('app/page.tsx', 'w') as f:
f.write(content)
print("✅ Successfully added internal links to Home page!")