File tree Expand file tree Collapse file tree 3 files changed +122
-113
lines changed
apps/dashboard/app/(main)/websites/[id]/users Expand file tree Collapse file tree 3 files changed +122
-113
lines changed Original file line number Diff line number Diff line change 1- // Generate cute consistent profile names based on visitor ID
2- const prefixes = [
3- 'Captain' ,
4- 'Admiral' ,
5- 'Professor' ,
6- 'Doctor' ,
7- 'Lady' ,
8- 'Lord' ,
9- 'Sir' ,
10- 'Master' ,
11- 'Chief' ,
12- 'Commander' ,
13- 'Baron' ,
14- 'Duke' ,
15- 'Duchess' ,
16- 'Earl' ,
17- 'Marquis' ,
18- 'Princess' ,
19- 'Prince' ,
20- 'King' ,
21- 'Queen' ,
22- 'Emperor' ,
23- 'Empress' ,
24- 'Wizard' ,
1+ // Generate realistic but unique profile names based on visitor ID
2+ const firstNames = [
3+ 'Alex' ,
4+ 'Jordan' ,
5+ 'Sam' ,
6+ 'Morgan' ,
7+ 'Casey' ,
8+ 'Riley' ,
9+ 'Quinn' ,
10+ 'Dakota' ,
11+ 'Skyler' ,
12+ 'Phoenix' ,
13+ 'River' ,
2514 'Sage' ,
26- 'Mystic' ,
27- 'Shaman' ,
28- 'Guardian' ,
29- 'Champion' ,
30- 'Hero' ,
31- 'Explorer' ,
32- 'Warrior' ,
33- ] ;
34-
35- const adjectives = [
36- 'Brave' ,
37- 'Clever' ,
38- 'Daring' ,
39- 'Elegant' ,
40- 'Gentle' ,
41- 'Honorable' ,
42- 'Jolly' ,
43- 'Kind' ,
44- 'Lucky' ,
45- 'Magnificent' ,
46- 'Noble' ,
47- 'Optimistic' ,
48- 'Peaceful' ,
49- 'Quick' ,
50- 'Radiant' ,
51- 'Swift' ,
52- 'Tenacious' ,
53- 'Valiant' ,
54- 'Wise' ,
55- 'Zealous' ,
56- 'Brilliant' ,
57- 'Cunning' ,
58- 'Dazzling' ,
59- 'Epic' ,
60- 'Fierce' ,
61- 'Gallant' ,
62- 'Humble' ,
63- 'Inspired' ,
64- 'Jubilant' ,
65- 'Mighty' ,
15+ 'Blake' ,
16+ 'Rowan' ,
17+ 'Avery' ,
18+ 'Finley' ,
19+ 'Emery' ,
20+ 'Payton' ,
21+ 'Drew' ,
22+ 'Taylor' ,
23+ 'Logan' ,
24+ 'Jamie' ,
25+ 'Kai' ,
26+ 'Reese' ,
27+ 'Cameron' ,
28+ 'Devon' ,
29+ 'Ellis' ,
30+ 'Gray' ,
31+ 'Hayden' ,
32+ 'Kelly' ,
33+ 'Lee' ,
34+ 'Mason' ,
35+ 'Noah' ,
36+ 'Perry' ,
37+ 'Remy' ,
38+ 'Shane' ,
39+ 'Tate' ,
40+ 'West' ,
41+ 'Zane' ,
42+ 'Brook' ,
43+ 'Clarke' ,
44+ 'Dale' ,
45+ 'Echo' ,
46+ 'Flint' ,
47+ 'Glen' ,
48+ 'Haven' ,
49+ 'Ivy' ,
50+ 'Jade' ,
51+ 'Knox' ,
52+ 'Lane' ,
6653] ;
6754
68- const nouns = [
69- 'Adventurer' ,
70- 'Bard' ,
71- 'Crusader' ,
72- 'Dragon' ,
73- 'Enchanter' ,
74- 'Falcon' ,
75- 'Gryphon' ,
76- 'Hawk' ,
77- 'Illusionist' ,
78- 'Jester' ,
79- 'Knight' ,
80- 'Lion' ,
81- 'Magician' ,
82- 'Ninja' ,
83- 'Oracle' ,
84- 'Phoenix' ,
85- 'Questmaster' ,
86- 'Ranger' ,
87- 'Sage' ,
88- 'Tiger' ,
89- 'Unicorn' ,
90- 'Vanguard' ,
91- 'Wolf' ,
92- 'Xenomorph' ,
93- 'Yogi' ,
94- 'Zealot' ,
95- 'Architect' ,
96- 'Champion' ,
97- 'Deadeye' ,
98- 'Elder' ,
55+ const descriptors = [
56+ 'Digital Nomad' ,
57+ 'Night Owl' ,
58+ 'Early Bird' ,
59+ 'Coffee Enthusiast' ,
60+ 'Mystery Shopper' ,
61+ 'Speed Browser' ,
62+ 'Deep Diver' ,
63+ 'Curious Cat' ,
64+ 'The Navigator' ,
65+ 'Midnight Explorer' ,
66+ 'Ghost Surfer' ,
67+ 'Stealth Visitor' ,
68+ 'Quick Glancer' ,
69+ 'The Wanderer' ,
70+ 'Deep Reader' ,
71+ 'Power User' ,
72+ 'The Strategist' ,
73+ 'Window Shopper' ,
74+ 'The Insider' ,
75+ 'Fast Tracker' ,
76+ 'Casual Browser' ,
77+ 'The Analyzer' ,
78+ 'Tech Savvy' ,
79+ 'The Minimalist' ,
80+ 'Design Seeker' ,
81+ 'The Collector' ,
82+ 'Info Hunter' ,
83+ 'The Observer' ,
84+ 'Detail Oriented' ,
85+ 'The Explorer' ,
86+ 'Silent Watcher' ,
87+ 'Quick Decider' ,
88+ 'The Researcher' ,
89+ 'Product Hunter' ,
90+ 'The Reviewer' ,
91+ 'Efficient Visitor' ,
92+ 'The Planner' ,
93+ 'Impulse Shopper' ,
94+ 'The Thinker' ,
95+ 'Action Seeker' ,
96+ 'Value Finder' ,
97+ 'The Connector' ,
98+ 'Quality Scout' ,
99+ 'The Evaluator' ,
100+ 'Savvy User' ,
101+ 'The Optimizer' ,
102+ 'Experience Hunter' ,
103+ 'The Curator' ,
104+ 'Smart Browser' ,
105+ 'The Pioneer' ,
99106] ;
100107
101108// Simple hash function to convert string to number
@@ -111,10 +118,9 @@ function hashString(str: string): number {
111118
112119export function generateProfileName ( visitorId : string ) : string {
113120 const hash = hashString ( visitorId ) ;
114- const prefixIndex = hash % prefixes . length ;
115- const adjIndex = Math . floor ( hash / prefixes . length ) % adjectives . length ;
116- const nounIndex =
117- Math . floor ( hash / ( prefixes . length * adjectives . length ) ) % nouns . length ;
118- return `${ prefixes [ prefixIndex ] } ${ adjectives [ adjIndex ] } ${ nouns [ nounIndex ] } ` ;
121+ const firstNameIndex = hash % firstNames . length ;
122+ const descriptorIndex =
123+ Math . floor ( hash / firstNames . length ) % descriptors . length ;
124+ return `${ firstNames [ firstNameIndex ] } ${ descriptors [ descriptorIndex ] } ` ;
119125}
120126
Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ export default function UserDetailPage() {
5353 } ) ;
5454 } , [ ] ) ;
5555
56- // Transform user profile sessions to match Session interface
5756 const transformSession = useCallback ( ( session : any ) : Session => {
5857 const countryCode = getCountryCode ( session . country || '' ) ;
5958 return {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import { useDateFilters } from '@/hooks/use-date-filters';
2828import { useProfilesData } from '@/hooks/use-dynamic-query' ;
2929import { getDeviceIcon } from '@/lib/utils' ;
3030import { dynamicQueryFiltersAtom } from '@/stores/jotai/filterAtoms' ;
31+ import { generateProfileName } from '../[userId]/_components/generate-profile-name' ;
3132
3233interface UsersListProps {
3334 websiteId : string ;
@@ -128,21 +129,24 @@ export function UsersList({ websiteId }: UsersListProps) {
128129 } ,
129130 {
130131 id : 'user_id' ,
131- header : 'User ID ' ,
132+ header : 'User' ,
132133 accessorKey : 'visitor_id' ,
133- cell : ( { row } ) => (
134- < div className = "flex items-center gap-2" >
135- < div className = "min-w-0" >
136- < div className = "truncate font-semibold text-foreground text-sm" >
137- { row . original . visitor_id . substring ( 0 , 12 ) } ...
138- </ div >
139- < div className = "truncate text-muted-foreground text-xs" >
140- ID: { row . original . visitor_id . slice ( - 8 ) }
134+ cell : ( { row } ) => {
135+ const profileName = generateProfileName ( row . original . visitor_id ) ;
136+ return (
137+ < div className = "flex items-center gap-2" >
138+ < div className = "min-w-0" >
139+ < div className = "truncate font-semibold text-foreground text-sm" >
140+ { profileName }
141+ </ div >
142+ < div className = "truncate text-muted-foreground text-xs" >
143+ ID: { row . original . visitor_id . slice ( - 8 ) }
144+ </ div >
141145 </ div >
142146 </ div >
143- </ div >
144- ) ,
145- size : 180 ,
147+ ) ;
148+ } ,
149+ size : 200 ,
146150 } ,
147151 {
148152 id : 'location' ,
You can’t perform that action at this time.
0 commit comments