Sammy/t fix display of comment section (#197)
* feature: do not display commentChip if no comments * style: add mocked data for comment sections
This commit is contained in:
@ -47,6 +47,7 @@ const StyledCount = styled.div`
|
||||
`;
|
||||
|
||||
export function CommentChip({ count, onClick }: CommentChipProps) {
|
||||
if (count === 0) return null;
|
||||
const formattedCount = count > 99 ? '99+' : count;
|
||||
|
||||
return (
|
||||
|
||||
@ -4,6 +4,11 @@ import { GraphqlQueryCompany } from '@/companies/interfaces/company.interface';
|
||||
import { GraphqlQueryPerson } from '@/people/interfaces/person.interface';
|
||||
import { GraphqlQueryUser } from '@/users/interfaces/user.interface';
|
||||
|
||||
import {
|
||||
GetCompanyCountsQuery,
|
||||
GetPeopleCountsQuery,
|
||||
} from '../generated/graphql';
|
||||
|
||||
import { mockedCompaniesData } from './mock-data/companies';
|
||||
import { mockedPeopleData } from './mock-data/people';
|
||||
import { mockedUsersData } from './mock-data/users';
|
||||
@ -93,4 +98,17 @@ export const graphqlMocks = [
|
||||
}),
|
||||
);
|
||||
}),
|
||||
graphql.query('GetPeopleCounts', (req, res, ctx) => {
|
||||
const mockedData: GetPeopleCountsQuery = {
|
||||
people: [{ commentsCount: 12 }],
|
||||
};
|
||||
return res(ctx.data(mockedData));
|
||||
}),
|
||||
|
||||
graphql.query('GetCompanyCounts', (req, res, ctx) => {
|
||||
const mockedData: GetCompanyCountsQuery = {
|
||||
companies: [{ commentsCount: 20 }],
|
||||
};
|
||||
return res(ctx.data(mockedData));
|
||||
}),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user