Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

dashboard: fix server imports in client

Carl-Gerhard Lindesvärd2469c6e1b861
diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/[profileId]/page.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/[profileId]/page.tsx
index 88357c9cf..fe8b6f3d4 100644
--- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/[profileId]/page.tsx
+++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/[profileId]/page.tsx
@@ -10,6 +10,7 @@ import {
eventQueryNamesFilter,
} from '@/hooks/useEventQueryFilters';
import { getExists } from '@/server/pageExists';
+import { getProfileName } from '@/utils/getters';
import { notFound } from 'next/navigation';
import { parseAsInteger, parseAsString } from 'nuqs';
@@ -19,7 +20,6 @@ import {
getEventList,
getEventsCount,
getProfileById,
- getProfileName,
} from '@openpanel/db';
import type { IChartEvent, IChartInput } from '@openpanel/validation';
diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/profile-list/profile-list.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/profile-list/profile-list.tsx
index 53004398a..e290487f7 100644
--- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/profile-list/profile-list.tsx
+++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/profile-list/profile-list.tsx
@@ -10,10 +10,10 @@ import { Widget, WidgetHead } from '@/components/widget';
import { WidgetTable } from '@/components/widget-table';
import { useAppParams } from '@/hooks/useAppParams';
import { useCursor } from '@/hooks/useCursor';
+import { getProfileName } from '@/utils/getters';
import { UsersIcon } from 'lucide-react';
import Link from 'next/link';
-import { getProfileName } from '@openpanel/db';
import type { IServiceProfile } from '@openpanel/db';
interface ProfileListProps {
diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/profile-top/index.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/profile-top/index.tsx
index b448ee00a..7db8f422c 100644
--- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/profile-top/index.tsx
+++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/profile-top/index.tsx
@@ -2,9 +2,10 @@ import { ListPropertiesIcon } from '@/components/events/list-properties-icon';
import { ProfileAvatar } from '@/components/profiles/profile-avatar';
import { Widget, WidgetHead } from '@/components/widget';
import { WidgetTable } from '@/components/widget-table';
+import { getProfileName } from '@/utils/getters';
import Link from 'next/link';
-import { chQuery, getProfileName, getProfiles } from '@openpanel/db';
+import { chQuery, getProfiles } from '@openpanel/db';
interface Props {
projectId: string;
diff --git a/apps/dashboard/src/utils/getters.ts b/apps/dashboard/src/utils/getters.ts
new file mode 100644
index 000000000..1b5eae291
--- /dev/null
+++ b/apps/dashboard/src/utils/getters.ts
@@ -0,0 +1,6 @@
+import type { IServiceProfile } from '@openpanel/db';
+
+export function getProfileName(profile: IServiceProfile | undefined | null) {
+ if (!profile) return 'No name';
+ return [profile.firstName, profile.lastName].filter(Boolean).join(' ');
+}
diff --git a/packages/db/src/services/profile.service.ts b/packages/db/src/services/profile.service.ts
index 5a1451cf3..76411dc46 100644
--- a/packages/db/src/services/profile.service.ts
+++ b/packages/db/src/services/profile.service.ts
@@ -218,8 +218,3 @@ export async function upsertProfile({
],
});
}
-
-export function getProfileName(profile: IServiceProfile | undefined | null) {
- if (!profile) return 'No name';
- return [profile.firstName, profile.lastName].filter(Boolean).join(' ');
-}