remove fake names from profile
This commit is contained in:
@@ -6,6 +6,7 @@ import { Tooltiper } from '@/components/ui/tooltip';
|
||||
import { useAppParams } from '@/hooks/useAppParams';
|
||||
import { useNumber } from '@/hooks/useNumerFormatter';
|
||||
import { cn } from '@/utils/cn';
|
||||
import { getProfileName } from '@/utils/getters';
|
||||
import Link from 'next/link';
|
||||
|
||||
import type {
|
||||
@@ -96,10 +97,7 @@ export function EventListItem(props: EventListItemProps) {
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-4">
|
||||
<Tooltiper
|
||||
asChild
|
||||
content={`${profile?.firstName} ${profile?.lastName}`}
|
||||
>
|
||||
<Tooltiper asChild content={getProfileName(profile)}>
|
||||
<Link
|
||||
prefetch={false}
|
||||
onClick={(e) => {
|
||||
@@ -108,7 +106,7 @@ export function EventListItem(props: EventListItemProps) {
|
||||
href={`/${organizationSlug}/${projectId}/profiles/${profile?.id}`}
|
||||
className="max-w-[80px] overflow-hidden text-ellipsis whitespace-nowrap text-sm text-muted-foreground hover:underline"
|
||||
>
|
||||
{profile?.firstName} {profile?.lastName}
|
||||
{getProfileName(profile)}
|
||||
</Link>
|
||||
</Tooltiper>
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ export default async function Page({
|
||||
const startDate = parseAsString.parseServerSide(searchParams.startDate);
|
||||
const endDate = parseAsString.parseServerSide(searchParams.endDate);
|
||||
const [profile, events, count, conversions] = await Promise.all([
|
||||
getProfileById(profileId),
|
||||
getProfileById(profileId, projectId),
|
||||
getEventList(eventListOptions),
|
||||
getEventsCount(eventListOptions),
|
||||
getConversionEventNames(projectId),
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
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(' ');
|
||||
if (!profile) return 'Unknown';
|
||||
|
||||
if (!profile.isExternal) {
|
||||
return profile.id;
|
||||
}
|
||||
|
||||
return (
|
||||
[profile.firstName, profile.lastName].filter(Boolean).join(' ') ||
|
||||
profile.email ||
|
||||
profile.id
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user