@ -11,8 +11,8 @@ export const prefetchViewsFromObjectMetadataItemFamilySelector = selectorFamily<
|
|||||||
({ objectMetadataItemId }) =>
|
({ objectMetadataItemId }) =>
|
||||||
({ get }) => {
|
({ get }) => {
|
||||||
const views = get(prefetchViewsState);
|
const views = get(prefetchViewsState);
|
||||||
return views.filter(
|
return views
|
||||||
(view) => view.objectMetadataId === objectMetadataItemId,
|
.filter((view) => view.objectMetadataId === objectMetadataItemId)
|
||||||
);
|
.sort((a, b) => a.position - b.position);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -20,9 +20,9 @@ import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/sta
|
|||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared/utils';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
import { moveArrayItem } from '~/utils/array/moveArrayItem';
|
|
||||||
import { IconPlus } from 'twenty-ui/display';
|
import { IconPlus } from 'twenty-ui/display';
|
||||||
import { MenuItem } from 'twenty-ui/navigation';
|
import { MenuItem } from 'twenty-ui/navigation';
|
||||||
|
import { moveArrayItem } from '~/utils/array/moveArrayItem';
|
||||||
|
|
||||||
const StyledBoldDropdownMenuItemsContainer = styled(DropdownMenuItemsContainer)`
|
const StyledBoldDropdownMenuItemsContainer = styled(DropdownMenuItemsContainer)`
|
||||||
font-weight: ${({ theme }) => theme.font.weight.regular};
|
font-weight: ${({ theme }) => theme.font.weight.regular};
|
||||||
@ -74,17 +74,21 @@ export const ViewPickerListContent = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDragEnd = useCallback(
|
const handleDragEnd = useCallback(
|
||||||
(result: DropResult) => {
|
async (result: DropResult) => {
|
||||||
if (!result.destination) return;
|
if (!result.destination) return;
|
||||||
|
|
||||||
moveArrayItem(viewsOnCurrentObject, {
|
const viewsReordered = moveArrayItem(viewsOnCurrentObject, {
|
||||||
fromIndex: result.source.index,
|
fromIndex: result.source.index,
|
||||||
toIndex: result.destination.index,
|
toIndex: result.destination.index,
|
||||||
}).forEach((view, index) => {
|
|
||||||
if (view.position !== index) {
|
|
||||||
updateView({ ...view, position: index });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Promise.all(
|
||||||
|
viewsReordered.map(async (view, index) => {
|
||||||
|
if (view.position !== index) {
|
||||||
|
await updateView({ ...view, position: index });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
[updateView, viewsOnCurrentObject],
|
[updateView, viewsOnCurrentObject],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -181,6 +181,9 @@ export const ChooseYourPlan = () => {
|
|||||||
? BillingPlanKey.ENTERPRISE
|
? BillingPlanKey.ENTERPRISE
|
||||||
: BillingPlanKey.PRO;
|
: BillingPlanKey.PRO;
|
||||||
|
|
||||||
|
const planName = plans?.plans.find((plan) => plan.planKey === currentPlan)
|
||||||
|
?.baseProduct.name;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isDefined(baseProductPrice) && isDefined(billing) ? (
|
{isDefined(baseProductPrice) && isDefined(billing) ? (
|
||||||
@ -191,9 +194,7 @@ export const ChooseYourPlan = () => {
|
|||||||
: t`Get your subscription`}
|
: t`Get your subscription`}
|
||||||
</Title>
|
</Title>
|
||||||
{hasWithoutCreditCardTrialPeriod ? (
|
{hasWithoutCreditCardTrialPeriod ? (
|
||||||
<SubTitle>
|
<SubTitle>{planName}</SubTitle>
|
||||||
<Trans>Cancel anytime</Trans>
|
|
||||||
</SubTitle>
|
|
||||||
) : (
|
) : (
|
||||||
withCreditCardTrialPeriod && (
|
withCreditCardTrialPeriod && (
|
||||||
<SubTitle>
|
<SubTitle>
|
||||||
|
|||||||
Reference in New Issue
Block a user