"""
Patch remaining hrefs in page.tsx that should go to /dashboard
"""

filepath = r'd:\Ai\AntiGravity\Project_1.0\gmap\leadforge\src\app\page.tsx'

with open(filepath, 'r', encoding='utf-8') as f:
    content = f.read()

original_length = len(content)
count = 0

# Remaining template-pages and Webflow internal pages -> /dashboard
for old, new in [
    ('href="/template-pages/style-guide"', 'href="/dashboard"'),
    ('href="/template-pages/changelog"', 'href="/dashboard"'),
    ('href="/401"', 'href="/dashboard"'),
    ('href="/404"', 'href="/dashboard"'),
]:
    n = content.count(old)
    if n:
        print(f'Replacing {n}x: {old}')
        content = content.replace(old, new)
        count += n

# Pricing buttons with href="/" that are really CTAs
# These have specific variants: "pricing-blue-button", "black" button nav
import re

# Replace href="/" only when it's a CTA button (pricing, black CTA variants)
content = re.sub(
    r'href="/" Button="" data-wf--button-nav-link--variant="(pricing-blue-button|black)"',
    'href="/dashboard" Button="" data-wf--button-nav-link--variant="\\1"',
    content
)

with open(filepath, 'w', encoding='utf-8') as f:
    f.write(content)

new_length = len(content)
print(f'Done. File size: {original_length} -> {new_length} bytes')
