fix(settings, yjs, ux, ci): default settings, y-leveldb restart resilience, dashboard one-click open, delete error handling, Playwright CI
This commit is contained in:
@@ -332,6 +332,7 @@ export function Dashboard({ onOpenProject }: DashboardProps) {
|
||||
const handleProjectCardClick = (projectId: string) => {
|
||||
setSelectedProjectId(projectId);
|
||||
setMobileInfoOpen(true);
|
||||
onOpenProject(projectId);
|
||||
};
|
||||
|
||||
const handleSaveProject = async () => {
|
||||
|
||||
@@ -102,10 +102,11 @@ export async function createProject(token: string, name: string, description?: s
|
||||
}
|
||||
|
||||
export async function deleteProject(token: string, id: string): Promise<void> {
|
||||
await fetch(`${API_BASE}/api/projects/${id}`, {
|
||||
const res = await fetch(`${API_BASE}/api/projects/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (!res.ok) throw new Error('Failed to delete project');
|
||||
}
|
||||
|
||||
export async function updateProject(token: string, id: string, updates: { name?: string; description?: string | null }): Promise<Project> {
|
||||
@@ -225,10 +226,11 @@ export async function updateElement(token: string, elementId: string, patch: Par
|
||||
}
|
||||
|
||||
export async function deleteElement(token: string, elementId: string): Promise<void> {
|
||||
await fetch(`${API_BASE}/api/elements/${elementId}`, {
|
||||
const res = await fetch(`${API_BASE}/api/elements/${elementId}`, {
|
||||
method: 'DELETE',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (!res.ok) throw new Error('Failed to delete element');
|
||||
}
|
||||
|
||||
// ─── Layers ─────────────────────────────────────────────
|
||||
@@ -259,10 +261,11 @@ export async function updateLayer(token: string, layerId: string, patch: Partial
|
||||
}
|
||||
|
||||
export async function deleteLayer(token: string, layerId: string): Promise<void> {
|
||||
await fetch(`${API_BASE}/api/layers/${layerId}`, {
|
||||
const res = await fetch(`${API_BASE}/api/layers/${layerId}`, {
|
||||
method: 'DELETE',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (!res.ok) throw new Error('Failed to delete layer');
|
||||
}
|
||||
|
||||
// ─── Blocks ─────────────────────────────────────────────
|
||||
@@ -293,10 +296,11 @@ export async function updateBlock(token: string, blockId: string, patch: Partial
|
||||
}
|
||||
|
||||
export async function deleteBlock(token: string, blockId: string): Promise<void> {
|
||||
await fetch(`${API_BASE}/api/blocks/${blockId}`, {
|
||||
const res = await fetch(`${API_BASE}/api/blocks/${blockId}`, {
|
||||
method: 'DELETE',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (!res.ok) throw new Error('Failed to delete block');
|
||||
}
|
||||
|
||||
// ─── Composite: Load full project data ───────────────────
|
||||
@@ -642,10 +646,11 @@ export async function renameGlobalFolder(token: string, id: string, name: string
|
||||
}
|
||||
|
||||
export async function deleteGlobalFolder(token: string, id: string): Promise<void> {
|
||||
await fetch(`${API_BASE}/api/global-folders/${id}`, {
|
||||
const res = await fetch(`${API_BASE}/api/global-folders/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (!res.ok) throw new Error('Failed to delete global folder');
|
||||
}
|
||||
|
||||
// ─── Global Blocks ────────────────────────────────────────
|
||||
@@ -694,10 +699,11 @@ export async function renameGlobalBlock(token: string, id: string, name: string)
|
||||
}
|
||||
|
||||
export async function deleteGlobalBlock(token: string, id: string): Promise<void> {
|
||||
await fetch(`${API_BASE}/api/global-blocks/${id}`, {
|
||||
const res = await fetch(`${API_BASE}/api/global-blocks/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (!res.ok) throw new Error('Failed to delete global block');
|
||||
}
|
||||
|
||||
export { API_BASE };
|
||||
|
||||
Reference in New Issue
Block a user