Sammy/t 363 comments count at row level depends on total comments number (#192)

* feature: add rightEndContent to editable cell

* refactor: use rightEndContent instead of comments sections

* refactor: move commentCount in a var

* feature: get commentsCount from backend

* refactor: use an index

* feature: use commentCount from backend on people

* refactor: rename commentCount for companies

* refactor: use generated queries, instead of useQuery
This commit is contained in:
Sammy Teillet
2023-06-05 14:41:27 +02:00
committed by GitHub
parent d3684b34c5
commit 6de90024ef
8 changed files with 162 additions and 22 deletions

View File

@ -2,6 +2,8 @@ import { useOpenCommentRightDrawer } from '@/comments/hooks/useOpenCommentRightD
import EditableChip from '@/ui/components/editable-cell/types/EditableChip';
import { getLogoUrlFromDomainName } from '@/utils/utils';
import { CellCommentChip } from '../../comments/components/comments/CellCommentChip';
import { useCompanyCommentsCountQuery } from '../../comments/services';
import { Company } from '../interfaces/company.interface';
import { updateCompany } from '../services';
@ -23,6 +25,8 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) {
]);
}
const commentCount = useCompanyCommentsCountQuery(company.id);
return (
<EditableChip
value={company.name || ''}
@ -35,8 +39,14 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) {
});
}}
ChipComponent={CompanyChip}
commentCount={12}
onCommentClick={handleCommentClick}
rightEndContents={[
commentCount.loading ? null : (
<CellCommentChip
count={commentCount.data || 0}
onClick={handleCommentClick}
/>
),
]}
/>
);
}