* Removed view field duplicate types * wip * wip 2 * wip 3 * Unified state for fields * Renaming * Wip * Post merge * Post post merge * wip * Delete unused file * Boolean and Probability * Finished InlineCell * Renamed EditableCell to TableCell * Finished double texts * Finished MoneyField * Fixed bug inline cell click outside * Fixed hotkey scope * Final fixes * Phone * Fix url and number input validation * Fix * Fix position * wip refactor activity editor * Fixed activity editor --------- Co-authored-by: Charles Bochet <charles@twenty.com>
62 lines
1.3 KiB
TypeScript
62 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import styled from '@emotion/styled';
|
|
import { useRecoilState } from 'recoil';
|
|
|
|
import { ActivityEditor } from '@/activities/components/ActivityEditor';
|
|
import { entityFieldsFamilyState } from '@/ui/field/states/entityFieldsFamilyState';
|
|
import { useGetActivityQuery } from '~/generated/graphql';
|
|
|
|
import '@blocknote/core/style.css';
|
|
|
|
const StyledContainer = styled.div`
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
justify-content: space-between;
|
|
overflow-y: auto;
|
|
position: relative;
|
|
`;
|
|
|
|
type OwnProps = {
|
|
activityId: string;
|
|
showComment?: boolean;
|
|
autoFillTitle?: boolean;
|
|
};
|
|
|
|
export const RightDrawerActivity = ({
|
|
activityId,
|
|
showComment = true,
|
|
autoFillTitle = false,
|
|
}: OwnProps) => {
|
|
const [, setEntityFields] = useRecoilState(
|
|
entityFieldsFamilyState(activityId),
|
|
);
|
|
|
|
const { data } = useGetActivityQuery({
|
|
variables: {
|
|
activityId: activityId ?? '',
|
|
},
|
|
skip: !activityId,
|
|
onCompleted: (data) => {
|
|
setEntityFields(data?.findManyActivities[0] ?? {});
|
|
},
|
|
});
|
|
|
|
const activity = data?.findManyActivities[0];
|
|
|
|
if (!activity) {
|
|
return <></>;
|
|
}
|
|
|
|
return (
|
|
<StyledContainer>
|
|
<ActivityEditor
|
|
activity={activity}
|
|
showComment={showComment}
|
|
autoFillTitle={autoFillTitle}
|
|
/>
|
|
</StyledContainer>
|
|
);
|
|
};
|