T24: Update RibbonBar to handle ExportResult return type from export functions
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import React, { useState, useRef, useCallback, useEffect } from 'react';
|
import React, { useState, useRef, useCallback, useEffect } from 'react';
|
||||||
import type { YjsDocument } from '../crdt/YjsDocument';
|
import type { YjsDocument } from '../crdt/YjsDocument';
|
||||||
import { exportDrawing, type ExportFormat } from '../services/exportService';
|
import { exportDrawing, type ExportFormat } from '../services/exportService';
|
||||||
|
import type { ExportResult } from '../types/cad.types';
|
||||||
import { importDrawing, type ImportFormat, type ImportResult } from '../services/importService';
|
import { importDrawing, type ImportFormat, type ImportResult } from '../services/importService';
|
||||||
import PrintPreview from './PrintPreview/PrintPreview';
|
import PrintPreview from './PrintPreview/PrintPreview';
|
||||||
import './RibbonBar.css';
|
import './RibbonBar.css';
|
||||||
@@ -47,7 +48,11 @@ const RibbonBar: React.FC<RibbonBarProps> = ({ onTabChange, yjsDoc }) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await exportDrawing(doc, format);
|
const result: ExportResult = await exportDrawing(doc, format);
|
||||||
|
if (!result.success) {
|
||||||
|
setImportStatus(`Export error: ${result.error}`);
|
||||||
|
setTimeout(() => setImportStatus(null), 5000);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setImportStatus(`Export error: ${(e as Error).message}`);
|
setImportStatus(`Export error: ${(e as Error).message}`);
|
||||||
setTimeout(() => setImportStatus(null), 5000);
|
setTimeout(() => setImportStatus(null), 5000);
|
||||||
|
|||||||
Reference in New Issue
Block a user