Feat/open comment drawer from comment chip (#187)
* wip * Can open comment right drawer from company name cell
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { useOpenRightDrawer } from '../../ui/layout/right-drawer/hooks/useOpenRightDrawer';
|
||||
import { CommentableEntity } from '../types/CommentableEntity';
|
||||
import { commentableEntityArrayState } from '../states/commentableEntityArrayState';
|
||||
|
||||
export function useOpenCommentRightDrawer() {
|
||||
const openRightDrawer = useOpenRightDrawer();
|
||||
const [, setCommentableEntityArray] = useRecoilState(
|
||||
commentableEntityArrayState,
|
||||
);
|
||||
|
||||
return function openCommentRightDrawer(
|
||||
commentableEntityArray: CommentableEntity[],
|
||||
) {
|
||||
setCommentableEntityArray(commentableEntityArray);
|
||||
openRightDrawer('comments');
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
import { atom } from 'recoil';
|
||||
import { CommentableEntity } from '../types/CommentableEntity';
|
||||
|
||||
export const commentableEntityArrayState = atom<CommentableEntity[]>({
|
||||
key: 'comments/commentable-entity-array',
|
||||
default: [],
|
||||
});
|
||||
6
front/src/modules/comments/types/CommentableEntity.ts
Normal file
6
front/src/modules/comments/types/CommentableEntity.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { CommentableType } from '../../../generated/graphql';
|
||||
|
||||
export type CommentableEntity = {
|
||||
type: keyof typeof CommentableType;
|
||||
id: string;
|
||||
};
|
||||
Reference in New Issue
Block a user