* Added prisma to suggested extension in container * Added comments and authors on drawer with proper resolving * Fix lint * Fix console log * Fixed generated front graphql from rebase * Fixed right drawer width and shared in theme * Added date packages and tooltip * Added date utils and tests * Added comment thread components * Fixed comment chip * wip * wip 2 * - Added string typing for DateTime scalar - Refactored user in a recoil state and workspace using it - Added comment creation * Prepared EditableCell refactor * Fixed line height and tooltip * Fix lint
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import { CellCommentChip } from '@/comments/components/comments/CellCommentChip';
|
|
import { useOpenCommentRightDrawer } from '@/comments/hooks/useOpenCommentRightDrawer';
|
|
import { useCompanyCommentsCountQuery } from '@/comments/services';
|
|
import EditableChip from '@/ui/components/editable-cell/types/EditableChip';
|
|
import { getLogoUrlFromDomainName } from '@/utils/utils';
|
|
|
|
import { Company } from '../interfaces/company.interface';
|
|
import { updateCompany } from '../services';
|
|
|
|
import CompanyChip from './CompanyChip';
|
|
|
|
type OwnProps = {
|
|
company: Company;
|
|
};
|
|
|
|
export function CompanyEditableNameChipCell({ company }: OwnProps) {
|
|
const openCommentRightDrawer = useOpenCommentRightDrawer();
|
|
|
|
function handleCommentClick(event: React.MouseEvent<HTMLDivElement>) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
|
|
openCommentRightDrawer([
|
|
{
|
|
type: 'Company',
|
|
id: company.id,
|
|
},
|
|
]);
|
|
}
|
|
|
|
const commentCount = useCompanyCommentsCountQuery(company.id);
|
|
|
|
return (
|
|
<EditableChip
|
|
value={company.name || ''}
|
|
placeholder="Name"
|
|
picture={getLogoUrlFromDomainName(company.domainName)}
|
|
changeHandler={(value: string) => {
|
|
updateCompany({
|
|
...company,
|
|
name: value,
|
|
});
|
|
}}
|
|
ChipComponent={CompanyChip}
|
|
rightEndContents={[
|
|
<CellCommentChip
|
|
count={commentCount.data ?? 0}
|
|
onClick={handleCommentClick}
|
|
/>,
|
|
]}
|
|
/>
|
|
);
|
|
}
|