fix: remove duplicate showNewFolderModal that overwrote parent folder support

This commit is contained in:
Hiro
2026-03-28 14:07:41 +00:00
parent 8f7ad3f673
commit 789e17ffac

View File

@@ -567,59 +567,3 @@ window.showNewDocModal = async function(projectId, folderId = '') {
if (e.target === backdrop) backdrop.remove(); if (e.target === backdrop) backdrop.remove();
}; };
}; };
// Global function: Show modal to create new folder in project
window.showNewFolderModal = async function(projectId, parentFolderId = null) {
const backdrop = document.createElement('div');
backdrop.className = 'modal-backdrop';
backdrop.innerHTML = `
<div class="modal" style="min-width: 450px;">
<div class="modal-header">
<span>📁</span>
<h3>Create New Folder</h3>
<button class="modal-close" onclick="this.closest('.modal-backdrop').remove()">✕</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="new-folder-name">Folder Name</label>
<input type="text" id="new-folder-name" class="form-control" placeholder="e.g., Backend">
</div>
</div>
<div class="modal-footer">
<button class="btn btn-ghost" onclick="this.closest('.modal-backdrop').remove()">Cancel</button>
<button class="btn btn-primary" id="create-folder-btn">Create</button>
</div>
</div>
`;
document.body.appendChild(backdrop);
const nameInput = document.getElementById('new-folder-name');
const createBtn = document.getElementById('create-folder-btn');
nameInput.focus();
createBtn.onclick = async () => {
const name = nameInput.value.trim();
if (!name) {
window.app.showToast('Please enter a folder name', 'error');
return;
}
try {
await api.createFolder({
name,
projectId,
parentId: parentFolderId
});
backdrop.remove();
window.app.showToast('Folder created', 'success');
window.app.navigate('project', { id: projectId });
} catch (e) {
window.app.showToast('Failed to create folder: ' + e.message, 'error');
}
};
backdrop.onclick = (e) => {
if (e.target === backdrop) backdrop.remove();
};
};