84 lines
3.3 KiB
Python
84 lines
3.3 KiB
Python
import os
|
|
import glob
|
|
import re
|
|
|
|
PRO_TIER_DIRS = [
|
|
"src/app/dashboard",
|
|
"src/app/dashboard/leaderboard",
|
|
"src/app/dashboard/progress",
|
|
"src/app/dashboard/cbt",
|
|
"src/app/dashboard/materials",
|
|
"src/app/dashboard/analytics",
|
|
"src/app/dashboard/community",
|
|
"src/app/dashboard/streaks",
|
|
"src/app/dashboard/settings",
|
|
"src/app/dashboard/rank-predictor"
|
|
]
|
|
|
|
AI_COACH_DIRS = [
|
|
"src/app/dashboard/ai-coach/tutor",
|
|
"src/app/dashboard/ai-coach/cbt-dpp",
|
|
"src/app/dashboard/ai-coach/readiness",
|
|
"src/app/dashboard/ai-coach/college-predictor",
|
|
"src/app/dashboard/ai-coach/strategy",
|
|
"src/app/dashboard/ai-coach/study-plan",
|
|
"src/app/dashboard/ai-coach/time-optimization",
|
|
"src/app/dashboard/ai-coach/heatmap",
|
|
"src/app/dashboard/ai-coach/weekly-progress",
|
|
"src/app/dashboard/ai-coach/mistakes"
|
|
]
|
|
|
|
def process_file(filepath, is_pro):
|
|
if not os.path.exists(filepath):
|
|
return
|
|
|
|
with open(filepath, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# Original patterns
|
|
bg_pattern = r'bg-\[\#00F0FF\]/10 border border-\[\#00F0FF\]/20'
|
|
bg_amber_pattern = r'bg-amber-500/10 border border-amber-500/20' # Specifically for heatmap
|
|
|
|
if is_pro:
|
|
new_bg = 'bg-yellow-50 dark:bg-[#00F0FF]/10 border border-yellow-300/60 dark:border-[#00F0FF]/20'
|
|
# To replace the icon color, we'll find the line after the span and replace text-[#00F0FF]
|
|
# But text-[#00F0FF] might be used elsewhere, so let's only replace if it's an icon tag near the span.
|
|
# The safest way is a regex that matches the span and the inner icon.
|
|
# e.g., <span className="... bg-[#00F0FF]/10 ...">\n <IconName className="text-[#00F0FF]"
|
|
|
|
# 1. Replace the background span
|
|
content = re.sub(bg_pattern, new_bg, content)
|
|
|
|
# 2. Replace the icon color (we can just replace all text-[#00F0FF] inside that specific h1 block, but regex is tricky.
|
|
# Let's just do a manual string replace for known blocks.)
|
|
# Actually, let's use a regex to capture the span and the following line.
|
|
pattern = r'(<span[^>]*bg-yellow-50[^>]*>\s*<[A-Za-z0-9]+[^>]*)text-\[\#00F0FF\]'
|
|
content = re.sub(pattern, r'\1text-yellow-600 dark:text-[#00F0FF]', content)
|
|
|
|
else: # AI Coach
|
|
new_bg = 'bg-cyan-50 dark:bg-[#00F0FF]/10 border border-cyan-300/60 dark:border-[#00F0FF]/20'
|
|
|
|
# Replace both cyan and amber variants for consistency
|
|
content = re.sub(bg_pattern, new_bg, content)
|
|
content = re.sub(bg_amber_pattern, new_bg, content)
|
|
|
|
pattern = r'(<span[^>]*bg-cyan-50[^>]*>\s*<[A-Za-z0-9]+[^>]*)text-\[\#00F0FF\]'
|
|
content = re.sub(pattern, r'\1text-cyan-700 dark:text-[#00F0FF]', content)
|
|
|
|
# Specifically for heatmap which had amber text
|
|
pattern_amber = r'(<span[^>]*bg-cyan-50[^>]*>\s*<[A-Za-z0-9]+[^>]*)text-amber-500'
|
|
content = re.sub(pattern_amber, r'\1text-cyan-700 dark:text-[#00F0FF]', content)
|
|
|
|
with open(filepath, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
|
|
for d in PRO_TIER_DIRS:
|
|
page_path = os.path.join(d, "page.tsx")
|
|
process_file(page_path, is_pro=True)
|
|
|
|
for d in AI_COACH_DIRS:
|
|
page_path = os.path.join(d, "page.tsx")
|
|
process_file(page_path, is_pro=False)
|
|
|
|
print("Done replacing header icons.")
|