import os
import glob
import re

count = 0
for filepath in glob.glob('src/**/*.tsx', recursive=True):
    with open(filepath, 'r') as f:
        content = f.read()
    
    # Replace ` *</FormLabel>` or `*</FormLabel>` (where * is preceded by a letter/space) 
    # to `<span className="text-red-500 ml-1">*</span></FormLabel>`
    new_content = re.sub(r'\s*\*\s*</FormLabel>', r'<span className="text-red-500 ml-1">*</span></FormLabel>', content)
    
    if new_content != content:
        with open(filepath, 'w') as f:
            f.write(new_content)
        count += 1
        print(f"Updated {filepath}")

print(f"Total files updated: {count}")
