41 lines
2.9 KiB
Python
Executable file
41 lines
2.9 KiB
Python
Executable file
import re
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/pages/Dashboard.tsx', 'r', encoding='utf-8') as f:
|
|
text = f.read()
|
|
|
|
if 'SkeletonList' not in text:
|
|
text = text.replace("import { BaseLayout } from '../components/layout/BaseLayout'", "import { BaseLayout } from '../components/layout/BaseLayout'\nimport { SkeletonList, Skeleton } from '../components/ui/Skeleton'")
|
|
|
|
# Replace <div className="text-gray-400">Loading...</div>
|
|
text = text.replace('<div className="text-gray-400">Loading...</div>', '<SkeletonList count={3} />')
|
|
|
|
# Check for isLoading usages
|
|
text = text.replace('{isLoading ? (', '{isLoading ? (\n <SkeletonList count={4} />\n ) : projects.length === 0 ? (')
|
|
text = text.replace(' ) : projects.length === 0 ? (', ' ) : projects.length === 0 ? (')
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/pages/Dashboard.tsx', 'w', encoding='utf-8') as f:
|
|
f.write(text)
|
|
print('Updated Dashboard!')
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/pages/Editor.tsx', 'r', encoding='utf-8') as f:
|
|
eval_text = f.read()
|
|
|
|
if 'Spinner' not in eval_text:
|
|
eval_text = eval_text.replace("import { ConfirmationDialog } from '../components/ui/ConfirmationDialog'", "import { ConfirmationDialog } from '../components/ui/ConfirmationDialog'\nimport { Spinner } from '../components/ui/Spinner'")
|
|
eval_text = eval_text.replace('<div className="flex-1 flex items-center justify-center text-gray-400">Loading editor...</div>', '<div className="flex-1 flex items-center justify-center"><Spinner text="Loading editor..." /></div>')
|
|
eval_text = eval_text.replace('<div className="flex-1 flex items-center justify-center text-gray-400">Loading panel...</div>', '<div className="flex-1 flex items-center justify-center"><Spinner text="Loading environment..." /></div>')
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/pages/Editor.tsx', 'w', encoding='utf-8') as f:
|
|
f.write(eval_text)
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/pages/EditorSimplified.tsx', 'r', encoding='utf-8') as f:
|
|
text2 = f.read()
|
|
|
|
if 'Spinner' not in text2:
|
|
text2 = text2.replace("import { ConfirmationDialog } from '../components/ui/ConfirmationDialog'", "import { ConfirmationDialog } from '../components/ui/ConfirmationDialog'\nimport { Spinner } from '../components/ui/Spinner'")
|
|
text2 = text2.replace('<div className="flex-1 flex items-center justify-center text-gray-400">Loading editor...</div>', '<div className="flex-1 flex items-center justify-center"><Spinner text="Loading editor..." /></div>')
|
|
text2 = text2.replace('<div className="flex-1 flex items-center justify-center text-gray-400">Loading preview...</div>', '<div className="flex-1 flex items-center justify-center"><Spinner text="Loading preview..." /></div>')
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/pages/EditorSimplified.tsx', 'w', encoding='utf-8') as f:
|
|
f.write(text2)
|
|
|