Skip to content

Commit 8daad37

Browse files
committed
refactor: clean up card import — fix reload hack, extract plugin, improve types
- Replace window.location.reload() with CustomEvent('open-mod-editor') for cross-component communication after mod generation - Extract appGeneratorPlugin (~440 lines) from vite.config.ts into standalone module, accept explicit paths instead of __dirname - Fix _index type hack in cardExtractor: return { entry, index } tuple instead of sneaking undeclared field via double type assertion - Remove unused ExtractPreviewModal (replaced by inline upload flow) - Remove emoji from server-side console logs - Use logger consistently (replace stray console.warn) - Clean up duplicate setExtracting(false) in handleUploadSubmit - Revert unrelated liveWallpaper default change - Move prompt_generate_mod_en.md to .claude/ - Remove unused @types/jszip dependency
1 parent f112df0 commit 8daad37

10 files changed

Lines changed: 864 additions & 1127 deletions

File tree

File renamed without changes.

apps/webuiapps/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@
1616
"test:coverage": "vitest run --coverage"
1717
},
1818
"dependencies": {
19-
"@anthropic-ai/claude-agent-sdk": "^0.2.72",
2019
"framer-motion": "^12.34.0",
2120
"jszip": "^3.10.1",
2221
"react-markdown": "^10.1.0",
2322
"rehype-raw": "^7.0.0",
2423
"remark-gfm": "^4.0.1"
2524
},
2625
"devDependencies": {
27-
"@types/jszip": "^3.4.1",
26+
"@anthropic-ai/claude-agent-sdk": "^0.2.72",
2827
"@vitest/coverage-istanbul": "^1.6.1",
2928
"@vitest/coverage-v8": "^1.6.1",
3029
"happy-dom": "^14.0.0",

apps/webuiapps/src/components/ChatPanel/index.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,17 @@ const ChatPanel: React.FC<{
428428
const [initialEditModId, setInitialEditModId] = useState<string | undefined>();
429429
const [currentEmotion, setCurrentEmotion] = useState<string | undefined>();
430430

431-
// Auto-open mod editor if redirected from card import
431+
// Open mod editor when triggered from Shell (e.g. after card import mod generation)
432432
useEffect(() => {
433-
const editModId = sessionStorage.getItem('openroom_edit_mod_id');
434-
if (editModId) {
435-
sessionStorage.removeItem('openroom_edit_mod_id');
436-
setInitialEditModId(editModId);
437-
setShowModPanel(true);
438-
}
433+
const handler = (e: Event) => {
434+
const modId = (e as CustomEvent<{ modId: string }>).detail?.modId;
435+
if (modId) {
436+
setInitialEditModId(modId);
437+
setShowModPanel(true);
438+
}
439+
};
440+
window.addEventListener('open-mod-editor', handler);
441+
return () => window.removeEventListener('open-mod-editor', handler);
439442
}, []);
440443

441444
// Memories loaded for SP injection

apps/webuiapps/src/components/Shell/ExtractPreviewModal.module.scss

Lines changed: 0 additions & 351 deletions
This file was deleted.

0 commit comments

Comments
 (0)