-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Activity Editor hot key scope management #3568
Activity Editor hot key scope management #3568
Conversation
@Muralidhar22 is this ready for review? :) |
Hi @charlesBochet below two things am not able figure out Listen for keyboard events, and if the user types something, put the focus in the last empty line and write in what the user typed.
Exit the focus on the activity editor body then close the right drawer if there's no focus on the activity editor body or on the fields in the header.
|
Hi @Muralidhar22, I think that for both of your questions, you would need some kind of recoil state to know if you're editing something inside the right drawer ? And put it at true/false at specific places ? I don't know if it's better to use a global boolean recoil state or a state that stores what we are currently editing. Maybe each component should be responsible for its own 'esc' listener and provide an |
Hey @lucasbordeau I'll try and see what I can do and update here |
…to focus-escape-activity-editor
…2:Muralidhar22/twenty into focus-escape-activity-editor
Was able to add the behaviour required in above two points without recoil state,
|
…2:Muralidhar22/twenty into focus-escape-activity-editor
For
So instead of having this : export const RecordInlineCell = ({
onBlur,
onFocus,
}: RecordInlineCellProps) => {
const { fieldDefinition, entityId } = useContext(FieldContext); We'll have this : export const RecordInlineCell = () => {
const { fieldDefinition, entityId, onOpen, onClose } = useContext(FieldContext); Then for example in ActivityTargetsInlineCell : const { FieldContextProvider } = useFieldContext({
objectNameSingular: CoreObjectNameSingular.Activity,
objectRecordId: activity?.id ?? '',
fieldMetadataName: 'activityTargets',
fieldPosition: 2,
onOpen: () => {
setYourRecoilState(...)
}
}); You'll have to modify the With all of this you should have a solid understanding of how we manage generic fields, cells and inline cells. Good luck 🫡 |
@lucasbordeau thanks for your inputs, will try to make the changes and update here. |
@Muralidhar22 @lucasbordeau I've merged main into the branch, fixed broken tests and fixed the logic to append to the drawer content (which was not working in the case of non-text block) I think we might be able to simplify even a bit more, I'll need to test a bit more deeply |
@@ -70,7 +70,7 @@ export const Tasks = () => { | |||
filterDropdownId={filterDropdownId} | |||
key="tasks-filter-dropdown-button" | |||
hotkeyScope={{ | |||
scope: RelationPickerHotkeyScope.RelationPicker, | |||
scope: FiltersHotkeyScope.ObjectTasksAssigneeDropdownButton, |
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 change seems unrelated to the PR
packages/twenty-front/src/modules/ui/input/components/AutosizeTextInput.tsx
Show resolved
Hide resolved
@@ -110,6 +111,7 @@ export const RecordInlineCellContainer = ({ | |||
editModeContentOnly, | |||
isDisplayModeFixHeight, | |||
disableHoverEffect, | |||
onInlineCellClick, |
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 is not useful anymore. It also create a discrepancy with RecordTableCell
activity: Activity; | ||
}; | ||
|
||
export const ActivityTargetsInlineCell = ({ | ||
activity, | ||
onFocus, |
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.
ActivityTargetsInlineCell should behave as RecordInlineCell, conceptually it's the same thing
}: ActivityTargetsInlineCellProps) => { | ||
const { activityTargetObjectRecords } = useActivityTargetObjectRecords({ | ||
activityId: activity?.id ?? '', | ||
}); | ||
const { closeInlineCell } = useInlineCell(); |
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 is actually not needed, we should leave useInlineCell handle it (there was a bug as is too low in the component hiearchy making this useInlineCell out of context)
}; | ||
|
||
export const ActivityTargetInlineCellEditMode = ({ | ||
activity, | ||
activityTargetObjectRecords, | ||
onBlur, |
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.
not needed, already handled by useInlineCell
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.
@Muralidhar22 I have completed the review and simplified a few things. Feel free to take a look at the changes! In the idea, we should not introduce too much logic. I think the InlineCell logic is still a bit hard to understand and twenty team should keep improving the developer experience so it's easier for external contributors to contribute!
setHotkeyScopeAndMemorizePreviousScope, | ||
goBackToPreviousHotkeyScope, | ||
} = usePreviousHotkeyScope(); | ||
const titleInputRef = useRef<HTMLInputElement>(null); |
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.
forgot to use it!
@@ -57,6 +57,13 @@ const StyledTopContainer = styled.div` | |||
padding: 24px 24px 24px 48px; | |||
`; | |||
|
|||
const StyledMiddleContainer = styled.div` |
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.
I don't think we should add this MiddleContainer
@Muralidhar22 Thanks a lot for the big part of the work, good to go! |
This pull request closes #3197
Changes
useListenClickOutside
to theActivityBodyEditor
to focus on last empty line.Esc
hot key listener for activity title, activity comment , activity targets.right drawer scope
.Checklist