Spaces:
Sleeping
Sleeping
File size: 1,155 Bytes
8f76784 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import re
import os
file_path = r'd:\AI_Contract_Detector\frontend\src\app\dashboard\page.tsx'
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
# Pattern to find the end of the results tab motion.div and include the billing tab after it.
# We look for the motion.div with key="results" and its closing tags.
# {activeTab === "results" && ( ... </motion.div>\n )}
pattern = r'(\{activeTab === "results" && \([\s\S]+?</motion\.div>\s+?\)\s+?)\}\s+?</AnimatePresence>'
billing_tab = r'''\1}
{activeTab === "billing" && (
<PricingView openCheckout={openCheckout} />
)}
</AnimatePresence>'''
if re.search(pattern, content):
new_content = re.sub(pattern, billing_tab, content)
with open(file_path, 'w', encoding='utf-8') as f:
f.write(new_content)
print("SUCCESS: Patched page.tsx with Billing Tab")
else:
print("ERROR: Could not find the injection point in page.tsx")
# Debug: show what we found
m = re.search(r'activeTab === "results"', content)
if m:
print("Found activeTab results at index", m.start())
|