diff --git a/src/components/workspace/FileContextMenu.tsx b/src/components/workspace/FileContextMenu.tsx index 3557200..58f00de 100644 --- a/src/components/workspace/FileContextMenu.tsx +++ b/src/components/workspace/FileContextMenu.tsx @@ -81,9 +81,9 @@ export function FileContextMenu({ open, position, items, onClose }: FileContextM > {/* Menu items */}
- {items.map((item, index) => ( + {items.map((item) => ( - )} - -

{fileName}

- {isMarkdown && ( - - Markdown - - )} - {/* File metadata */} -
- {fileSize !== undefined && ( - - {formatFileSize(fileSize)} - - )} - {fileModified && ( - - {formatModifiedDate(fileModified)} - - )} -
-
- - {/* Content - Fixed max-width with word wrap */} -
-
- {isMarkdown ? ( -
- ( -

- {children} -

- ), - h2: ({ children }) => ( -

{children}

- ), - h3: ({ children }) => ( -

{children}

- ), - p: ({ children }) => ( -

{children}

- ), - code: ({ children, className }) => { - const isInline = !className - return isInline ? ( - - {children} - - ) : ( -
-                      {children}
-                    
- ) - }, - ul: ({ children }) => ( -
    {children}
- ), - ol: ({ children }) => ( -
    {children}
- ), - li: ({ children }) =>
  • {children}
  • , - a: ({ children, href }) => ( - - {children} - - ), - blockquote: ({ children }) => ( -
    - {children} -
    - ), - hr: () =>
    , - table: ({ children }) => ( - {children}
    - ), - thead: ({ children }) => ( - {children} - ), - th: ({ children }) => ( - - {children} - - ), - td: ({ children }) => ( - - {children} - - ), - }} - > - {content} -
    -
    - ) : ( -
    {content}
    - )} -
    -
    - - ) -} - -export default MarkdownViewer diff --git a/src/components/workspace/index.ts b/src/components/workspace/index.ts index d66c1a9..35e27b4 100644 --- a/src/components/workspace/index.ts +++ b/src/components/workspace/index.ts @@ -1,6 +1,5 @@ export { FileTree } from './FileTree' export { FileEditor } from './FileEditor' -export { MarkdownViewer } from './MarkdownViewer' export { MobileBottomToolbar } from './MobileBottomToolbar' export { MobileFileDrawer } from './MobileFileDrawer' export { MobilePathSheet } from './MobilePathSheet' diff --git a/src/lib/workspace-fs.ts b/src/lib/workspace-fs.ts index e03240c..cb6b4b4 100644 --- a/src/lib/workspace-fs.ts +++ b/src/lib/workspace-fs.ts @@ -340,7 +340,11 @@ export async function createFile( if (!parentStats.isDirectory()) { throw new Error('Parent path is not a directory') } - } catch { + } catch (error) { + // Preserve original error if it's already a descriptive error we threw + if (error instanceof Error && error.message === 'Parent path is not a directory') { + throw error + } throw new Error('Parent directory does not exist') } diff --git a/src/routes/workspace/index.tsx b/src/routes/workspace/index.tsx index 54bafec..28bbf08 100644 --- a/src/routes/workspace/index.tsx +++ b/src/routes/workspace/index.tsx @@ -375,6 +375,9 @@ function WorkspacePage() { const [contextMenuPosition, setContextMenuPosition] = useState<{ x: number; y: number } | null>(null) const [contextMenuFilePath, setContextMenuFilePath] = useState(null) + // Clipboard feedback state + const [copyFeedback, setCopyFeedback] = useState<'idle' | 'copied' | 'failed'>('idle') + // Handle save file with confirmation callback const handleSave = useCallback( async (content: string, callback: (success: boolean) => void) => { @@ -486,13 +489,16 @@ function WorkspacePage() { }, { icon: , - label: 'Copy Path', + label: copyFeedback === 'copied' ? 'Copied!' : copyFeedback === 'failed' ? 'Failed' : 'Copy Path', onClick: async () => { if (contextMenuFilePath) { try { await navigator.clipboard.writeText(contextMenuFilePath) + setCopyFeedback('copied') + setTimeout(() => setCopyFeedback('idle'), 2000) } catch { - console.warn('Failed to copy to clipboard') + setCopyFeedback('failed') + setTimeout(() => setCopyFeedback('idle'), 2000) } } }, @@ -508,8 +514,7 @@ function WorkspacePage() { } }, }, - ], [contextMenuFilePath, handleSelect]) - + ], [contextMenuFilePath, handleSelect, copyFeedback]) return (