-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(lastViewAt): add recently view on company #15072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
02586f5
feat(redis): introduce redis-backed `lastViewedAt` field and metadata…
AMoreaux a8092d0
feat(audit): add `Object Record Viewed` event tracking and optimize `…
AMoreaux 525d014
Merge remote-tracking branch 'origin/main' into feat/add-recently-view
AMoreaux 1951e60
chore(graphql): fix formatting inconsistencies and cleanup unused tes…
AMoreaux 5961867
feat(orm): add `storage
AMoreaux 50c20f4
Merge remote-tracking branch 'origin/main' into feat/add-recently-view
AMoreaux a57c4f0
refactor(frontend/server): remove `RecordShowContent` component and e…
AMoreaux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
packages/twenty-front/src/pages/object-record/RecordShowContent.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import { RecordShowActionMenu } from '@/action-menu/components/RecordShowActionMenu'; | ||
| import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; | ||
| import { TimelineActivityContext } from '@/activities/timeline-activities/contexts/TimelineActivityContext'; | ||
| import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; | ||
| import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; | ||
| import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; | ||
| import { RecordShowContainer } from '@/object-record/record-show/components/RecordShowContainer'; | ||
| import { RecordShowEffect } from '@/object-record/record-show/components/RecordShowEffect'; | ||
| import { computeRecordShowComponentInstanceId } from '@/object-record/record-show/utils/computeRecordShowComponentInstanceId'; | ||
| import { PageHeaderToggleCommandMenuButton } from '@/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton'; | ||
| import { PageBody } from '@/ui/layout/page/components/PageBody'; | ||
| import { PageContainer } from '@/ui/layout/page/components/PageContainer'; | ||
| import { RecordShowPageHeader } from '~/pages/object-record/RecordShowPageHeader'; | ||
| import { RecordShowPageTitle } from '~/pages/object-record/RecordShowPageTitle'; | ||
|
|
||
| export const RecordShowContent = ({ | ||
| objectNameSingular, | ||
| objectRecordId, | ||
| }: { | ||
| objectNameSingular: string; | ||
| objectRecordId: string; | ||
| }) => { | ||
| const recordShowComponentInstanceId = | ||
| computeRecordShowComponentInstanceId(objectRecordId); | ||
|
|
||
| return ( | ||
| <RecordComponentInstanceContextsWrapper | ||
| componentInstanceId={recordShowComponentInstanceId} | ||
| > | ||
| <ContextStoreComponentInstanceContext.Provider | ||
| value={{ instanceId: MAIN_CONTEXT_STORE_INSTANCE_ID }} | ||
| > | ||
| <ActionMenuComponentInstanceContext.Provider | ||
| value={{ instanceId: recordShowComponentInstanceId }} | ||
| > | ||
| <PageContainer> | ||
| <RecordShowPageTitle | ||
| objectNameSingular={objectNameSingular} | ||
| objectRecordId={objectRecordId} | ||
| /> | ||
| <RecordShowPageHeader | ||
| objectNameSingular={objectNameSingular} | ||
| objectRecordId={objectRecordId} | ||
| > | ||
| <RecordShowActionMenu /> | ||
| <PageHeaderToggleCommandMenuButton /> | ||
| </RecordShowPageHeader> | ||
| <PageBody> | ||
| <TimelineActivityContext.Provider | ||
| value={{ | ||
| recordId: objectRecordId, | ||
| }} | ||
| > | ||
| <RecordShowEffect | ||
| objectNameSingular={objectNameSingular} | ||
| recordId={objectRecordId} | ||
| /> | ||
| <RecordShowContainer | ||
| objectNameSingular={objectNameSingular} | ||
| objectRecordId={objectRecordId} | ||
| loading={false} | ||
| /> | ||
| </TimelineActivityContext.Provider> | ||
| </PageBody> | ||
| </PageContainer> | ||
| </ActionMenuComponentInstanceContext.Provider> | ||
| </ContextStoreComponentInstanceContext.Provider> | ||
| </RecordComponentInstanceContextsWrapper> | ||
| ); | ||
| }; |
74 changes: 9 additions & 65 deletions
74
packages/twenty-front/src/pages/object-record/RecordShowPage.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,77 +1,21 @@ | ||
| import { useParams } from 'react-router-dom'; | ||
|
|
||
| import { RecordShowActionMenu } from '@/action-menu/components/RecordShowActionMenu'; | ||
| import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; | ||
| import { TimelineActivityContext } from '@/activities/timeline-activities/contexts/TimelineActivityContext'; | ||
| import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; | ||
| import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; | ||
| import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; | ||
| import { RecordShowContainer } from '@/object-record/record-show/components/RecordShowContainer'; | ||
| import { RecordShowEffect } from '@/object-record/record-show/components/RecordShowEffect'; | ||
| import { computeRecordShowComponentInstanceId } from '@/object-record/record-show/utils/computeRecordShowComponentInstanceId'; | ||
| import { PageHeaderToggleCommandMenuButton } from '@/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton'; | ||
| import { PageBody } from '@/ui/layout/page/components/PageBody'; | ||
| import { PageContainer } from '@/ui/layout/page/components/PageContainer'; | ||
| import { RecordShowPageHeader } from '~/pages/object-record/RecordShowPageHeader'; | ||
| import { RecordShowPageTitle } from '~/pages/object-record/RecordShowPageTitle'; | ||
| import { useRecordShowPage } from '@/object-record/record-show/hooks/useRecordShowPage'; | ||
| import { RecordShowContent } from '~/pages/object-record/RecordShowContent'; | ||
|
|
||
| export const RecordShowPage = () => { | ||
| const parameters = useParams<{ | ||
| objectNameSingular: string; | ||
| objectRecordId: string; | ||
| }>(); | ||
|
|
||
| const { objectNameSingular, objectRecordId } = useRecordShowPage( | ||
| parameters.objectNameSingular ?? '', | ||
| parameters.objectRecordId ?? '', | ||
| ); | ||
|
|
||
| const recordShowComponentInstanceId = | ||
| computeRecordShowComponentInstanceId(objectRecordId); | ||
|
|
||
| return ( | ||
| <RecordComponentInstanceContextsWrapper | ||
| componentInstanceId={recordShowComponentInstanceId} | ||
| > | ||
| <ContextStoreComponentInstanceContext.Provider | ||
| value={{ instanceId: MAIN_CONTEXT_STORE_INSTANCE_ID }} | ||
| > | ||
| <ActionMenuComponentInstanceContext.Provider | ||
| value={{ instanceId: recordShowComponentInstanceId }} | ||
| > | ||
| <PageContainer> | ||
| <RecordShowPageTitle | ||
| objectNameSingular={objectNameSingular} | ||
| objectRecordId={objectRecordId} | ||
| /> | ||
| <RecordShowPageHeader | ||
| objectNameSingular={objectNameSingular} | ||
| objectRecordId={objectRecordId} | ||
| > | ||
| <RecordShowActionMenu /> | ||
| <PageHeaderToggleCommandMenuButton /> | ||
| </RecordShowPageHeader> | ||
| <PageBody> | ||
| <TimelineActivityContext.Provider | ||
| value={{ | ||
| recordId: objectRecordId, | ||
| }} | ||
| > | ||
| <RecordShowEffect | ||
| objectNameSingular={objectNameSingular} | ||
| recordId={objectRecordId} | ||
| /> | ||
| <RecordShowContainer | ||
| objectNameSingular={objectNameSingular} | ||
| objectRecordId={objectRecordId} | ||
| loading={false} | ||
| /> | ||
| </TimelineActivityContext.Provider> | ||
| </PageBody> | ||
| </PageContainer> | ||
| </ActionMenuComponentInstanceContext.Provider> | ||
| </ContextStoreComponentInstanceContext.Provider> | ||
| </RecordComponentInstanceContextsWrapper> | ||
| <> | ||
| {parameters.objectRecordId && parameters.objectNameSingular && ( | ||
| <RecordShowContent | ||
| objectRecordId={parameters.objectRecordId} | ||
| objectNameSingular={parameters.objectNameSingular} | ||
| /> | ||
| )} | ||
| </> | ||
| ); | ||
| }; |
19 changes: 19 additions & 0 deletions
19
...database/typeorm/core/migrations/common/1760458320000-add-fieldmetadata-storage-column.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { type MigrationInterface, type QueryRunner } from 'typeorm'; | ||
|
|
||
| export class AddFieldMetadataStorageColumn1760458320000 | ||
| implements MigrationInterface | ||
| { | ||
| name = 'AddFieldMetadataStorageColumn1760458320000'; | ||
|
|
||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| `ALTER TABLE "core"."fieldMetadata" ADD COLUMN "storage" character varying`, | ||
| ); | ||
| } | ||
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| `ALTER TABLE "core"."fieldMetadata" DROP COLUMN "storage"`, | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already track pageviews, can't we infer it from that or do something smarter rather than send 2 extremely similar track events?
We could either stop tracking unstructured pageviews and only store events like that ; or we could eventually let the endpoint support an array and send 2 events at once...? I think I prefer solution 1