Files
PromptArch/fix_device_size2.py

34 lines
1.4 KiB
Python

#!/usr/bin/env python3
fp = '/home/uroma/promptarch/components/AIAssist.tsx'
with open(fp, 'r') as f:
lines = f.readlines()
changes = 0
for i, line in enumerate(lines):
if 'flex-1 overflow-hidden relative' in line and i > 1400:
lines[i] = ' <div className="flex-1 overflow-auto relative bg-[#050505]">\n'
changes += 1
print('Fixed overflow at line', i+1)
for j in range(i, min(i+10, len(lines))):
if '<LiveCanvas' in lines[j]:
ind = ' '
w = ind + '<div className="mx-auto transition-all duration-300 h-full"\n'
w += ind + ' style={deviceSize !== "full"\n'
w += ind + ' ? { width: deviceWidths[deviceSize], maxWidth: "100%",\n'
w += ind + ' border: "1px solid rgba(30,58,138,0.3)",\n'
w += ind + ' borderRadius: "12px", overflow: "hidden",\n'
w += ind + ' boxShadow: "0 20px 60px rgba(0,0,0,0.5)" }\n'
w += ind + ' : undefined}>\n'
lines[j:j] = [w]
changes += 1
print('Added device wrapper before LiveCanvas at line', j+1)
break
break
with open(fp, 'w') as f:
f.writelines(lines)
print('Applied', changes, 'changes')