* feat: no atomic * feat: update front not atomic operations * feat: optional fields for person model & use proper gql type * Fix bug display name * Fix bug update user * Fixed bug avatar URL * Fixed display name on people cell * Fix lint * Fixed storybook display name * Fix storybook requests --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
import { getOperationName } from '@apollo/client/utilities';
|
|
import { useTheme } from '@emotion/react';
|
|
import styled from '@emotion/styled';
|
|
|
|
import { GET_COMPANIES } from '@/companies/queries';
|
|
import { CompanyTable } from '@/companies/table/components/CompanyTable';
|
|
import { TableActionBarButtonCreateCommentThreadCompany } from '@/companies/table/components/TableActionBarButtonCreateCommentThreadCompany';
|
|
import { TableActionBarButtonDeleteCompanies } from '@/companies/table/components/TableActionBarButtonDeleteCompanies';
|
|
import { IconBuildingSkyscraper } from '@/ui/icon';
|
|
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
|
import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
|
|
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
|
|
import { TableContext } from '@/ui/table/states/TableContext';
|
|
import { useInsertOneCompanyMutation } from '~/generated/graphql';
|
|
|
|
import { SEARCH_COMPANY_QUERY } from '../../modules/search/queries/search';
|
|
|
|
const StyledTableContainer = styled.div`
|
|
display: flex;
|
|
width: 100%;
|
|
`;
|
|
|
|
export function Companies() {
|
|
const [insertCompany] = useInsertOneCompanyMutation();
|
|
|
|
async function handleAddButtonClick() {
|
|
await insertCompany({
|
|
variables: {
|
|
data: {
|
|
name: '',
|
|
domainName: '',
|
|
address: '',
|
|
},
|
|
},
|
|
refetchQueries: [
|
|
getOperationName(GET_COMPANIES) ?? '',
|
|
getOperationName(SEARCH_COMPANY_QUERY) ?? '',
|
|
],
|
|
});
|
|
}
|
|
|
|
const theme = useTheme();
|
|
|
|
return (
|
|
<>
|
|
<WithTopBarContainer
|
|
title="Companies"
|
|
icon={<IconBuildingSkyscraper size={theme.icon.size.md} />}
|
|
onAddButtonClick={handleAddButtonClick}
|
|
>
|
|
<RecoilScope SpecificContext={TableContext}>
|
|
<StyledTableContainer>
|
|
<CompanyTable />
|
|
</StyledTableContainer>
|
|
<EntityTableActionBar>
|
|
<TableActionBarButtonCreateCommentThreadCompany />
|
|
<TableActionBarButtonDeleteCompanies />
|
|
</EntityTableActionBar>
|
|
</RecoilScope>
|
|
</WithTopBarContainer>
|
|
</>
|
|
);
|
|
}
|