Lucas/t 366 on comment drawer when i have comments on the selected (#201)
* 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 * Fix from rebase * Fix from rebase * Fix margin right * Fixed CSS and graphql
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
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 { CellCommentChip } from '../../comments/components/comments/CellCommentChip';
|
||||
import { useCompanyCommentsCountQuery } from '../../comments/services';
|
||||
import { Company } from '../interfaces/company.interface';
|
||||
import { updateCompany } from '../services';
|
||||
|
||||
@ -16,7 +16,10 @@ type OwnProps = {
|
||||
export function CompanyEditableNameChipCell({ company }: OwnProps) {
|
||||
const openCommentRightDrawer = useOpenCommentRightDrawer();
|
||||
|
||||
function handleCommentClick() {
|
||||
function handleCommentClick(event: React.MouseEvent<HTMLDivElement>) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
openCommentRightDrawer([
|
||||
{
|
||||
type: 'Company',
|
||||
@ -27,6 +30,8 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) {
|
||||
|
||||
const commentCount = useCompanyCommentsCountQuery(company.id);
|
||||
|
||||
const displayCommentCount = !commentCount.loading;
|
||||
|
||||
return (
|
||||
<EditableChip
|
||||
value={company.name || ''}
|
||||
@ -40,9 +45,9 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) {
|
||||
}}
|
||||
ChipComponent={CompanyChip}
|
||||
rightEndContents={[
|
||||
commentCount.loading ? null : (
|
||||
displayCommentCount && (
|
||||
<CellCommentChip
|
||||
count={commentCount.data || 0}
|
||||
count={commentCount.data ?? 0}
|
||||
onClick={handleCommentClick}
|
||||
/>
|
||||
),
|
||||
|
||||
@ -21,6 +21,7 @@ describe('Company mappers', () => {
|
||||
id: '7af20dea-0412-4c4c-8b13-d6f0e6e09e87',
|
||||
email: 'john@example.com',
|
||||
displayName: 'John Doe',
|
||||
avatarUrl: 'https://example.com/avatar.png',
|
||||
__typename: 'User',
|
||||
},
|
||||
pipes: [
|
||||
@ -47,6 +48,7 @@ describe('Company mappers', () => {
|
||||
__typename: 'users',
|
||||
id: '7af20dea-0412-4c4c-8b13-d6f0e6e09e87',
|
||||
email: 'john@example.com',
|
||||
avatarUrl: 'https://example.com/avatar.png',
|
||||
displayName: 'John Doe',
|
||||
workspaceMember: undefined,
|
||||
},
|
||||
@ -67,6 +69,7 @@ describe('Company mappers', () => {
|
||||
accountOwner: {
|
||||
id: '522d4ec4-c46b-4360-a0a7-df8df170be81',
|
||||
email: 'john@example.com',
|
||||
avatarUrl: 'https://example.com/avatar.png',
|
||||
displayName: 'John Doe',
|
||||
__typename: 'users',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user