Uniformize folder structure (#693)
* Uniformize folder structure * Fix icons * Fix icons * Fix tests * Fix tests
This commit is contained in:
@ -13,15 +13,15 @@ import { Title } from '@/auth/components/ui/Title';
|
||||
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
|
||||
import { useScopedHotkeys } from '@/lib/hotkeys/hooks/useScopedHotkeys';
|
||||
import { ProfilePictureUploader } from '@/settings/profile/components/ProfilePictureUploader';
|
||||
import { useSnackBar } from '@/snack-bar/hooks/useSnackBar';
|
||||
import { MainButton } from '@/ui/components/buttons/MainButton';
|
||||
import { TextInput } from '@/ui/components/inputs/TextInput';
|
||||
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
|
||||
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
|
||||
import { MainButton } from '@/ui/button/components/MainButton';
|
||||
import { useScopedHotkeys } from '@/ui/hotkey/hooks/useScopedHotkeys';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { useSnackBar } from '@/ui/snack-bar/hooks/useSnackBar';
|
||||
import { SubSectionTitle } from '@/ui/title/components/SubSectionTitle';
|
||||
import { GET_CURRENT_USER } from '@/users/queries';
|
||||
import { useUpdateUserMutation } from '~/generated/graphql';
|
||||
import { PageHotkeyScope } from '~/sync-hooks/types/PageHotkeyScope';
|
||||
|
||||
const StyledContentContainer = styled.div`
|
||||
width: 100%;
|
||||
|
||||
@ -10,15 +10,15 @@ import { SubTitle } from '@/auth/components/ui/SubTitle';
|
||||
import { Title } from '@/auth/components/ui/Title';
|
||||
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
|
||||
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
|
||||
import { useScopedHotkeys } from '@/lib/hotkeys/hooks/useScopedHotkeys';
|
||||
import { WorkspaceLogoUploader } from '@/settings/workspace/components/WorkspaceLogoUploader';
|
||||
import { useSnackBar } from '@/snack-bar/hooks/useSnackBar';
|
||||
import { MainButton } from '@/ui/components/buttons/MainButton';
|
||||
import { TextInput } from '@/ui/components/inputs/TextInput';
|
||||
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
|
||||
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
|
||||
import { MainButton } from '@/ui/button/components/MainButton';
|
||||
import { useScopedHotkeys } from '@/ui/hotkey/hooks/useScopedHotkeys';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { useSnackBar } from '@/ui/snack-bar/hooks/useSnackBar';
|
||||
import { SubSectionTitle } from '@/ui/title/components/SubSectionTitle';
|
||||
import { GET_CURRENT_USER } from '@/users/queries';
|
||||
import { useUpdateWorkspaceMutation } from '~/generated/graphql';
|
||||
import { PageHotkeyScope } from '~/sync-hooks/types/PageHotkeyScope';
|
||||
|
||||
const StyledContentContainer = styled.div`
|
||||
width: 100%;
|
||||
|
||||
@ -12,12 +12,12 @@ import { Title } from '@/auth/components/ui/Title';
|
||||
import { authFlowUserEmailState } from '@/auth/states/authFlowUserEmailState';
|
||||
import { authProvidersState } from '@/client-config/states/authProvidersState';
|
||||
import { isDemoModeState } from '@/client-config/states/isDemoModeState';
|
||||
import { useScopedHotkeys } from '@/lib/hotkeys/hooks/useScopedHotkeys';
|
||||
import { MainButton } from '@/ui/components/buttons/MainButton';
|
||||
import { TextInput } from '@/ui/components/inputs/TextInput';
|
||||
import { AnimatedEaseIn } from '@/ui/components/motion/AnimatedEaseIn';
|
||||
import { IconBrandGoogle } from '@/ui/icons';
|
||||
import { PageHotkeyScope } from '~/sync-hooks/types/PageHotkeyScope';
|
||||
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
|
||||
import { AnimatedEaseIn } from '@/ui/animation/components/AnimatedEaseIn';
|
||||
import { MainButton } from '@/ui/button/components/MainButton';
|
||||
import { useScopedHotkeys } from '@/ui/hotkey/hooks/useScopedHotkeys';
|
||||
import { IconBrandGoogle } from '@/ui/icon';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
|
||||
const StyledContentContainer = styled.div`
|
||||
width: 200px;
|
||||
|
||||
@ -13,13 +13,13 @@ import { useAuth } from '@/auth/hooks/useAuth';
|
||||
import { authFlowUserEmailState } from '@/auth/states/authFlowUserEmailState';
|
||||
import { PASSWORD_REGEX } from '@/auth/utils/passwordRegex';
|
||||
import { isDemoModeState } from '@/client-config/states/isDemoModeState';
|
||||
import { useScopedHotkeys } from '@/lib/hotkeys/hooks/useScopedHotkeys';
|
||||
import { useSnackBar } from '@/snack-bar/hooks/useSnackBar';
|
||||
import { MainButton } from '@/ui/components/buttons/MainButton';
|
||||
import { TextInput } from '@/ui/components/inputs/TextInput';
|
||||
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
|
||||
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
|
||||
import { MainButton } from '@/ui/button/components/MainButton';
|
||||
import { useScopedHotkeys } from '@/ui/hotkey/hooks/useScopedHotkeys';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { useSnackBar } from '@/ui/snack-bar/hooks/useSnackBar';
|
||||
import { SubSectionTitle } from '@/ui/title/components/SubSectionTitle';
|
||||
import { useCheckUserExistsQuery } from '~/generated/graphql';
|
||||
import { PageHotkeyScope } from '~/sync-hooks/types/PageHotkeyScope';
|
||||
|
||||
const StyledContentContainer = styled.div`
|
||||
width: 100%;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { AuthModal } from '@/auth/components/ui/Modal';
|
||||
import { AuthLayout } from '@/ui/layout/AuthLayout';
|
||||
import { AuthLayout } from '@/ui/layout/components/AuthLayout';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { AuthModal } from '@/auth/components/ui/Modal';
|
||||
import { AuthLayout } from '@/ui/layout/AuthLayout';
|
||||
import { AuthLayout } from '@/ui/layout/components/AuthLayout';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { AuthModal } from '@/auth/components/ui/Modal';
|
||||
import { AuthLayout } from '@/ui/layout/AuthLayout';
|
||||
import { AuthLayout } from '@/ui/layout/components/AuthLayout';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { AuthModal } from '@/auth/components/ui/Modal';
|
||||
import { AuthLayout } from '@/ui/layout/AuthLayout';
|
||||
import { AuthLayout } from '@/ui/layout/components/AuthLayout';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { getRenderWrapperForPage } from '~/testing/renderWrappers';
|
||||
|
||||
|
||||
@ -4,20 +4,19 @@ import styled from '@emotion/styled';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { GET_COMPANIES } from '@/companies/queries';
|
||||
import { RecoilScope } from '@/recoil-scope/components/RecoilScope';
|
||||
import { EntityTableActionBar } from '@/ui/components/table/action-bar/EntityTableActionBar';
|
||||
import { IconBuildingSkyscraper } from '@/ui/icons/index';
|
||||
import { WithTopBarContainer } from '@/ui/layout/containers/WithTopBarContainer';
|
||||
import { TableContext } from '@/ui/tables/states/TableContext';
|
||||
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 {
|
||||
InsertCompanyMutationVariables,
|
||||
useInsertCompanyMutation,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
import { TableActionBarButtonCreateCommentThreadCompany } from './table/TableActionBarButtonCreateCommentThreadCompany';
|
||||
import { TableActionBarButtonDeleteCompanies } from './table/TableActionBarButtonDeleteCompanies';
|
||||
import { CompanyTable } from './CompanyTable';
|
||||
|
||||
const StyledTableContainer = styled.div`
|
||||
display: flex;
|
||||
width: 100%;
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { RecoilScope } from '@/recoil-scope/components/RecoilScope';
|
||||
import { EntityTableActionBar } from '@/ui/components/table/action-bar/EntityTableActionBar';
|
||||
import { IconBuildingSkyscraper } from '@/ui/icons/index';
|
||||
import { WithTopBarContainer } from '@/ui/layout/containers/WithTopBarContainer';
|
||||
import { TableContext } from '@/ui/tables/states/TableContext';
|
||||
|
||||
import { TableActionBarButtonCreateCommentThreadCompany } from './table/TableActionBarButtonCreateCommentThreadCompany';
|
||||
import { TableActionBarButtonDeleteCompanies } from './table/TableActionBarButtonDeleteCompanies';
|
||||
import { CompanyTableMockMode } from './CompanyTableMockMode';
|
||||
import { CompanyTableMockMode } from '@/companies/table/components/CompanyTableMockMode';
|
||||
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';
|
||||
|
||||
const StyledTableContainer = styled.div`
|
||||
display: flex;
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useTheme } from '@emotion/react';
|
||||
|
||||
import { Timeline } from '@/comments/components/timeline/Timeline';
|
||||
import { CompanyAccountOwnerEditableField } from '@/companies/fields/components/CompanyAccountOwnerEditableField';
|
||||
import { CompanyAddressEditableField } from '@/companies/fields/components/CompanyAddressEditableField';
|
||||
import { CompanyCreatedAtEditableField } from '@/companies/fields/components/CompanyCreatedAtEditableField';
|
||||
import { CompanyDomainNameEditableField } from '@/companies/fields/components/CompanyDomainNameEditableField';
|
||||
import { CompanyEmployeesEditableField } from '@/companies/fields/components/CompanyEmployeesEditableField';
|
||||
import { Timeline } from '@/activities/timeline/components/Timeline';
|
||||
import { CompanyAccountOwnerEditableField } from '@/companies/editable-field/components/CompanyAccountOwnerEditableField';
|
||||
import { CompanyAddressEditableField } from '@/companies/editable-field/components/CompanyAddressEditableField';
|
||||
import { CompanyCreatedAtEditableField } from '@/companies/editable-field/components/CompanyCreatedAtEditableField';
|
||||
import { CompanyDomainNameEditableField } from '@/companies/editable-field/components/CompanyDomainNameEditableField';
|
||||
import { CompanyEmployeesEditableField } from '@/companies/editable-field/components/CompanyEmployeesEditableField';
|
||||
import { useCompanyQuery } from '@/companies/queries';
|
||||
import { PropertyBox } from '@/ui/components/property-box/PropertyBox';
|
||||
import { IconBuildingSkyscraper } from '@/ui/icons/index';
|
||||
import { WithTopBarContainer } from '@/ui/layout/containers/WithTopBarContainer';
|
||||
import { ShowPageLeftContainer } from '@/ui/layout/show-page/containers/ShowPageLeftContainer';
|
||||
import { ShowPageRightContainer } from '@/ui/layout/show-page/containers/ShowPageRightContainer';
|
||||
import { ShowPageSummaryCard } from '@/ui/layout/show-page/ShowPageSummaryCard';
|
||||
import { getLogoUrlFromDomainName } from '@/utils/utils';
|
||||
import { PropertyBox } from '@/ui/editable-field/property-box/components/PropertyBox';
|
||||
import { IconBuildingSkyscraper } from '@/ui/icon';
|
||||
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
||||
import { ShowPageLeftContainer } from '@/ui/layout/show-page/components/ShowPageLeftContainer';
|
||||
import { ShowPageRightContainer } from '@/ui/layout/show-page/components/ShowPageRightContainer';
|
||||
import { ShowPageSummaryCard } from '@/ui/layout/show-page/components/ShowPageSummaryCard';
|
||||
import { CommentableType } from '~/generated/graphql';
|
||||
import { getLogoUrlFromDomainName } from '~/utils';
|
||||
|
||||
export function CompanyShow() {
|
||||
const companyId = useParams().companyId ?? '';
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { IconList } from '@tabler/icons-react';
|
||||
|
||||
import { CompaniesSelectedSortType, defaultOrderBy } from '@/companies/queries';
|
||||
import { companyColumns } from '@/companies/table/components/companyColumns';
|
||||
import { CompanyEntityTableData } from '@/companies/table/components/CompanyEntityTableData';
|
||||
import { reduceSortsToOrderBy } from '@/lib/filters-and-sorts/helpers';
|
||||
import { filtersScopedState } from '@/lib/filters-and-sorts/states/filtersScopedState';
|
||||
import { turnFilterIntoWhereClause } from '@/lib/filters-and-sorts/utils/turnFilterIntoWhereClause';
|
||||
import { useRecoilScopedValue } from '@/recoil-scope/hooks/useRecoilScopedValue';
|
||||
import { EntityTable } from '@/ui/components/table/EntityTable';
|
||||
import { HooksEntityTable } from '@/ui/components/table/HooksEntityTable';
|
||||
import { TableContext } from '@/ui/tables/states/TableContext';
|
||||
import { CompanyOrderByWithRelationInput } from '~/generated/graphql';
|
||||
|
||||
import { companiesFilters } from './companies-filters';
|
||||
import { availableSorts } from './companies-sorts';
|
||||
|
||||
export function CompanyTable() {
|
||||
const [orderBy, setOrderBy] =
|
||||
useState<CompanyOrderByWithRelationInput[]>(defaultOrderBy);
|
||||
|
||||
const updateSorts = useCallback((sorts: Array<CompaniesSelectedSortType>) => {
|
||||
setOrderBy(sorts.length ? reduceSortsToOrderBy(sorts) : defaultOrderBy);
|
||||
}, []);
|
||||
|
||||
const filters = useRecoilScopedValue(filtersScopedState, TableContext);
|
||||
|
||||
const whereFilters = useMemo(() => {
|
||||
return { AND: filters.map(turnFilterIntoWhereClause) };
|
||||
}, [filters]) as any;
|
||||
|
||||
return (
|
||||
<>
|
||||
<CompanyEntityTableData orderBy={orderBy} whereFilters={whereFilters} />
|
||||
<HooksEntityTable
|
||||
numberOfColumns={companyColumns.length}
|
||||
availableFilters={companiesFilters}
|
||||
/>
|
||||
<EntityTable
|
||||
columns={companyColumns}
|
||||
viewName="All Companies"
|
||||
viewIcon={<IconList size={16} />}
|
||||
availableSorts={availableSorts}
|
||||
onSortsUpdate={updateSorts}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
import { IconList } from '@tabler/icons-react';
|
||||
|
||||
import { companyColumns } from '@/companies/table/components/companyColumns';
|
||||
import { CompanyEntityTableDataMocked } from '@/companies/table/components/CompanyEntityTableDataMocked';
|
||||
import { EntityTable } from '@/ui/components/table/EntityTable';
|
||||
import { HooksEntityTable } from '@/ui/components/table/HooksEntityTable';
|
||||
|
||||
import { companiesFilters } from './companies-filters';
|
||||
import { availableSorts } from './companies-sorts';
|
||||
|
||||
export function CompanyTableMockMode() {
|
||||
return (
|
||||
<>
|
||||
<CompanyEntityTableDataMocked />
|
||||
<HooksEntityTable
|
||||
numberOfColumns={companyColumns.length}
|
||||
availableFilters={companiesFilters}
|
||||
/>
|
||||
<EntityTable
|
||||
columns={companyColumns}
|
||||
viewName="All Companies"
|
||||
viewIcon={<IconList size={16} />}
|
||||
availableSorts={availableSorts}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -6,8 +6,8 @@ import { graphql } from 'msw';
|
||||
import {
|
||||
GET_COMMENT_THREAD,
|
||||
GET_COMMENT_THREADS_BY_TARGETS,
|
||||
} from '@/comments/services';
|
||||
import { CREATE_COMMENT_THREAD_WITH_COMMENT } from '@/comments/services/create';
|
||||
} from '@/activities/queries';
|
||||
import { CREATE_COMMENT_THREAD_WITH_COMMENT } from '@/activities/queries/create';
|
||||
import { GET_COMPANY } from '@/companies/queries';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { mockedCommentThreads } from '~/testing/mock-data/comment-threads';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FilterDefinitionByEntity } from '@/lib/filters-and-sorts/types/FilterDefinitionByEntity';
|
||||
import { FilterDefinitionByEntity } from '@/ui/filter-n-sort/types/FilterDefinitionByEntity';
|
||||
import {
|
||||
IconBuildingSkyscraper,
|
||||
IconCalendarEvent,
|
||||
@ -6,7 +6,7 @@ import {
|
||||
IconMap,
|
||||
IconUser,
|
||||
IconUsers,
|
||||
} from '@/ui/icons/index';
|
||||
} from '@/ui/icon/index';
|
||||
import { icon } from '@/ui/themes/icon';
|
||||
import { FilterDropdownUserSearchSelect } from '@/users/components/FilterDropdownUserSearchSelect';
|
||||
import { Company } from '~/generated/graphql';
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { SortType } from '@/lib/filters-and-sorts/interfaces/sorts/interface';
|
||||
import { SortType } from '@/ui/filter-n-sort/types/interface';
|
||||
import {
|
||||
IconBuildingSkyscraper,
|
||||
IconCalendarEvent,
|
||||
IconLink,
|
||||
IconMap,
|
||||
IconUsers,
|
||||
} from '@/ui/icons/index';
|
||||
} from '@/ui/icon/index';
|
||||
import { CompanyOrderByWithRelationInput as Companies_Order_By } from '~/generated/graphql';
|
||||
|
||||
export const availableSorts = [
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
import { useOpenCreateCommentThreadDrawerForSelectedRowIds } from '@/comments/hooks/useOpenCreateCommentDrawerForSelectedRowIds';
|
||||
import { TableActionBarButtonToggleComments } from '@/ui/components/table/action-bar/TableActionBarButtonOpenComments';
|
||||
import { CommentableType } from '~/generated/graphql';
|
||||
|
||||
export function TableActionBarButtonCreateCommentThreadCompany() {
|
||||
const openCreateCommentThreadRightDrawer =
|
||||
useOpenCreateCommentThreadDrawerForSelectedRowIds();
|
||||
|
||||
async function handleButtonClick() {
|
||||
openCreateCommentThreadRightDrawer(CommentableType.Company);
|
||||
}
|
||||
|
||||
return <TableActionBarButtonToggleComments onClick={handleButtonClick} />;
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
import { getOperationName } from '@apollo/client/utilities';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { GET_COMPANIES } from '@/companies/queries';
|
||||
import { EntityTableActionBarButton } from '@/ui/components/table/action-bar/EntityTableActionBarButton';
|
||||
import { IconTrash } from '@/ui/icons/index';
|
||||
import { useResetTableRowSelection } from '@/ui/tables/hooks/useResetTableRowSelection';
|
||||
import { selectedRowIdsSelector } from '@/ui/tables/states/selectedRowIdsSelector';
|
||||
import { useDeleteCompaniesMutation } from '~/generated/graphql';
|
||||
|
||||
export function TableActionBarButtonDeleteCompanies() {
|
||||
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
||||
|
||||
const resetRowSelection = useResetTableRowSelection();
|
||||
|
||||
const [deleteCompanies] = useDeleteCompaniesMutation({
|
||||
refetchQueries: [getOperationName(GET_COMPANIES) ?? ''],
|
||||
});
|
||||
|
||||
async function handleDeleteClick() {
|
||||
const rowIdsToDelete = selectedRowIds;
|
||||
|
||||
resetRowSelection();
|
||||
|
||||
await deleteCompanies({
|
||||
variables: {
|
||||
ids: rowIdsToDelete,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<EntityTableActionBarButton
|
||||
label="Delete"
|
||||
icon={<IconTrash size={16} />}
|
||||
type="warning"
|
||||
onClick={handleDeleteClick}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,138 +0,0 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useRecoilCallback, useRecoilState } from 'recoil';
|
||||
|
||||
import { companyProgressesFamilyState } from '@/companies/states/companyProgressesFamilyState';
|
||||
import {
|
||||
CompanyForBoard,
|
||||
CompanyProgress,
|
||||
PipelineProgressForBoard,
|
||||
} from '@/companies/types/CompanyProgress';
|
||||
import { boardState } from '@/pipeline-progress/states/boardState';
|
||||
import { currentPipelineState } from '@/pipeline-progress/states/currentPipelineState';
|
||||
import { isBoardLoadedState } from '@/pipeline-progress/states/isBoardLoadedState';
|
||||
import { BoardPipelineStageColumn } from '@/ui/board/components/Board';
|
||||
import {
|
||||
Pipeline,
|
||||
PipelineStage,
|
||||
useGetCompaniesQuery,
|
||||
useGetPipelineProgressQuery,
|
||||
useGetPipelinesQuery,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
export function HookCompanyBoard() {
|
||||
const [currentPipeline, setCurrentPipeline] =
|
||||
useRecoilState(currentPipelineState);
|
||||
|
||||
const [, setBoard] = useRecoilState(boardState);
|
||||
|
||||
const [, setIsBoardLoaded] = useRecoilState(isBoardLoadedState);
|
||||
|
||||
useGetPipelinesQuery({
|
||||
onCompleted: async (data) => {
|
||||
const pipeline = data?.findManyPipeline[0] as Pipeline;
|
||||
setCurrentPipeline(pipeline);
|
||||
const pipelineStages = pipeline?.pipelineStages;
|
||||
const orderedPipelineStages = pipelineStages
|
||||
? [...pipelineStages].sort((a, b) => {
|
||||
if (!a.index || !b.index) return 0;
|
||||
return a.index - b.index;
|
||||
})
|
||||
: [];
|
||||
const initialBoard: BoardPipelineStageColumn[] =
|
||||
orderedPipelineStages?.map((pipelineStage) => ({
|
||||
pipelineStageId: pipelineStage.id,
|
||||
title: pipelineStage.name,
|
||||
colorCode: pipelineStage.color,
|
||||
index: pipelineStage.index || 0,
|
||||
pipelineProgressIds:
|
||||
pipelineStage.pipelineProgresses?.map(
|
||||
(item) => item.id as string,
|
||||
) || [],
|
||||
})) || [];
|
||||
setBoard(initialBoard);
|
||||
setIsBoardLoaded(true);
|
||||
},
|
||||
});
|
||||
|
||||
const pipelineProgressIds = currentPipeline?.pipelineStages
|
||||
?.map((pipelineStage: PipelineStage) =>
|
||||
(
|
||||
pipelineStage.pipelineProgresses?.map((item) => item.id as string) || []
|
||||
).flat(),
|
||||
)
|
||||
.flat();
|
||||
|
||||
const pipelineProgressesQuery = useGetPipelineProgressQuery({
|
||||
variables: {
|
||||
where: {
|
||||
id: { in: pipelineProgressIds },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const pipelineProgresses =
|
||||
pipelineProgressesQuery.data?.findManyPipelineProgress || [];
|
||||
|
||||
const entitiesQueryResult = useGetCompaniesQuery({
|
||||
variables: {
|
||||
where: {
|
||||
id: {
|
||||
in: pipelineProgresses.map((item) => item.progressableId),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const indexCompanyByIdReducer = (
|
||||
acc: { [key: string]: CompanyForBoard },
|
||||
company: CompanyForBoard,
|
||||
) => ({
|
||||
...acc,
|
||||
[company.id]: company,
|
||||
});
|
||||
|
||||
const companiesDict =
|
||||
entitiesQueryResult.data?.companies.reduce(
|
||||
indexCompanyByIdReducer,
|
||||
{} as { [key: string]: CompanyForBoard },
|
||||
) || {};
|
||||
|
||||
const indexPipelineProgressByIdReducer = (
|
||||
acc: {
|
||||
[key: string]: CompanyProgress;
|
||||
},
|
||||
pipelineProgress: PipelineProgressForBoard,
|
||||
) => {
|
||||
const company = companiesDict[pipelineProgress.progressableId];
|
||||
return {
|
||||
...acc,
|
||||
[pipelineProgress.id]: {
|
||||
pipelineProgress,
|
||||
company,
|
||||
},
|
||||
};
|
||||
};
|
||||
const companyBoardIndex = pipelineProgresses.reduce(
|
||||
indexPipelineProgressByIdReducer,
|
||||
{} as { [key: string]: CompanyProgress },
|
||||
);
|
||||
|
||||
const synchronizeCompanyProgresses = useRecoilCallback(
|
||||
({ set }) =>
|
||||
(companyBoardIndex: { [key: string]: CompanyProgress }) => {
|
||||
Object.entries(companyBoardIndex).forEach(([id, companyProgress]) => {
|
||||
set(companyProgressesFamilyState(id), companyProgress);
|
||||
});
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const loading =
|
||||
entitiesQueryResult.loading || pipelineProgressesQuery.loading;
|
||||
|
||||
useEffect(() => {
|
||||
!loading && synchronizeCompanyProgresses(companyBoardIndex);
|
||||
}, [loading, companyBoardIndex, synchronizeCompanyProgresses]);
|
||||
|
||||
return <></>;
|
||||
}
|
||||
@ -1,15 +1,14 @@
|
||||
import { useTheme } from '@emotion/react';
|
||||
|
||||
import { companyBoardOptions } from '@/companies/components/companyBoardOptions';
|
||||
import { HookCompanyBoard } from '@/companies/components/HookCompanyBoard';
|
||||
import { CompanyBoardContext } from '@/companies/states/CompanyBoardContext';
|
||||
import { BoardActionBarButtonDeletePipelineProgress } from '@/pipeline-progress/components/BoardActionBarButtonDeletePipelineProgress';
|
||||
import { EntityBoard } from '@/pipeline-progress/components/EntityBoard';
|
||||
import { EntityBoardActionBar } from '@/pipeline-progress/components/EntityBoardActionBar';
|
||||
import { RecoilScope } from '@/recoil-scope/components/RecoilScope';
|
||||
import { IconTargetArrow } from '@/ui/icons/index';
|
||||
import { WithTopBarContainer } from '@/ui/layout/containers/WithTopBarContainer';
|
||||
|
||||
import { HookCompanyBoard } from './HookCompanyBoard';
|
||||
import { BoardActionBarButtonDeletePipelineProgress } from '@/pipeline/components/BoardActionBarButtonDeletePipelineProgress';
|
||||
import { EntityBoard } from '@/pipeline/components/EntityBoard';
|
||||
import { EntityBoardActionBar } from '@/pipeline/components/EntityBoardActionBar';
|
||||
import { IconTargetArrow } from '@/ui/icon/index';
|
||||
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
||||
import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
|
||||
|
||||
export function Opportunities() {
|
||||
const theme = useTheme();
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
{ /* Opportunities.mdx */ }
|
||||
|
||||
import { Canvas, Meta } from '@storybook/blocks';
|
||||
|
||||
import * as Opportunities from './Opportunities.stories';
|
||||
|
||||
<Meta of={Opportunities} />
|
||||
|
||||
# Opportunities View
|
||||
|
||||
<Canvas of={Opportunities.Default} />
|
||||
@ -1,19 +1,23 @@
|
||||
import { getOperationName } from '@apollo/client/utilities';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { GET_PEOPLE } from '@/people/services';
|
||||
import { RecoilScope } from '@/recoil-scope/components/RecoilScope';
|
||||
import { EntityTableActionBar } from '@/ui/components/table/action-bar/EntityTableActionBar';
|
||||
import { IconBuildingSkyscraper } from '@/ui/icons/index';
|
||||
import { FlexExpandingContainer } from '@/ui/layout/containers/FlexExpandingContainer';
|
||||
import { WithTopBarContainer } from '@/ui/layout/containers/WithTopBarContainer';
|
||||
import { TableContext } from '@/ui/tables/states/TableContext';
|
||||
import { GET_PEOPLE } from '@/people/queries';
|
||||
import { PeopleTable } from '@/people/table/components/PeopleTable';
|
||||
import { TableActionBarButtonCreateCommentThreadPeople } from '@/people/table/components/TableActionBarButtonCreateCommentThreadPeople';
|
||||
import { TableActionBarButtonDeletePeople } from '@/people/table/components/TableActionBarButtonDeletePeople';
|
||||
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 { useInsertPersonMutation } from '~/generated/graphql';
|
||||
|
||||
import { TableActionBarButtonCreateCommentThreadPeople } from './table/TableActionBarButtonCreateCommentThreadPeople';
|
||||
import { TableActionBarButtonDeletePeople } from './table/TableActionBarButtonDeletePeople';
|
||||
import { PeopleTable } from './PeopleTable';
|
||||
const StyledTableContainer = styled.div`
|
||||
display: flex;
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
export function People() {
|
||||
const [insertPersonMutation] = useInsertPersonMutation();
|
||||
@ -42,9 +46,9 @@ export function People() {
|
||||
icon={<IconBuildingSkyscraper size={theme.icon.size.md} />}
|
||||
onAddButtonClick={handleAddButtonClick}
|
||||
>
|
||||
<FlexExpandingContainer>
|
||||
<StyledTableContainer>
|
||||
<PeopleTable />
|
||||
</FlexExpandingContainer>
|
||||
</StyledTableContainer>
|
||||
<EntityTableActionBar>
|
||||
<TableActionBarButtonCreateCommentThreadPeople />
|
||||
<TableActionBarButtonDeletePeople />
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { IconList } from '@tabler/icons-react';
|
||||
|
||||
import { defaultOrderBy } from '@/companies/queries';
|
||||
import { reduceSortsToOrderBy } from '@/lib/filters-and-sorts/helpers';
|
||||
import { filtersScopedState } from '@/lib/filters-and-sorts/states/filtersScopedState';
|
||||
import { turnFilterIntoWhereClause } from '@/lib/filters-and-sorts/utils/turnFilterIntoWhereClause';
|
||||
import { PeopleEntityTableData } from '@/people/components/PeopleEntityTableData';
|
||||
import { PeopleSelectedSortType } from '@/people/services';
|
||||
import { peopleColumns } from '@/people/table/components/peopleColumns';
|
||||
import { useRecoilScopedValue } from '@/recoil-scope/hooks/useRecoilScopedValue';
|
||||
import { EntityTable } from '@/ui/components/table/EntityTable';
|
||||
import { HooksEntityTable } from '@/ui/components/table/HooksEntityTable';
|
||||
import { TableContext } from '@/ui/tables/states/TableContext';
|
||||
import { PersonOrderByWithRelationInput } from '~/generated/graphql';
|
||||
|
||||
import { peopleFilters } from './people-filters';
|
||||
import { availableSorts } from './people-sorts';
|
||||
|
||||
export function PeopleTable() {
|
||||
const [orderBy, setOrderBy] =
|
||||
useState<PersonOrderByWithRelationInput[]>(defaultOrderBy);
|
||||
|
||||
const updateSorts = useCallback((sorts: Array<PeopleSelectedSortType>) => {
|
||||
setOrderBy(sorts.length ? reduceSortsToOrderBy(sorts) : defaultOrderBy);
|
||||
}, []);
|
||||
|
||||
const filters = useRecoilScopedValue(filtersScopedState, TableContext);
|
||||
|
||||
const whereFilters = useMemo(() => {
|
||||
return { AND: filters.map(turnFilterIntoWhereClause) };
|
||||
}, [filters]) as any;
|
||||
|
||||
return (
|
||||
<>
|
||||
<PeopleEntityTableData orderBy={orderBy} whereFilters={whereFilters} />
|
||||
<HooksEntityTable
|
||||
numberOfColumns={peopleColumns.length}
|
||||
availableFilters={peopleFilters}
|
||||
/>
|
||||
<EntityTable
|
||||
columns={peopleColumns}
|
||||
viewName="All People"
|
||||
viewIcon={<IconList size={16} />}
|
||||
availableSorts={availableSorts}
|
||||
onSortsUpdate={updateSorts}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -1,15 +1,15 @@
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useTheme } from '@emotion/react';
|
||||
|
||||
import { Timeline } from '@/comments/components/timeline/Timeline';
|
||||
import { usePersonQuery } from '@/people/services';
|
||||
import { PropertyBox } from '@/ui/components/property-box/PropertyBox';
|
||||
import { PropertyBoxItem } from '@/ui/components/property-box/PropertyBoxItem';
|
||||
import { IconLink, IconUser } from '@/ui/icons/index';
|
||||
import { WithTopBarContainer } from '@/ui/layout/containers/WithTopBarContainer';
|
||||
import { ShowPageLeftContainer } from '@/ui/layout/show-page/containers/ShowPageLeftContainer';
|
||||
import { ShowPageRightContainer } from '@/ui/layout/show-page/containers/ShowPageRightContainer';
|
||||
import { ShowPageSummaryCard } from '@/ui/layout/show-page/ShowPageSummaryCard';
|
||||
import { Timeline } from '@/activities/timeline/components/Timeline';
|
||||
import { usePersonQuery } from '@/people/queries';
|
||||
import { PropertyBox } from '@/ui/editable-field/property-box/components/PropertyBox';
|
||||
import { PropertyBoxItem } from '@/ui/editable-field/property-box/components/PropertyBoxItem';
|
||||
import { IconLink, IconUser } from '@/ui/icon';
|
||||
import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer';
|
||||
import { ShowPageLeftContainer } from '@/ui/layout/show-page/components/ShowPageLeftContainer';
|
||||
import { ShowPageRightContainer } from '@/ui/layout/show-page/components/ShowPageRightContainer';
|
||||
import { ShowPageSummaryCard } from '@/ui/layout/show-page/components/ShowPageSummaryCard';
|
||||
import { CommentableType } from '~/generated/graphql';
|
||||
|
||||
export function PersonShow() {
|
||||
|
||||
@ -4,8 +4,8 @@ import type { Meta } from '@storybook/react';
|
||||
import { userEvent, within } from '@storybook/testing-library';
|
||||
import { graphql } from 'msw';
|
||||
|
||||
import { UPDATE_PERSON } from '@/people/services';
|
||||
import { SEARCH_COMPANY_QUERY } from '@/search/services/search';
|
||||
import { UPDATE_PERSON } from '@/people/queries';
|
||||
import { SEARCH_COMPANY_QUERY } from '@/search/queries/search';
|
||||
import { Company } from '~/generated/graphql';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { fetchOneFromData } from '~/testing/mock-data';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { FilterDropdownCompanySearchSelect } from '@/companies/components/FilterDropdownCompanySearchSelect';
|
||||
import { FilterDefinitionByEntity } from '@/lib/filters-and-sorts/types/FilterDefinitionByEntity';
|
||||
import { FilterDefinitionByEntity } from '@/ui/filter-n-sort/types/FilterDefinitionByEntity';
|
||||
import {
|
||||
IconBuildingSkyscraper,
|
||||
IconCalendarEvent,
|
||||
@ -7,7 +7,7 @@ import {
|
||||
IconMap,
|
||||
IconPhone,
|
||||
IconUser,
|
||||
} from '@/ui/icons/index';
|
||||
} from '@/ui/icon/index';
|
||||
import { icon } from '@/ui/themes/icon';
|
||||
import { Person } from '~/generated/graphql';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { SortType } from '@/lib/filters-and-sorts/interfaces/sorts/interface';
|
||||
import { SortType } from '@/ui/filter-n-sort/types/interface';
|
||||
import {
|
||||
IconBuildingSkyscraper,
|
||||
IconCalendarEvent,
|
||||
@ -6,7 +6,7 @@ import {
|
||||
IconMap,
|
||||
IconPhone,
|
||||
IconUser,
|
||||
} from '@/ui/icons/index';
|
||||
} from '@/ui/icon/index';
|
||||
import {
|
||||
PersonOrderByWithRelationInput as People_Order_By,
|
||||
SortOrder as Order_By,
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
import { useOpenCreateCommentThreadDrawerForSelectedRowIds } from '@/comments/hooks/useOpenCreateCommentDrawerForSelectedRowIds';
|
||||
import { TableActionBarButtonToggleComments } from '@/ui/components/table/action-bar/TableActionBarButtonOpenComments';
|
||||
import { CommentableType } from '~/generated/graphql';
|
||||
|
||||
export function TableActionBarButtonCreateCommentThreadPeople() {
|
||||
const openCreateCommentThreadRightDrawer =
|
||||
useOpenCreateCommentThreadDrawerForSelectedRowIds();
|
||||
|
||||
async function handleButtonClick() {
|
||||
openCreateCommentThreadRightDrawer(CommentableType.Person);
|
||||
}
|
||||
|
||||
return <TableActionBarButtonToggleComments onClick={handleButtonClick} />;
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
import { getOperationName } from '@apollo/client/utilities';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { GET_PEOPLE } from '@/people/services';
|
||||
import { EntityTableActionBarButton } from '@/ui/components/table/action-bar/EntityTableActionBarButton';
|
||||
import { IconTrash } from '@/ui/icons/index';
|
||||
import { useResetTableRowSelection } from '@/ui/tables/hooks/useResetTableRowSelection';
|
||||
import { selectedRowIdsSelector } from '@/ui/tables/states/selectedRowIdsSelector';
|
||||
import { useDeletePeopleMutation } from '~/generated/graphql';
|
||||
|
||||
export function TableActionBarButtonDeletePeople() {
|
||||
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
|
||||
|
||||
const resetRowSelection = useResetTableRowSelection();
|
||||
|
||||
const [deletePeople] = useDeletePeopleMutation({
|
||||
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
|
||||
});
|
||||
|
||||
async function handleDeleteClick() {
|
||||
const rowIdsToDelete = selectedRowIds;
|
||||
|
||||
resetRowSelection();
|
||||
|
||||
await deletePeople({
|
||||
variables: {
|
||||
ids: rowIdsToDelete,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<EntityTableActionBarButton
|
||||
label="Delete"
|
||||
icon={<IconTrash size={16} />}
|
||||
type="warning"
|
||||
onClick={handleDeleteClick}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -3,9 +3,9 @@ import styled from '@emotion/styled';
|
||||
import { EmailField } from '@/settings/profile/components/EmailField';
|
||||
import { NameFields } from '@/settings/profile/components/NameFields';
|
||||
import { ProfilePictureUploader } from '@/settings/profile/components/ProfilePictureUploader';
|
||||
import { MainSectionTitle } from '@/ui/components/section-titles/MainSectionTitle';
|
||||
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
|
||||
import { NoTopBarContainer } from '@/ui/layout/containers/NoTopBarContainer';
|
||||
import { NoTopBarContainer } from '@/ui/layout/components/NoTopBarContainer';
|
||||
import { MainSectionTitle } from '@/ui/title/components/MainSectionTitle';
|
||||
import { SubSectionTitle } from '@/ui/title/components/SubSectionTitle';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
display: flex;
|
||||
|
||||
@ -2,9 +2,9 @@ import styled from '@emotion/styled';
|
||||
|
||||
import { NameField } from '@/settings/workspace/components/NameField';
|
||||
import { WorkspaceLogoUploader } from '@/settings/workspace/components/WorkspaceLogoUploader';
|
||||
import { MainSectionTitle } from '@/ui/components/section-titles/MainSectionTitle';
|
||||
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
|
||||
import { NoTopBarContainer } from '@/ui/layout/containers/NoTopBarContainer';
|
||||
import { NoTopBarContainer } from '@/ui/layout/components/NoTopBarContainer';
|
||||
import { MainSectionTitle } from '@/ui/title/components/MainSectionTitle';
|
||||
import { SubSectionTitle } from '@/ui/title/components/SubSectionTitle';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
display: flex;
|
||||
|
||||
@ -3,11 +3,11 @@ import styled from '@emotion/styled';
|
||||
import { useRecoilState } from 'recoil';
|
||||
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { Button } from '@/ui/components/buttons/Button';
|
||||
import { MainSectionTitle } from '@/ui/components/section-titles/MainSectionTitle';
|
||||
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
|
||||
import { IconTrash } from '@/ui/icons';
|
||||
import { NoTopBarContainer } from '@/ui/layout/containers/NoTopBarContainer';
|
||||
import { Button } from '@/ui/button/components/Button';
|
||||
import { IconTrash } from '@/ui/icon';
|
||||
import { NoTopBarContainer } from '@/ui/layout/components/NoTopBarContainer';
|
||||
import { MainSectionTitle } from '@/ui/title/components/MainSectionTitle';
|
||||
import { SubSectionTitle } from '@/ui/title/components/SubSectionTitle';
|
||||
import { WorkspaceInviteLink } from '@/workspace/components/WorkspaceInviteLink';
|
||||
import { WorkspaceMemberCard } from '@/workspace/components/WorkspaceMemberCard';
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user