Skip to content

Commit

Permalink
Merge branch 'main' into task/fix-view-switcher-def-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasbordeau committed Oct 10, 2024
2 parents a3fba06 + e45e45d commit 2c168ad
Show file tree
Hide file tree
Showing 162 changed files with 2,909 additions and 1,509 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Your turn 👇

////////////////////////////

» 02-October-2024 by [yourhandle](https://oss.gg/yourhandle) Logo Link: [logo](https://twenty.com/) tweet Link: [tweet](https://x.com)
» 08-October-2024 by [adityadeshlahre](https://oss.gg/adityadeshlahre) Logo Link: [logo](https://drive.google.com/drive/folders/13k22xMnX2fhnWK94vas_hO1t-ImqXcHZ?usp=drive_link) » tweet Link: [tweet](https://x.com/adityadeshlahre/status/1843354963176718374)

---
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
"@nestjs/serve-static": "^4.0.1",
"@nestjs/terminus": "^9.2.2",
"@nestjs/typeorm": "^10.0.0",
"@nivo/calendar": "^0.84.0",
"@nivo/core": "^0.84.0",
"@nx/eslint-plugin": "^17.2.8",
"@octokit/graphql": "^7.0.2",
"@ptc-org/nestjs-query-core": "^4.2.0",
Expand Down
29 changes: 0 additions & 29 deletions packages/twenty-emails/src/emails/workflow-action.email.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/twenty-emails/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ export * from './emails/delete-inactive-workspaces.email';
export * from './emails/password-reset-link.email';
export * from './emails/password-update-notify.email';
export * from './emails/send-invite-link.email';
export * from './emails/workflow-action.email';
3 changes: 3 additions & 0 deletions packages/twenty-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"workerDirectory": "public"
},
"dependencies": {
"@nivo/calendar": "^0.87.0",
"@nivo/core": "^0.87.0",
"@nivo/line": "^0.87.0",
"@xyflow/react": "^12.0.4",
"transliteration": "^2.3.5"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-front/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"test": {},
"storybook:build": {
"options": {
"env": { "NODE_OPTIONS": "--max_old_space_size=6000" }
"env": { "NODE_OPTIONS": "--max_old_space_size=6500" }
}
},
"storybook:serve:dev": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const GMAIL_SEND_SCOPE = 'https://www.googleapis.com/auth/gmail.send';
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export type ConnectedAccount = {
authFailedAt: Date | null;
messageChannels: MessageChannel[];
calendarChannels: CalendarChannel[];
scopes: string[] | null;
__typename: 'ConnectedAccount';
};
28 changes: 14 additions & 14 deletions packages/twenty-front/src/modules/app/components/SettingsRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { lazy, Suspense } from 'react';
import { Route, Routes } from 'react-router-dom';

import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';
import { AppPath } from '@/types/AppPath';
import { SettingsPath } from '@/types/SettingsPath';

Expand Down Expand Up @@ -64,7 +65,7 @@ const SettingsDevelopersApiKeysNew = lazy(() =>

const SettingsDevelopersWebhooksNew = lazy(() =>
import(
'~/pages/settings/developers/webhooks/SettingsDevelopersWebhooksNew'
'~/pages/settings/developers/webhooks/components/SettingsDevelopersWebhooksNew'
).then((module) => ({
default: module.SettingsDevelopersWebhooksNew,
})),
Expand Down Expand Up @@ -164,7 +165,7 @@ const SettingsObjects = lazy(() =>

const SettingsDevelopersWebhooksDetail = lazy(() =>
import(
'~/pages/settings/developers/webhooks/SettingsDevelopersWebhookDetail'
'~/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail'
).then((module) => ({
default: module.SettingsDevelopersWebhooksDetail,
})),
Expand Down Expand Up @@ -202,22 +203,21 @@ const SettingsIntegrationShowDatabaseConnection = lazy(() =>
})),
);

const SettingsObjectNewFieldStep1 = lazy(() =>
const SettingsObjectNewFieldSelect = lazy(() =>
import(
'~/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldStep1'
'~/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldSelect'
).then((module) => ({
default: module.SettingsObjectNewFieldStep1,
default: module.SettingsObjectNewFieldSelect,
})),
);

const SettingsObjectNewFieldStep2 = lazy(() =>
const SettingsObjectNewFieldConfigure = lazy(() =>
import(
'~/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldStep2'
'~/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldConfigure'
).then((module) => ({
default: module.SettingsObjectNewFieldStep2,
default: module.SettingsObjectNewFieldConfigure,
})),
);

const SettingsObjectFieldEdit = lazy(() =>
import('~/pages/settings/data-model/SettingsObjectFieldEdit').then(
(module) => ({
Expand Down Expand Up @@ -245,7 +245,7 @@ export const SettingsRoutes = ({
isCRMMigrationEnabled,
isServerlessFunctionSettingsEnabled,
}: SettingsRoutesProps) => (
<Suspense fallback={null}>
<Suspense fallback={<SettingsSkeletonLoader />}>
<Routes>
<Route path={SettingsPath.ProfilePage} element={<SettingsProfile />} />
<Route path={SettingsPath.Appearance} element={<SettingsAppearance />} />
Expand Down Expand Up @@ -345,12 +345,12 @@ export const SettingsRoutes = ({
element={<SettingsIntegrationShowDatabaseConnection />}
/>
<Route
path={SettingsPath.ObjectNewFieldStep1}
element={<SettingsObjectNewFieldStep1 />}
path={SettingsPath.ObjectNewFieldSelect}
element={<SettingsObjectNewFieldSelect />}
/>
<Route
path={SettingsPath.ObjectNewFieldStep2}
element={<SettingsObjectNewFieldStep2 />}
path={SettingsPath.ObjectNewFieldConfigure}
element={<SettingsObjectNewFieldConfigure />}
/>
<Route
path={SettingsPath.ObjectFieldEdit}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createState } from 'twenty-ui';

export const contextStoreCurrentObjectMetadataIdState = createState<
string | null
>({
key: 'contextStoreCurrentObjectMetadataIdState',
defaultValue: null,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createState } from 'twenty-ui';

export const contextStoreCurrentViewIdState = createState<string | null>({
key: 'contextStoreCurrentViewIdState',
defaultValue: null,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createState } from 'twenty-ui';

export const contextStoreTargetedRecordIdsState = createState<string[]>({
key: 'contextStoreTargetedRecordIdsState',
defaultValue: [],
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export const detectTimeFormat = () => {
const isHour12 = Intl.DateTimeFormat(navigator.language, {
hour: 'numeric',
}).resolvedOptions().hour12;
if (isDefined(isHour12) && isHour12) return TimeFormat.HOUR_12;

if (isDefined(isHour12) && isHour12) {
return TimeFormat.HOUR_12;
}

return TimeFormat.HOUR_24;
};

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { useApolloClient } from '@apollo/client';
import { v4 } from 'uuid';

import { triggerCreateRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerCreateRecordsOptimisticEffect';
import { triggerDeleteRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerDeleteRecordsOptimisticEffect';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';
import { useCreateOneRecordInCache } from '@/object-record/cache/hooks/useCreateOneRecordInCache';
import { deleteRecordFromCache } from '@/object-record/cache/utils/deleteRecordFromCache';
import { getObjectTypename } from '@/object-record/cache/utils/getObjectTypename';
import { RecordGqlOperationGqlRecordFields } from '@/object-record/graphql/types/RecordGqlOperationGqlRecordFields';
import { generateDepthOneRecordGqlFields } from '@/object-record/graphql/utils/generateDepthOneRecordGqlFields';
Expand Down Expand Up @@ -67,7 +69,7 @@ export const useCreateManyRecords = <
},
);

const recordsCreatedInCache = [];
const recordsCreatedInCache: ObjectRecord[] = [];

for (const recordToCreate of sanitizedCreateManyRecordsInput) {
if (recordToCreate.id === null) {
Expand Down Expand Up @@ -98,26 +100,46 @@ export const useCreateManyRecords = <
objectMetadataItem.namePlural,
);

const createdObjects = await apolloClient.mutate({
mutation: createManyRecordsMutation,
variables: {
data: sanitizedCreateManyRecordsInput,
upsert: upsert,
},
update: (cache, { data }) => {
const records = data?.[mutationResponseField];
const createdObjects = await apolloClient
.mutate({
mutation: createManyRecordsMutation,
variables: {
data: sanitizedCreateManyRecordsInput,
upsert: upsert,
},
update: (cache, { data }) => {
const records = data?.[mutationResponseField];

if (!records?.length || skipPostOptmisticEffect) return;

if (!records?.length || skipPostOptmisticEffect) return;
triggerCreateRecordsOptimisticEffect({
cache,
objectMetadataItem,
recordsToCreate: records,
objectMetadataItems,
shouldMatchRootQueryFilter,
});
},
})
.catch((error: Error) => {
recordsCreatedInCache.forEach((recordToDelete) => {
deleteRecordFromCache({
objectMetadataItems,
objectMetadataItem,
cache: apolloClient.cache,
recordToDelete,
});
});

triggerCreateRecordsOptimisticEffect({
cache,
triggerDeleteRecordsOptimisticEffect({
cache: apolloClient.cache,
objectMetadataItem,
recordsToCreate: records,
recordsToDelete: recordsCreatedInCache,
objectMetadataItems,
shouldMatchRootQueryFilter,
});
},
});

throw error;
});

return createdObjects.data?.[mutationResponseField] ?? [];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { useState } from 'react';
import { v4 } from 'uuid';

import { triggerCreateRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerCreateRecordsOptimisticEffect';
import { triggerDeleteRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerDeleteRecordsOptimisticEffect';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';
import { useCreateOneRecordInCache } from '@/object-record/cache/hooks/useCreateOneRecordInCache';
import { deleteRecordFromCache } from '@/object-record/cache/utils/deleteRecordFromCache';
import { getObjectTypename } from '@/object-record/cache/utils/getObjectTypename';
import { RecordGqlOperationGqlRecordFields } from '@/object-record/graphql/types/RecordGqlOperationGqlRecordFields';
import { generateDepthOneRecordGqlFields } from '@/object-record/graphql/utils/generateDepthOneRecordGqlFields';
Expand Down Expand Up @@ -85,27 +87,49 @@ export const useCreateOneRecord = <
const mutationResponseField =
getCreateOneRecordMutationResponseField(objectNameSingular);

const createdObject = await apolloClient.mutate({
mutation: createOneRecordMutation,
variables: {
input: sanitizedInput,
},
update: (cache, { data }) => {
const record = data?.[mutationResponseField];

if (!record || skipPostOptmisticEffect) return;
const createdObject = await apolloClient
.mutate({
mutation: createOneRecordMutation,
variables: {
input: sanitizedInput,
},
update: (cache, { data }) => {
const record = data?.[mutationResponseField];

if (!record || skipPostOptmisticEffect) return;

triggerCreateRecordsOptimisticEffect({
cache,
objectMetadataItem,
recordsToCreate: [record],
objectMetadataItems,
shouldMatchRootQueryFilter,
});

setLoading(false);
},
})
.catch((error: Error) => {
if (!recordCreatedInCache) {
throw error;
}

deleteRecordFromCache({
objectMetadataItems,
objectMetadataItem,
cache: apolloClient.cache,
recordToDelete: recordCreatedInCache,
});

triggerCreateRecordsOptimisticEffect({
cache,
triggerDeleteRecordsOptimisticEffect({
cache: apolloClient.cache,
objectMetadataItem,
recordsToCreate: [record],
recordsToDelete: [recordCreatedInCache],
objectMetadataItems,
shouldMatchRootQueryFilter,
});

setLoading(false);
},
});
throw error;
});

return createdObject.data?.[mutationResponseField] ?? null;
};
Expand Down
Loading

0 comments on commit 2c168ad

Please sign in to comment.