Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent drag when rename #2067

Merged
merged 26 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cdecb4b
should be good
Tbaut Mar 28, 2022
5e8fd3d
this is getting biiiig
Tbaut Mar 30, 2022
b9711fa
blur on storage
Tbaut Mar 30, 2022
47062e7
Merge branch 'dev' into fix/tbaut-save-on-blur-edit-loader-2050
asnaith Mar 31, 2022
bdb73d8
Merge branch 'dev' into fix/tbaut-save-on-blur-edit-loader-2050
Tbaut Mar 31, 2022
b846ad8
lingui extract
actions-user Mar 31, 2022
37c92d0
spinner color
Tbaut Mar 31, 2022
95a399b
Merge branch 'fix/tbaut-save-on-blur-edit-loader-2050' of github.com:…
Tbaut Mar 31, 2022
6788375
Merge branch 'dev' into fix/tbaut-save-on-blur-edit-loader-2050
Tbaut Mar 31, 2022
db04c3e
Merge branch 'dev' into fix/tbaut-save-on-blur-edit-loader-2050
Tbaut Mar 31, 2022
7c59311
Update packages/files-ui/src/Components/Modules/FileBrowsers/views/Fi…
Tbaut Apr 1, 2022
bac2d4d
events
tanmoyAtb Apr 1, 2022
a932d4d
Merge branch 'fix/tbaut-save-on-blur-edit-loader-2050' of github.com:…
tanmoyAtb Apr 1, 2022
0001c36
Update packages/files-ui/src/Components/Modules/FileBrowsers/views/Fi…
Tbaut Apr 1, 2022
a23bcb2
Merge branch 'fix/tbaut-save-on-blur-edit-loader-2050' of github.com:…
tanmoyAtb Apr 1, 2022
2e5d847
resolved changes
tanmoyAtb Apr 1, 2022
7269596
Merge branch 'dev' into fix/prevent-drag-when-rename-2051
Tbaut Apr 1, 2022
535030d
Merge branch 'dev' into fix/prevent-drag-when-rename-2051
Tbaut Apr 1, 2022
8d155d9
Merge branch 'dev' into fix/prevent-drag-when-rename-2051
tanmoyAtb Apr 1, 2022
b1bff90
Merge branch 'dev' into fix/prevent-drag-when-rename-2051
asnaith Apr 4, 2022
788b628
rename functionalities
tanmoyAtb Apr 4, 2022
e24d1cd
renames
tanmoyAtb Apr 4, 2022
c7ea99d
resolved
tanmoyAtb Apr 4, 2022
da38484
Update packages/files-ui/src/Components/Modules/FileBrowsers/views/Fi…
tanmoyAtb Apr 4, 2022
5f6a028
same for shared folders
Tbaut Apr 5, 2022
4432ec3
Merge branch 'dev' into fix/prevent-drag-when-rename-2051
Tbaut Apr 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ const FileSystemGridItem = React.forwardRef(

useOnClickOutside(formRef, formik.submitForm)

const renameInputRef = useRef<HTMLInputElement | null>()

useEffect(() => {
if (editing && renameInputRef?.current) {
renameInputRef.current.focus()
}
}, [editing])

return (
<div
className={classes.gridViewContainer}
Expand Down Expand Up @@ -285,7 +293,7 @@ const FileSystemGridItem = React.forwardRef(
? t`Please enter a folder name`
: t`Please enter a file name`
}
autoFocus
ref={renameInputRef}
/>
{
!isFolder && extension !== "" && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ const FileSystemItem = ({

const [, dragMoveRef, preview] = useDrag({
type: DragTypes.MOVABLE_FILE,
canDrag: !editing,
item: () => {
if (selectedCids.includes(file.cid)) {
return { ids: selectedCids }
Expand Down Expand Up @@ -401,6 +402,14 @@ const FileSystemItem = ({

const fileOrFolderRef = useRef<any>()

if (fileOrFolderRef?.current) {
if (editing) {
fileOrFolderRef.current.draggable = false
} else {
fileOrFolderRef.current.draggable = true
}
}

if (!editing && desktop) {
dragMoveRef(fileOrFolderRef)
if (isFolder) {
Expand All @@ -409,6 +418,7 @@ const FileSystemItem = ({
}
}


tanmoyAtb marked this conversation as resolved.
Show resolved Hide resolved
const onSingleClick = useCallback(
(e) => {
if (desktop) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useMemo, useRef, useState } from "react"
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"
import { makeStyles, createStyles, useThemeSwitcher, useOnClickOutside, LongPressEvents } from "@chainsafe/common-theme"
import { t } from "@lingui/macro"
import clsx from "clsx"
Expand Down Expand Up @@ -203,6 +203,14 @@ const FileSystemTableItem = React.forwardRef(

useOnClickOutside(formRef, formik.submitForm)

const renameInputRef = useRef<HTMLInputElement | null>()

useEffect(() => {
if (editing && renameInputRef?.current) {
renameInputRef.current.focus()
}
}, [editing])

return (
<TableRow
data-cy="row-file-item"
Expand Down Expand Up @@ -259,7 +267,7 @@ const FileSystemTableItem = React.forwardRef(
? t`Please enter a folder name`
: t`Please enter a file name`
}
autoFocus
ref={renameInputRef}
/>
{
!isFolder && extension !== "" && (
Expand Down