Revert "Refacto/remaining inplace input cells" (#534)

Revert "Refacto/remaining inplace input cells (#531)"

This reverts commit 6446692f25.
This commit is contained in:
Charles Bochet
2023-07-07 18:10:32 -07:00
committed by GitHub
parent a975935f49
commit 94ca61c887
16 changed files with 88 additions and 168 deletions

View File

@ -3,8 +3,10 @@ import styled from '@emotion/styled';
import { IconCurrencyDollar } from '@tabler/icons-react';
import { RecoilScope } from '@/recoil-scope/components/RecoilScope';
import { InplaceDateInput } from '@/ui/components/inplace-input/types/InplaceDateInput';
import { EditableDate } from '@/ui/components/editable-cell/types/EditableDate';
import { InplaceTextInput } from '@/ui/components/inplace-input/types/InplaceTextInput';
import { CellContext } from '@/ui/tables/states/CellContext';
import { RowContext } from '@/ui/tables/states/RowContext';
import { Company, PipelineProgress } from '../../../generated/graphql';
import { Checkbox } from '../../ui/components/form/Checkbox';
@ -70,6 +72,17 @@ type PipelineProgressProp = Pick<
'id' | 'amount' | 'closeDate'
>;
// TODO: Remove when refactoring EditableCell into EditableField
function HackScope({ children }: { children: React.ReactNode }) {
return (
<RecoilScope>
<RecoilScope SpecificContext={RowContext}>
<RecoilScope SpecificContext={CellContext}>{children}</RecoilScope>
</RecoilScope>
</RecoilScope>
);
}
export function CompanyBoardCard({
company,
pipelineProgress,
@ -99,7 +112,7 @@ export function CompanyBoardCard({
<StyledBoardCardBody>
<span>
<IconCurrencyDollar size={theme.icon.size.md} />
<RecoilScope>
<HackScope>
<InplaceTextInput
content={pipelineProgress.amount?.toString() || ''}
placeholder="Opportunity amount"
@ -110,12 +123,12 @@ export function CompanyBoardCard({
})
}
/>
</RecoilScope>
</HackScope>
</span>
<span>
<IconCalendarEvent size={theme.icon.size.md} />
<RecoilScope>
<InplaceDateInput
<HackScope>
<EditableDate
value={new Date(pipelineProgress.closeDate || Date.now())}
changeHandler={(value) => {
onCardUpdate({
@ -124,7 +137,7 @@ export function CompanyBoardCard({
});
}}
/>
</RecoilScope>
</HackScope>
</span>
</StyledBoardCardBody>
</StyledBoardCard>