fix: convert items show for unselected files; add success toast
Build and Deploy Verso / deploy (push) Successful in 15m23s
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:
+3
-3
@@ -36,7 +36,7 @@ function FileTreeItemMenuItems() {
|
|||||||
const { project } = useProjectContext()
|
const { project } = useProjectContext()
|
||||||
const projectOwner = project?.owner?._id
|
const projectOwner = project?.owner?._id
|
||||||
|
|
||||||
const { fileTreeData } = useFileTreeData()
|
const { fileTreeData, fileTreeReadOnly } = useFileTreeData()
|
||||||
const { selectedEntityIds } = useFileTreeSelectable()
|
const { selectedEntityIds } = useFileTreeSelectable()
|
||||||
const { contextMenuEntityId } = useFileTreeMainContext()
|
const { contextMenuEntityId } = useFileTreeMainContext()
|
||||||
const selectedEntityId =
|
const selectedEntityId =
|
||||||
@@ -55,12 +55,12 @@ function FileTreeItemMenuItems() {
|
|||||||
|
|
||||||
const canConvertToTypst =
|
const canConvertToTypst =
|
||||||
enablePandocConversions &&
|
enablePandocConversions &&
|
||||||
canRename &&
|
!fileTreeReadOnly &&
|
||||||
isConvertableDoc &&
|
isConvertableDoc &&
|
||||||
convertEntityName?.endsWith('.tex')
|
convertEntityName?.endsWith('.tex')
|
||||||
const canConvertToLatex =
|
const canConvertToLatex =
|
||||||
enablePandocConversions &&
|
enablePandocConversions &&
|
||||||
canRename &&
|
!fileTreeReadOnly &&
|
||||||
isConvertableDoc &&
|
isConvertableDoc &&
|
||||||
convertEntityName?.endsWith('.typ')
|
convertEntityName?.endsWith('.typ')
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useProjectContext } from '@/shared/context/project-context'
|
|||||||
import { useCallback, useState } from 'react'
|
import { useCallback, useState } from 'react'
|
||||||
import {
|
import {
|
||||||
showExportDocumentError,
|
showExportDocumentError,
|
||||||
|
showExportDocumentSuccess,
|
||||||
hideExportDocumentError,
|
hideExportDocumentError,
|
||||||
} from '../components/toolbar/export-document-toasts'
|
} from '../components/toolbar/export-document-toasts'
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ export default function useConvertDoc(
|
|||||||
await postJSON(`/project/${projectId}/doc/${docId}/convert/${type}`, {
|
await postJSON(`/project/${projectId}/doc/${docId}/convert/${type}`, {
|
||||||
body: {},
|
body: {},
|
||||||
})
|
})
|
||||||
// File tree updates automatically via socket event
|
showExportDocumentSuccess(type)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
const errorMessage = err?.data?.error
|
const errorMessage = err?.data?.error
|
||||||
showExportDocumentError(errorMessage)
|
showExportDocumentError(errorMessage)
|
||||||
|
|||||||
Reference in New Issue
Block a user