(type: 'profiles' | 'power-users')
| 7 | import { getProfileName } from '@/utils/getters'; |
| 8 | |
| 9 | export function useColumns(type: 'profiles' | 'power-users') { |
| 10 | const columns: ColumnDef<IServiceProfile>[] = [ |
| 11 | { |
| 12 | accessorKey: 'name', |
| 13 | header: 'Name', |
| 14 | cell: ({ row }) => { |
| 15 | const profile = row.original; |
| 16 | return ( |
| 17 | <ProjectLink |
| 18 | className="flex items-center gap-2 font-medium" |
| 19 | href={`/profiles/${encodeURIComponent(profile.id)}`} |
| 20 | title={getProfileName(profile, false)} |
| 21 | > |
| 22 | <ProfileAvatar size="sm" {...profile} /> |
| 23 | {getProfileName(profile)} |
| 24 | </ProjectLink> |
| 25 | ); |
| 26 | }, |
| 27 | }, |
| 28 | { |
| 29 | accessorKey: 'referrer', |
| 30 | header: 'Referrer', |
| 31 | cell({ row }) { |
| 32 | const { referrer, referrer_name } = row.original.properties; |
| 33 | const ref = referrer_name || referrer; |
| 34 | return ( |
| 35 | <div className="flex min-w-0 items-center gap-2"> |
| 36 | <SerieIcon name={ref} /> |
| 37 | <span className="truncate">{ref}</span> |
| 38 | </div> |
| 39 | ); |
| 40 | }, |
| 41 | }, |
| 42 | { |
| 43 | accessorKey: 'country', |
| 44 | header: 'Country', |
| 45 | cell({ row }) { |
| 46 | const { country, city } = row.original.properties; |
| 47 | return ( |
| 48 | <div className="flex min-w-0 items-center gap-2"> |
| 49 | <SerieIcon name={country} /> |
| 50 | <span className="truncate">{city}</span> |
| 51 | </div> |
| 52 | ); |
| 53 | }, |
| 54 | }, |
| 55 | { |
| 56 | accessorKey: 'os', |
| 57 | header: 'OS', |
| 58 | cell({ row }) { |
| 59 | const { os } = row.original.properties; |
| 60 | return ( |
| 61 | <div className="flex min-w-0 items-center gap-2"> |
| 62 | <SerieIcon name={os} /> |
| 63 | <span className="truncate">{os}</span> |
| 64 | </div> |
| 65 | ); |
| 66 | }, |
no test coverage detected