Files
Stojan DimitrovskiandJoshen Lim 0a3f4184a7 feat: optimized users page (#39349)
* feat: optimized users page

* Update UI

* Reinstate footer with count if mode is freeform

* Simplify disabled sort in performance mode

* Clean

* Small fix

* Final fixes

* Shift users SQL query to packages/pg-meta

* Nit unrelated: Clear query params from useLogsUrlState when going to logs tab of a selected user

* Shift user count SQL and get count estimate SQL into packages/pg-meta

* Fix

* Nit

* Nit

* Minor nits

* Refactor UX for searching

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-14 15:02:00 +08:00

49 lines
2.0 KiB
TypeScript

import { BASE_PATH } from 'lib/constants'
import { PROVIDER_PHONE, PROVIDERS_SCHEMAS } from '../AuthProvidersFormValidation'
export type Filter = 'all' | 'verified' | 'unverified' | 'anonymous'
export const UUIDV4_LEFT_PREFIX_REGEX =
/^(?:[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
export const PHONE_NUMBER_LEFT_PREFIX_REGEX = /^[+]?[0-9]{0,15}$/
export const PANEL_PADDING = 'px-5 py-5'
// [Joshen] Temporary fix as bulk delete will fire n requests since Auth + API do not have a bulk delete endpoint yet
export const MAX_BULK_DELETE = 20
export const PROVIDER_FILTER_OPTIONS = PROVIDERS_SCHEMAS.map((provider) => ({
name: provider.title,
value: 'key' in provider ? provider.key : provider.title.toLowerCase(),
icon: `${BASE_PATH}/img/icons/${provider.misc.iconKey}.svg`,
iconClass: provider.title === 'GitHub' ? 'dark:invert' : '',
})).concat(
PROVIDER_PHONE.properties.SMS_PROVIDER.enum.map((x) => ({
name: x.label,
value: x.value,
icon: `${BASE_PATH}/img/icons/${x.icon}`,
iconClass: '',
}))
)
export type UsersTableColumn = {
id: string
name: string
minWidth?: number
width?: number
resizable?: boolean
}
export type ColumnConfiguration = { id: string; width?: number }
export const USERS_TABLE_COLUMNS: UsersTableColumn[] = [
{ id: 'img', name: '', minWidth: 95, width: 95, resizable: false },
{ id: 'id', name: 'UID', width: 280 },
{ id: 'name', name: 'Display name', minWidth: 0, width: 150 },
{ id: 'email', name: 'Email', width: 300 },
{ id: 'phone', name: 'Phone' },
{ id: 'providers', name: 'Providers', minWidth: 150 },
{ id: 'provider_type', name: 'Provider type', minWidth: 150 },
{ id: 'created_at', name: 'Created at', width: 260 },
{ id: 'last_sign_in_at', name: 'Last sign in at', width: 260 },
]