Users.constants.ts52 lines · main
| 1 | import { type OptimizedSearchColumns } from '@supabase/pg-meta' |
| 2 | |
| 3 | import { PROVIDER_PHONE, PROVIDERS_SCHEMAS } from '../AuthProvidersFormValidation' |
| 4 | import { BASE_PATH } from '@/lib/constants' |
| 5 | |
| 6 | export type Filter = 'all' | 'verified' | 'unverified' | 'anonymous' |
| 7 | |
| 8 | export type SpecificFilterColumn = OptimizedSearchColumns | 'name' | 'freeform' |
| 9 | |
| 10 | export const UUIDV4_LEFT_PREFIX_REGEX = |
| 11 | /^(?:[0-9a-f]{1,8}|[0-9a-f]{8}-|[0-9a-f]{8}-[0-9a-f]{1,4}|[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{0,3}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{0,3}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{0,12})$/i |
| 12 | |
| 13 | export const PHONE_NUMBER_LEFT_PREFIX_REGEX = /^[+]?[0-9]{0,15}$/ |
| 14 | |
| 15 | export const PANEL_PADDING = 'px-5 py-5' |
| 16 | |
| 17 | // [Joshen] Temporary fix as bulk delete will fire n requests since Auth + API do not have a bulk delete endpoint yet |
| 18 | export const MAX_BULK_DELETE = 20 |
| 19 | |
| 20 | export const PROVIDER_FILTER_OPTIONS = PROVIDERS_SCHEMAS.map((provider) => ({ |
| 21 | name: provider.title, |
| 22 | value: 'key' in provider ? provider.key : provider.title.toLowerCase(), |
| 23 | icon: `${BASE_PATH}/img/icons/${provider.misc.iconKey}.svg`, |
| 24 | iconClass: provider.title === 'GitHub' ? 'dark:invert' : '', |
| 25 | })).concat( |
| 26 | PROVIDER_PHONE.properties.SMS_PROVIDER.enum.map((x) => ({ |
| 27 | name: x.label, |
| 28 | value: x.value, |
| 29 | icon: `${BASE_PATH}/img/icons/${x.icon}`, |
| 30 | iconClass: '', |
| 31 | })) |
| 32 | ) |
| 33 | |
| 34 | export type UsersTableColumn = { |
| 35 | id: string |
| 36 | name: string |
| 37 | minWidth?: number |
| 38 | width?: number |
| 39 | resizable?: boolean |
| 40 | } |
| 41 | export type ColumnConfiguration = { id: string; width?: number } |
| 42 | export const USERS_TABLE_COLUMNS: UsersTableColumn[] = [ |
| 43 | { id: 'img', name: '', minWidth: 95, width: 95, resizable: false }, |
| 44 | { id: 'id', name: 'UID', width: 280 }, |
| 45 | { id: 'name', name: 'Display name', minWidth: 0, width: 150 }, |
| 46 | { id: 'email', name: 'Email', width: 300 }, |
| 47 | { id: 'phone', name: 'Phone' }, |
| 48 | { id: 'providers', name: 'Providers', minWidth: 150 }, |
| 49 | { id: 'provider_type', name: 'Provider type', minWidth: 150 }, |
| 50 | { id: 'created_at', name: 'Created at', width: 260 }, |
| 51 | { id: 'last_sign_in_at', name: 'Last sign in at', width: 260 }, |
| 52 | ] |