-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Allow renaming names from uploaded files #6358
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
The pull request introduces a new feature allowing users to rename uploaded files directly within the application, along with some UI enhancements.
- New Component: Added
EditableField.tsx
inpackages/twenty-front/src/modules/ui/field/input/components/
for inline renaming functionality. - Attachment Dropdown: Updated
AttachmentDropdown.tsx
to include a 'Rename' option with a correspondinghandleRename
function. - Attachment Row: Modified
AttachmentRow.tsx
to integrate theEditableField
component for renaming files inline. - Theme Updates: Added
editable
color and box shadow styles inpackages/twenty-ui/src/theme/constants/BorderDark.ts
,BorderLight.ts
,BoxShadowDark.ts
, andBoxShadowLight.ts
. - UI Consistency: Ensured new styles align with Figma specifications for a cohesive user experience.
7 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
onFocus={onFocus} | ||
onBlur={onBlur} | ||
onChange={(event: ChangeEvent<HTMLInputElement>) => { | ||
onChange?.(event.target.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: Add error handling for the onChange
callback to prevent potential runtime errors.
Thanks, @ehconitin! It would be great if the text was pre-selected. This should be an option that could be applied to any |
On it. @Bonapara |
@Bonapara . Done. 2024-07-22.16-50-42.mp4 |
const handleInputBlur = () => { | ||
handleUpdate(); | ||
}; | ||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic should be inside the EditableField component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
setIsEditing(true); | ||
}; | ||
|
||
const handleInputChange = (text: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, should be inside the editable field component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
onBlur?: FocusEventHandler<HTMLInputElement>; | ||
}; | ||
|
||
const EditableFieldComponent = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like some logic could be shared with TextInput but let's see this later.
@lucasbordeau Made the suggested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Log
|
Hi @FelixMalfait, Thanks for merging my PR and optimizing the code! I noticed a couple of features from the original issue didn’t make it into the final merge:
These were part of my initial commit but seem to have been lost during the optimization. Should I open a new issue to reintroduce these, or do you have suggestions on how we can incorporate them without duplicating code? Looking forward to your thoughts! |
@ehconitin I'm sorry I forgot to give feedback. The Sometimes we have, as engineers, a duty to call out to the design team that they're asking for too much and that their ask will create a debt in the code. Then we can decide together if it's worth creating that debt. In that case:
You might have seen recently we removed a lot of code and migrated Tasks/Notes to become standard objects in the code base. That's in line with our general vision in this project which is to rely on as few primitives as possible to power all concepts throughout the app. Attachments are likely to undergo a similar migration where we try to make them fit into standard patterns as much as possible. Thanks a lot for your contribution! It was still helpful to have explored this direction cc @Bonapara you'll notice the design are not like you wanted sorry! |
Hey @FelixMalfait , Thanks for the feedback! I appreciate you pointing out the duplicated code and the naming issues. I see where you're coming from about the design debt, too. I’ll look into these and work on improving things. Thanks alot! |
Hello @Bonapara,
Done with issue #6317. I had to create a new component, EditableField (Component), because the existing InputText component has a fixed height (link), which causes the attachment row to increase in size everytime clicked on rename.
I’ve also updated the colors for the box border and box shadow as specified in Figma.
Please let me know your thoughts.
Thanks
2024-07-22.02-25-40.mp4