mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-19 01:21:30 +03:00
Fix right drawer bug (#584)
This commit is contained in:
parent
ebf5f67f63
commit
e1161e96a9
@ -4,7 +4,7 @@ import { useRecoilValue } from 'recoil';
|
|||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
import { currentUserState } from '@/auth/states/currentUserState';
|
import { currentUserState } from '@/auth/states/currentUserState';
|
||||||
import { GET_COMMENT_THREADS_BY_TARGETS } from '@/comments/services';
|
import { GET_COMMENT_THREAD } from '@/comments/services';
|
||||||
import { CommentForDrawer } from '@/comments/types/CommentForDrawer';
|
import { CommentForDrawer } from '@/comments/types/CommentForDrawer';
|
||||||
import { AutosizeTextInput } from '@/ui/components/inputs/AutosizeTextInput';
|
import { AutosizeTextInput } from '@/ui/components/inputs/AutosizeTextInput';
|
||||||
import { isNonEmptyString } from '@/utils/type-guards/isNonEmptyString';
|
import { isNonEmptyString } from '@/utils/type-guards/isNonEmptyString';
|
||||||
@ -69,7 +69,7 @@ export function CommentThreadComments({ commentThread }: OwnProps) {
|
|||||||
commentText: commentText,
|
commentText: commentText,
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
},
|
},
|
||||||
refetchQueries: [getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? ''],
|
refetchQueries: [getOperationName(GET_COMMENT_THREAD) ?? ''],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
|
||||||
|
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||||
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
||||||
|
|
||||||
import { useOpenRightDrawer } from '../../ui/layout/right-drawer/hooks/useOpenRightDrawer';
|
import { useOpenRightDrawer } from '../../ui/layout/right-drawer/hooks/useOpenRightDrawer';
|
||||||
@ -10,8 +12,10 @@ export function useOpenCommentThreadRightDrawer() {
|
|||||||
const [, setViewableCommentThreadId] = useRecoilState(
|
const [, setViewableCommentThreadId] = useRecoilState(
|
||||||
viewableCommentThreadIdState,
|
viewableCommentThreadIdState,
|
||||||
);
|
);
|
||||||
|
const setHotkeysScope = useSetHotkeysScope();
|
||||||
|
|
||||||
return function openCommentThreadRightDrawer(commentThreadId: string) {
|
return function openCommentThreadRightDrawer(commentThreadId: string) {
|
||||||
|
setHotkeysScope(InternalHotkeysScope.RightDrawer, { goto: false });
|
||||||
setViewableCommentThreadId(commentThreadId);
|
setViewableCommentThreadId(commentThreadId);
|
||||||
openRightDrawer(RightDrawerPages.EditCommentThread);
|
openRightDrawer(RightDrawerPages.EditCommentThread);
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,8 @@ import { v4 } from 'uuid';
|
|||||||
|
|
||||||
import { currentUserState } from '@/auth/states/currentUserState';
|
import { currentUserState } from '@/auth/states/currentUserState';
|
||||||
import { GET_COMPANIES } from '@/companies/services';
|
import { GET_COMPANIES } from '@/companies/services';
|
||||||
|
import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
|
||||||
|
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||||
import { GET_PEOPLE } from '@/people/services';
|
import { GET_PEOPLE } from '@/people/services';
|
||||||
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
||||||
import { selectedRowIdsState } from '@/ui/tables/states/selectedRowIdsState';
|
import { selectedRowIdsState } from '@/ui/tables/states/selectedRowIdsState';
|
||||||
@ -28,6 +30,7 @@ export function useOpenCreateCommentThreadDrawerForSelectedRowIds() {
|
|||||||
const [, setViewableCommentThreadId] = useRecoilState(
|
const [, setViewableCommentThreadId] = useRecoilState(
|
||||||
viewableCommentThreadIdState,
|
viewableCommentThreadIdState,
|
||||||
);
|
);
|
||||||
|
const setHotkeysScope = useSetHotkeysScope();
|
||||||
|
|
||||||
const [, setCommentableEntityArray] = useRecoilState(
|
const [, setCommentableEntityArray] = useRecoilState(
|
||||||
commentableEntityArrayState,
|
commentableEntityArrayState,
|
||||||
@ -64,6 +67,7 @@ export function useOpenCreateCommentThreadDrawerForSelectedRowIds() {
|
|||||||
getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? '',
|
getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? '',
|
||||||
],
|
],
|
||||||
onCompleted(data) {
|
onCompleted(data) {
|
||||||
|
setHotkeysScope(InternalHotkeysScope.RightDrawer, { goto: false });
|
||||||
setViewableCommentThreadId(data.createOneCommentThread.id);
|
setViewableCommentThreadId(data.createOneCommentThread.id);
|
||||||
setCommentableEntityArray(commentableEntityArray);
|
setCommentableEntityArray(commentableEntityArray);
|
||||||
openRightDrawer(RightDrawerPages.CreateCommentThread);
|
openRightDrawer(RightDrawerPages.CreateCommentThread);
|
||||||
|
@ -4,6 +4,8 @@ import { v4 } from 'uuid';
|
|||||||
|
|
||||||
import { currentUserState } from '@/auth/states/currentUserState';
|
import { currentUserState } from '@/auth/states/currentUserState';
|
||||||
import { GET_COMPANIES } from '@/companies/services';
|
import { GET_COMPANIES } from '@/companies/services';
|
||||||
|
import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
|
||||||
|
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||||
import { GET_PEOPLE } from '@/people/services';
|
import { GET_PEOPLE } from '@/people/services';
|
||||||
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
||||||
import { useCreateCommentThreadMutation } from '~/generated/graphql';
|
import { useCreateCommentThreadMutation } from '~/generated/graphql';
|
||||||
@ -21,6 +23,7 @@ export function useOpenCreateCommentThreadDrawer() {
|
|||||||
const openRightDrawer = useOpenRightDrawer();
|
const openRightDrawer = useOpenRightDrawer();
|
||||||
const [createCommentThreadMutation] = useCreateCommentThreadMutation();
|
const [createCommentThreadMutation] = useCreateCommentThreadMutation();
|
||||||
const currentUser = useRecoilValue(currentUserState);
|
const currentUser = useRecoilValue(currentUserState);
|
||||||
|
const setHotkeysScope = useSetHotkeysScope();
|
||||||
|
|
||||||
const [, setCommentableEntityArray] = useRecoilState(
|
const [, setCommentableEntityArray] = useRecoilState(
|
||||||
commentableEntityArrayState,
|
commentableEntityArrayState,
|
||||||
@ -51,6 +54,7 @@ export function useOpenCreateCommentThreadDrawer() {
|
|||||||
getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? '',
|
getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? '',
|
||||||
],
|
],
|
||||||
onCompleted(data) {
|
onCompleted(data) {
|
||||||
|
setHotkeysScope(InternalHotkeysScope.RightDrawer, { goto: false });
|
||||||
setViewableCommentThreadId(data.createOneCommentThread.id);
|
setViewableCommentThreadId(data.createOneCommentThread.id);
|
||||||
setCommentableEntityArray([entity]);
|
setCommentableEntityArray([entity]);
|
||||||
openRightDrawer(RightDrawerPages.CreateCommentThread);
|
openRightDrawer(RightDrawerPages.CreateCommentThread);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
import { useSetHotkeysScope } from '@/hotkeys/hooks/useSetHotkeysScope';
|
||||||
|
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
|
||||||
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
||||||
|
|
||||||
import { useOpenRightDrawer } from '../../ui/layout/right-drawer/hooks/useOpenRightDrawer';
|
import { useOpenRightDrawer } from '../../ui/layout/right-drawer/hooks/useOpenRightDrawer';
|
||||||
@ -11,10 +13,12 @@ export function useOpenTimelineRightDrawer() {
|
|||||||
const [, setCommentableEntityArray] = useRecoilState(
|
const [, setCommentableEntityArray] = useRecoilState(
|
||||||
commentableEntityArrayState,
|
commentableEntityArrayState,
|
||||||
);
|
);
|
||||||
|
const setHotkeysScope = useSetHotkeysScope();
|
||||||
|
|
||||||
return function openTimelineRightDrawer(
|
return function openTimelineRightDrawer(
|
||||||
commentableEntityArray: CommentableEntity[],
|
commentableEntityArray: CommentableEntity[],
|
||||||
) {
|
) {
|
||||||
|
setHotkeysScope(InternalHotkeysScope.RightDrawer, { goto: false });
|
||||||
setCommentableEntityArray(commentableEntityArray);
|
setCommentableEntityArray(commentableEntityArray);
|
||||||
openRightDrawer(RightDrawerPages.Timeline);
|
openRightDrawer(RightDrawerPages.Timeline);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user