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

Rename tooltip and fixes #912

Merged
merged 4 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
7 changes: 1 addition & 6 deletions packages/common-components/src/TextInput/FormikTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ const FormikTextInput = React.forwardRef(
name={field.name}
value={field.value}
placeholder={placeholder}
captionMessage={
<>
{captionMessage && captionMessage}
{meta.touched && meta.error && `${meta.error}`}
</>
}
captionMessage={meta.touched && meta.error ? `${meta.error}` : captionMessage ? captionMessage : null}
tanmoyAtb marked this conversation as resolved.
Show resolved Hide resolved
state={meta.error ? "error" : undefined}
onChange={helpers.setValue}
autoFocus={autoFocus}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ const useStyles = makeStyles(({ breakpoints, constants, palette }: CSFTheme) =>
borderTopLeftRadius: `${constants.generalUnit * 1.5}px`,
borderTopRightRadius: `${constants.generalUnit * 1.5}px`,
borderBottomLeftRadius: `${constants.generalUnit * 1.5}px`,
borderBottomRightRadius: `${constants.generalUnit * 1.5}px`
borderBottomRightRadius: `${constants.generalUnit * 1.5}px`,
maxWidth: `${breakpoints.width("md")}px !important`
}
},
renameHeader: {
Expand Down Expand Up @@ -140,8 +141,11 @@ const useStyles = makeStyles(({ breakpoints, constants, palette }: CSFTheme) =>
},
filename: {
whiteSpace: "nowrap",
textOverflow: "ellipsis",
overflow: "hidden",
textOverflow: "ellipsis"
"&.editing": {
overflow: "visible"
}
},
dropdownIcon: {
"& svg": {
Expand Down Expand Up @@ -427,7 +431,7 @@ const FileSystemItemRow: React.FC<IFileSystemItemRowProps> = ({
<TableCell
ref={preview}
align="left"
className={classes.filename}
className={clsx(classes.filename, editing && "editing")}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is something wrong with this editing flag (certainly not from this PR, we can move this to another issue, just mentioning it here in case you know more). When I checked for it, I saw that all the rows actually get the .editing class, even the ones you're no editing. So in my example below, I have a long name for a folder. I edit a file (with a short name) and in the background, you can see the overflow visible, and the scrollbar:|
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, why thats happening. this can be fixed in this PR!
Great catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I suspected, having overflow in mobile view was root of the problem, also prevented editing styled to pass into all the rows.
Should be good now.
Thanks for getting to this!

onClick={() => {
if (!editing) {
onFolderOrFileClicks()
Expand Down Expand Up @@ -474,67 +478,70 @@ const FileSystemItemRow: React.FC<IFileSystemItemRowProps> = ({
</Form>
</Formik>
) : editing === cid && !desktop ? (
<CustomModal
className={classes.modalRoot}
injectedClass={{
inner: classes.modalInner
}}
closePosition="none"
active={editing === cid}
setActive={() => setEditing("")}
>
<Formik
initialValues={{
fileName: name
<>
<CustomModal
className={classes.modalRoot}
injectedClass={{
inner: classes.modalInner
}}
validationSchema={RenameSchema}
onSubmit={(values) => {
handleRename &&
closePosition="none"
active={editing === cid}
setActive={() => setEditing("")}
>
<Formik
initialValues={{
fileName: name
}}
validationSchema={RenameSchema}
onSubmit={(values) => {
handleRename &&
handleRename(
`${currentPath}${name}`,
`${currentPath}${values.fileName}`
)
setEditing(undefined)
}}
>
<Form className={classes.renameModal}>
<Typography
className={classes.renameHeader}
component="p"
variant="h5"
>
<Trans>Rename File/Folder</Trans>
</Typography>
<FormikTextInput
label="Name"
className={classes.renameInput}
name="fileName"
placeholder={`Please enter a ${
isFolder ? "folder" : "file"
} name`}
autoFocus={editing === cid}
/>
<footer className={classes.renameFooter}>
<Button
onClick={() => setEditing("")}
size="medium"
className={classes.cancelButton}
variant="outline"
type="button"
>
<Trans>Cancel</Trans>
</Button>
<Button
size="medium"
type="submit"
className={classes.okButton}
setEditing(undefined)
}}
>
<Form className={classes.renameModal}>
<Typography
className={classes.renameHeader}
component="p"
variant="h5"
>
<Trans>Update</Trans>
</Button>
</footer>
</Form>
</Formik>
</CustomModal>
<Trans>Rename File/Folder</Trans>
</Typography>
<FormikTextInput
label="Name"
className={classes.renameInput}
name="fileName"
placeholder={`Please enter a ${
isFolder ? "folder" : "file"
} name`}
autoFocus={editing === cid}
/>
<footer className={classes.renameFooter}>
<Button
onClick={() => setEditing("")}
size="medium"
className={classes.cancelButton}
variant="outline"
type="button"
>
<Trans>Cancel</Trans>
</Button>
<Button
size="medium"
type="submit"
className={classes.okButton}
>
<Trans>Update</Trans>
</Button>
</footer>
</Form>
</Formik>
</CustomModal>
<Typography>{name}</Typography>
</>
) : (
<Typography>{name}</Typography>
)}
Expand Down