Skip to content

Commit

Permalink
fix: show last selected folder on copy/move modal (#173 close AlistGo…
Browse files Browse the repository at this point in the history
  • Loading branch information
liuycy authored May 18, 2024
1 parent 078105d commit 6615ba0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/FolderTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ export type ModalFolderChooseProps = {
}
export const ModalFolderChoose = (props: ModalFolderChooseProps) => {
const t = useT()
const [value, setValue] = createSignal(props.defaultValue ?? "")
const [value, setValue] = createSignal(props.defaultValue ?? "/")
const [handler, setHandler] = createSignal<FolderTreeHandler>()
createEffect(() => {
if (!props.opened) return
handler()?.setPath(value())
})
return (
<Modal
size="xl"
Expand All @@ -208,7 +213,11 @@ export const ModalFolderChoose = (props: ModalFolderChooseProps) => {
{/* <ModalCloseButton /> */}
<ModalHeader>{t("home.toolbar.choose_dst_folder")}</ModalHeader>
<ModalBody>
<FolderTree onChange={setValue} />
<FolderTree
onChange={setValue}
handle={(h) => setHandler(h)}
autoOpen
/>
</ModalBody>
<ModalFooter display="flex" gap="$2">
<Button onClick={props.onClose} colorScheme="neutral">
Expand Down

0 comments on commit 6615ba0

Please sign in to comment.