Spaces:
Sleeping
Sleeping
Download scratch/patch_dashboard.py from HFShishir/leaseguard-api: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/HFShishir/leaseguard-api/resolve/main/scratch/patch_dashboard.py
- Command line
-
hf download hf://spaces/HFShishir/leaseguard-api/scratch/patch_dashboard.py
-
curl -L -o patch_dashboard.py https://huggingface.co/spaces/HFShishir/leaseguard-api/resolve/main/scratch/patch_dashboard.py
1.16 kB
| 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()) | |