Rocky_Mountain_Vending/scripts/one-off/modify_links.py

89 lines
5.3 KiB
Python

import re
# Read the original file
with open('app/services/repairs/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 Hero section
hero_pattern = r'<h1 className="text-4xl md:text-5xl font-bold tracking-tight text-balance mb-4">\s*{page.title \| \'Vending Machine Repairs and Service\'}\s*</h1>\s*<p className="text-lg text-muted-foreground max-w-3xl mx-auto leading-relaxed mb-8">'
hero_replacement = '''<h1 className="text-4xl md:text-5xl font-bold tracking-tight text-balance mb-4">
{page.title || 'Vending Machine Repairs and Service'}
</h1>
<p className="text-lg text-muted-foreground max-w-3xl mx-auto leading-relaxed mb-8">
Rocky Mountain Vending delivers expert <Link href="/services/repairs" className="text-primary hover:underline font-semibold">vending machine repair</Link> and maintenance services to keep your business thriving. From resolving jammed coin slots and refrigeration issues to fixing non-dispensing machines, our skilled technicians ensure reliable performance. For all your <Link href="/services/parts" className="text-primary hover:underline">vending machine parts</Link> needs and professional <Link href="/services/moving" className="text-primary hover:underline">vending machine moving</Link> services, contact us today for fast, professional solutions!
</p>'''
content = re.sub(hero_pattern, hero_replacement, content, flags=re.MULTILINE | re.DOTALL)
# Add Related Services section after Why Choose Section
related_services = '''
{/* Related Services Section */}
<section className="py-20 md:py-28 bg-background">
<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 Complete Service Network</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 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 Parts</h3>
<p className="text-muted-foreground mb-6">
Quality replacement parts and components for all major vending machine brands
</p>
<Link href="/services/parts" className="inline-flex items-center gap-2 text-primary hover:underline font-medium">
View Parts Services <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">Service Areas</h3>
<p className="text-muted-foreground mb-6">
Serving 20+ cities across Utah with free delivery and installation
</p>
<Link href="/service-areas" className="inline-flex items-center gap-2 text-primary hover:underline font-medium">
View Service Areas <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">Moving Services</h3>
<p className="text-muted-foreground mb-6">
Professional vending machine relocation and installation services
</p>
<Link href="/services/moving" className="inline-flex items-center gap-2 text-primary hover:underline font-medium">
View Moving Services <ArrowRight className="h-4 w-4" />
</Link>
</CardContent>
</Card>
</div>
</div>
</section>
'''
# Insert before How It Works section
how_it_works_pattern = r'<section id="how-it-works"'
content = re.sub(how_it_works_pattern, related_services + '\n\n <section id="how-it-works"', content)
# Write the modified content
with open('app/services/repairs/page.tsx', 'w') as f:
f.write(content)
print("✅ Successfully added internal links to repairs page!")
print("📝 Links added:")
print("• vending machine repair (self-link)")
print("• vending machine parts (parts service)")
print("• vending machine moving (moving service)")
print("• service areas (3 card links)")
print("")
print("🔗 Total: 7 new internal links implemented")