fix: convert items show for unselected files; add success toast
Build and Deploy Verso / deploy (push) Successful in 15m23s

canRename required selectedEntityIds.size === 1, so right-clicking an
unselected file hid the convert items even though contextMenuEntityId
was correctly set. Replace canRename with !fileTreeReadOnly for the
convert-specific gate, which is the actual write-access check needed.

Also add showExportDocumentSuccess so the user sees the warning toast
on successful conversion instead of silent nothing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
claude
2026-06-17 21:18:24 +00:00
parent ff7de70a61
commit bc131f6440
2 changed files with 5 additions and 4 deletions
@@ -36,7 +36,7 @@ function FileTreeItemMenuItems() {
const { project } = useProjectContext()
const projectOwner = project?.owner?._id
const { fileTreeData } = useFileTreeData()
const { fileTreeData, fileTreeReadOnly } = useFileTreeData()
const { selectedEntityIds } = useFileTreeSelectable()
const { contextMenuEntityId } = useFileTreeMainContext()
const selectedEntityId =
@@ -55,12 +55,12 @@ function FileTreeItemMenuItems() {
const canConvertToTypst =
enablePandocConversions &&
canRename &&
!fileTreeReadOnly &&
isConvertableDoc &&
convertEntityName?.endsWith('.tex')
const canConvertToLatex =
enablePandocConversions &&
canRename &&
!fileTreeReadOnly &&
isConvertableDoc &&
convertEntityName?.endsWith('.typ')
@@ -3,6 +3,7 @@ import { useProjectContext } from '@/shared/context/project-context'
import { useCallback, useState } from 'react'
import {
showExportDocumentError,
showExportDocumentSuccess,
hideExportDocumentError,
} from '../components/toolbar/export-document-toasts'
@@ -21,7 +22,7 @@ export default function useConvertDoc(
await postJSON(`/project/${projectId}/doc/${docId}/convert/${type}`, {
body: {},
})
// File tree updates automatically via socket event
showExportDocumentSuccess(type)
} catch (err: any) {
const errorMessage = err?.data?.error
showExportDocumentError(errorMessage)