Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ciur committed Sep 18, 2024
1 parent 2da3d8f commit a50ccdb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
20 changes: 11 additions & 9 deletions ui2/src/features/document/components/Thumbnail/Thumbnail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,17 @@ export default function Thumbnail({page}: Args) {
/>
{page.number}
</Stack>
<TransferPagesModal
targetDoc={doc!}
sourceDocID={draggedPagesDocID}
sourcePageIDs={draggedPagesIDs}
targetPageID={page.id}
opened={trPagesDialogOpened}
onCancel={trPagesDialogClose}
onSubmit={trPagesDialogClose}
/>
{draggedPagesDocID && draggedPagesIDs && doc && (
<TransferPagesModal
targetDoc={doc}
sourceDocID={draggedPagesDocID}
sourcePageIDs={draggedPagesIDs}
targetPageID={page.id}
opened={trPagesDialogOpened}
onCancel={trPagesDialogClose}
onSubmit={trPagesDialogClose}
/>
)}
</>
)
}
19 changes: 3 additions & 16 deletions ui2/src/features/document/components/TransferPagesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {useState} from "react"
import type {DocumentType, ServerErrorType, TransferStrategyType} from "@/types"

interface Args {
sourceDocID?: string
targetDoc?: DocumentType
sourcePageIDs?: string[]
sourceDocID: string
targetDoc: DocumentType
sourcePageIDs: string[]
targetPageID: string
opened: boolean
onCancel: () => void
Expand All @@ -28,19 +28,6 @@ export default function TransferPagesModal({
const [error, setError] = useState("")
const [movePages, {isLoading}] = useMovePagesMutation()

if (!sourceDocID) {
return <></>
}

if (!targetDoc) {
return <></>
}

if (!sourcePageIDs || sourcePageIDs.length == 0) {
console.warn("Missing source page IDs")
return <></>
}

const onTransferPages = async () => {
const transferStrategy = (value?.value || "mix") as TransferStrategyType
const data = {
Expand Down

0 comments on commit a50ccdb

Please sign in to comment.