mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 04:26:56 +00:00
Merge pull request #147 from shumaiOne/feat/user-custom-fields
feat(metadata): add single user and multiple user custom fields
This commit is contained in:
@@ -2,4 +2,5 @@ node_modules
|
||||
dist
|
||||
.bun
|
||||
src/generated
|
||||
packages/db/src/generated
|
||||
src/ui/components/ui
|
||||
@@ -29,6 +29,8 @@ When building or editing your metadata schema, you can choose from these custom
|
||||
- **Number**: A numeric field supporting custom decimal precision (from 0 to 3 decimal places) for values like frame rates, counts, or scores.
|
||||
- **Checkbox (Toggle)**: A simple Yes/No switch for binary indicators (e.g., "VFX Required").
|
||||
- **Date**: A calendar date selector with support for custom display formats (Local, ISO, USA, Euro, Friendly) and optional time tracking.
|
||||
- **Single User**: A dropdown select field populated dynamically with team members, displaying their name and avatar.
|
||||
- **Multiple User**: A multi-choice user select field populated dynamically with team members, allowing you to assign multiple team members.
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"format": "prettier --write .",
|
||||
"db:migrate": "bun run prisma migrate dev",
|
||||
"db:deploy": "bun run prisma migrate deploy",
|
||||
"db:generate": "cd packages/db && bunx prisma generate",
|
||||
"generate-providers": "bun run scripts/generate-builtin-providers.ts",
|
||||
"worker:agent": "bun apps/agent/src/index.ts",
|
||||
"worker:transcode": "bun apps/transcode/src/index.ts",
|
||||
|
||||
@@ -204,4 +204,61 @@ describe('MetadataService', () => {
|
||||
})
|
||||
expect(val?.stringValue).toBe('some value')
|
||||
})
|
||||
|
||||
it('should save and retrieve user and userMulti metadata fields', async () => {
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'test-team' },
|
||||
})
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'test-project', teamId: team.id },
|
||||
})
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'test-asset',
|
||||
project: { connect: { id: project.id } },
|
||||
type: 'file',
|
||||
status: 'uploaded',
|
||||
sizeByte: 100,
|
||||
},
|
||||
})
|
||||
|
||||
const userField = await prisma.metadataField.create({
|
||||
data: {
|
||||
key: 'assigned_user',
|
||||
scope: 'PROJECT',
|
||||
project: { connect: { id: project.id } },
|
||||
config: { name: 'Assigned User', type: 'user' },
|
||||
},
|
||||
})
|
||||
|
||||
const userMultiField = await prisma.metadataField.create({
|
||||
data: {
|
||||
key: 'reviewers',
|
||||
scope: 'PROJECT',
|
||||
project: { connect: { id: project.id } },
|
||||
config: { name: 'Reviewers', type: 'userMulti' },
|
||||
},
|
||||
})
|
||||
|
||||
const singleUserId = 'user_ulid_123'
|
||||
const multiUserIds = ['user_ulid_456', 'user_ulid_789']
|
||||
|
||||
const reqs = [
|
||||
{ key: userField.key, value: singleUserId },
|
||||
{ key: userMultiField.key, value: multiUserIds },
|
||||
]
|
||||
|
||||
await metadataService.updateAssetMetadata(asset.id, reqs)
|
||||
|
||||
const values = await prisma.assetMetadataValue.findMany({
|
||||
where: { assetId: asset.id },
|
||||
})
|
||||
expect(values).toHaveLength(2)
|
||||
|
||||
const singleVal = values.find((v) => v.fieldKey === userField.key)
|
||||
expect(singleVal?.stringValue).toBe(singleUserId)
|
||||
|
||||
const multiVal = values.find((v) => v.fieldKey === userMultiField.key)
|
||||
expect(multiVal?.jsonValue).toEqual(multiUserIds)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -173,6 +173,8 @@ declare global {
|
||||
| 'number'
|
||||
| 'toggle'
|
||||
| 'date'
|
||||
| 'user'
|
||||
| 'userMulti'
|
||||
|
||||
export interface SelectOption {
|
||||
id: string
|
||||
@@ -208,6 +210,9 @@ declare global {
|
||||
timeFormat: string // 'twelve_hour' | 'twenty_four_hour'
|
||||
}
|
||||
|
||||
export type UserConfig = Record<string, never>
|
||||
export type UserMultiConfig = Record<string, never>
|
||||
|
||||
export interface FieldConfig {
|
||||
name: string
|
||||
type: FieldType
|
||||
@@ -219,6 +224,8 @@ declare global {
|
||||
number?: NumberConfig
|
||||
toggle?: ToggleConfig
|
||||
date?: DateConfig
|
||||
user?: UserConfig
|
||||
userMulti?: UserMultiConfig
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -9,6 +9,8 @@ export const FieldType = {
|
||||
number: 'number',
|
||||
toggle: 'toggle',
|
||||
date: 'date',
|
||||
user: 'user',
|
||||
userMulti: 'userMulti',
|
||||
} as const
|
||||
|
||||
export type FieldType = (typeof FieldType)[keyof typeof FieldType]
|
||||
@@ -22,7 +24,18 @@ export type SelectOption = z.infer<typeof selectOptionSchema>
|
||||
|
||||
export const fieldConfigSchema = z.object({
|
||||
name: z.string(),
|
||||
type: z.enum(['text', 'longText', 'select', 'selectMulti', 'rating', 'number', 'toggle', 'date']),
|
||||
type: z.enum([
|
||||
'text',
|
||||
'longText',
|
||||
'select',
|
||||
'selectMulti',
|
||||
'rating',
|
||||
'number',
|
||||
'toggle',
|
||||
'date',
|
||||
'user',
|
||||
'userMulti',
|
||||
]),
|
||||
text: z.any().optional(),
|
||||
longText: z.any().optional(),
|
||||
select: z.any().optional(),
|
||||
@@ -31,6 +44,8 @@ export const fieldConfigSchema = z.object({
|
||||
number: z.any().optional(),
|
||||
toggle: z.any().optional(),
|
||||
date: z.any().optional(),
|
||||
user: z.any().optional(),
|
||||
userMulti: z.any().optional(),
|
||||
})
|
||||
|
||||
export const createFieldRequestSchema = z.object({
|
||||
|
||||
@@ -8,6 +8,8 @@ import SelectField from './fields/select-field'
|
||||
import SelectMultiField from './fields/select-multi-field'
|
||||
import TextField from './fields/text-field'
|
||||
import ToggleField from './fields/toggle-field'
|
||||
import UserField from './fields/user-field'
|
||||
import UserMultiField from './fields/user-multi-field'
|
||||
|
||||
interface FieldRendererProps {
|
||||
config: FieldInfo['config']
|
||||
@@ -85,6 +87,22 @@ const FieldRenderer: React.FC<FieldRendererProps> = (props) => {
|
||||
onSave={props.onSave as (value: string) => void}
|
||||
/>
|
||||
)
|
||||
case 'user':
|
||||
return (
|
||||
<UserField
|
||||
{...props}
|
||||
value={props.value as string}
|
||||
onSave={props.onSave as (value: string) => void}
|
||||
/>
|
||||
)
|
||||
case 'userMulti':
|
||||
return (
|
||||
<UserMultiField
|
||||
{...props}
|
||||
value={props.value as string[]}
|
||||
onSave={props.onSave as (value: string[]) => void}
|
||||
/>
|
||||
)
|
||||
default:
|
||||
return <div>Unknown Field Type</div>
|
||||
}
|
||||
|
||||
@@ -86,6 +86,8 @@ import {
|
||||
ToggleLeft,
|
||||
Type,
|
||||
X,
|
||||
User,
|
||||
Users,
|
||||
} from 'lucide-react'
|
||||
import { useMemo, useState, useEffect } from 'react'
|
||||
|
||||
@@ -98,6 +100,8 @@ export const FIELD_TYPE_ICONS: Record<FieldType, React.ComponentType<{ className
|
||||
[FieldType.number]: Hash,
|
||||
[FieldType.toggle]: ToggleLeft,
|
||||
[FieldType.date]: Calendar,
|
||||
[FieldType.user]: User,
|
||||
[FieldType.userMulti]: Users,
|
||||
}
|
||||
|
||||
type SortableFieldItemProps = {
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
import type { UserInfo } from '@shumai/dtos'
|
||||
import { ChevronDown, X } from 'lucide-react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import type { FieldProps } from './field-types'
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
|
||||
import { useMemberStore } from '@/ui/stores/members'
|
||||
import { useTeamId } from '@/ui/hooks/use-team-id'
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
|
||||
|
||||
const UserField: React.FC<FieldProps<string>> = ({ value, onSave, readOnly }) => {
|
||||
const teamId = useTeamId()
|
||||
const { members, fetchMembers } = useMemberStore()
|
||||
const [isEditing, setIsEditing] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (teamId) {
|
||||
fetchMembers(teamId)
|
||||
}
|
||||
}, [teamId, fetchMembers])
|
||||
|
||||
const selectedUser = members.find((m) => m.id === value)
|
||||
|
||||
const handleStartEdit = () => {
|
||||
if (!readOnly) {
|
||||
setIsEditing(true)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSelect = (userId: string) => {
|
||||
onSave(userId)
|
||||
setIsEditing(false)
|
||||
}
|
||||
|
||||
const handleOpenChange = (open: boolean) => {
|
||||
if (readOnly) return
|
||||
setIsEditing(open)
|
||||
}
|
||||
|
||||
const getInitials = (name: string) => {
|
||||
return name
|
||||
.split(' ')
|
||||
.map((n) => n[0])
|
||||
.slice(0, 2)
|
||||
.join('')
|
||||
.toUpperCase()
|
||||
}
|
||||
|
||||
const renderUserBadge = (user: UserInfo | undefined) => {
|
||||
if (!user) return <span className="text-muted-foreground italic text-sm">Select user</span>
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-foreground border h-[22px]">
|
||||
<Avatar className="w-4 h-4">
|
||||
<AvatarImage src={user.image} alt={user.name} className="object-cover" />
|
||||
<AvatarFallback className="text-[8px] bg-rose-400 text-black font-semibold">
|
||||
{getInitials(user.name)}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="truncate max-w-[120px]">{user.name}</span>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="relative w-full" onClick={(e) => e.stopPropagation()}>
|
||||
<Popover open={!readOnly && isEditing} onOpenChange={handleOpenChange}>
|
||||
<PopoverTrigger asChild>
|
||||
<div
|
||||
onClick={handleStartEdit}
|
||||
className={`flex items-center justify-between w-full h-[28px] px-2 rounded border border-transparent transition-colors ${
|
||||
!readOnly ? 'cursor-pointer hover:bg-accent hover:border-border group' : ''
|
||||
}`}
|
||||
>
|
||||
{renderUserBadge(selectedUser)}
|
||||
{!readOnly && (
|
||||
<ChevronDown className="w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100" />
|
||||
)}
|
||||
</div>
|
||||
</PopoverTrigger>
|
||||
|
||||
<PopoverContent
|
||||
className="p-1 w-[--radix-popover-trigger-width] min-w-[200px] max-h-60 overflow-auto bg-popover border border-border rounded-lg shadow-lg"
|
||||
align="start"
|
||||
>
|
||||
<div
|
||||
onClick={() => handleSelect('')}
|
||||
className="px-3 py-2 text-sm text-muted-foreground hover:bg-accent cursor-pointer flex items-center gap-2 rounded-sm"
|
||||
>
|
||||
<X className="w-3 h-3" /> Clear
|
||||
</div>
|
||||
{members.map((user) => (
|
||||
<div
|
||||
key={user.id}
|
||||
onClick={() => handleSelect(user.id)}
|
||||
className="px-3 py-2 hover:bg-accent cursor-pointer flex items-center gap-2 rounded-sm"
|
||||
>
|
||||
<Avatar className="w-5 h-5">
|
||||
<AvatarImage src={user.image} alt={user.name} className="object-cover" />
|
||||
<AvatarFallback className="text-[10px] bg-rose-400 text-black font-semibold">
|
||||
{getInitials(user.name)}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="text-sm font-medium text-foreground">{user.name}</span>
|
||||
</div>
|
||||
))}
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default UserField
|
||||
@@ -0,0 +1,209 @@
|
||||
import type { UserInfo } from '@shumai/dtos'
|
||||
import { Check } from 'lucide-react'
|
||||
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react'
|
||||
import type { FieldProps } from './field-types'
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
|
||||
import { useMemberStore } from '@/ui/stores/members'
|
||||
import { useTeamId } from '@/ui/hooks/use-team-id'
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
|
||||
|
||||
const UserMultiField: React.FC<FieldProps<string[]>> = ({ value = [], onSave, readOnly }) => {
|
||||
const teamId = useTeamId()
|
||||
const { members, fetchMembers } = useMemberStore()
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
const [isEditing, setIsEditing] = useState(false)
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
const [visibleCount, setVisibleCount] = useState(value.length)
|
||||
|
||||
useEffect(() => {
|
||||
if (teamId) {
|
||||
fetchMembers(teamId)
|
||||
}
|
||||
}, [teamId, fetchMembers])
|
||||
|
||||
const selectedUsers = members.filter((m) => (value || []).includes(m.id))
|
||||
|
||||
const getInitials = (name: string) => {
|
||||
return name
|
||||
.split(' ')
|
||||
.map((n) => n[0])
|
||||
.slice(0, 2)
|
||||
.join('')
|
||||
.toUpperCase()
|
||||
}
|
||||
|
||||
// Dynamic calculation for how many items fit in one line
|
||||
useLayoutEffect(() => {
|
||||
if (isEditing || expanded) {
|
||||
setVisibleCount(selectedUsers.length)
|
||||
return
|
||||
}
|
||||
|
||||
if (containerRef.current) {
|
||||
const containerWidth = containerRef.current.offsetWidth
|
||||
const canvas = document.createElement('canvas')
|
||||
const context = canvas.getContext('2d')
|
||||
if (context) {
|
||||
context.font = '12px ui-sans-serif, system-ui, sans-serif'
|
||||
|
||||
let currentWidth = 0
|
||||
let count = 0
|
||||
const moreBadgeWidth = 28
|
||||
const maxAvailableWidth = containerWidth - moreBadgeWidth
|
||||
|
||||
for (let i = 0; i < selectedUsers.length; i++) {
|
||||
const textWidth = context.measureText(selectedUsers[i].name).width
|
||||
// 16px padding + 16px avatar + 6px gap + 4px extra gap
|
||||
const badgeWidth = textWidth + 42
|
||||
|
||||
if (currentWidth + badgeWidth > maxAvailableWidth && i < selectedUsers.length - 1) {
|
||||
break
|
||||
}
|
||||
if (i === selectedUsers.length - 1) {
|
||||
if (currentWidth + badgeWidth <= containerWidth) {
|
||||
count++
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
currentWidth += badgeWidth
|
||||
count++
|
||||
}
|
||||
setVisibleCount(count)
|
||||
}
|
||||
}
|
||||
}, [selectedUsers, isEditing, expanded, value])
|
||||
|
||||
const toggleUser = (userId: string) => {
|
||||
const currentVal = value || []
|
||||
let newVal
|
||||
if (currentVal.includes(userId)) {
|
||||
newVal = currentVal.filter((id) => id !== userId)
|
||||
} else {
|
||||
newVal = [...currentVal, userId]
|
||||
}
|
||||
onSave(newVal)
|
||||
}
|
||||
|
||||
const handlePlaceholderClick = (e: React.MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
if (isEditing) return
|
||||
|
||||
const hiddenCount = selectedUsers.length - visibleCount
|
||||
if (!expanded && hiddenCount > 0) {
|
||||
setExpanded(true)
|
||||
} else {
|
||||
if (!readOnly) {
|
||||
setIsEditing(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleOverlayClick = (e: React.MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
if (!readOnly) {
|
||||
setIsEditing(true)
|
||||
}
|
||||
}
|
||||
|
||||
const hiddenCount = selectedUsers.length - visibleCount
|
||||
const isOpen = (expanded && !isEditing) || isEditing
|
||||
|
||||
const handleOpenChange = (open: boolean) => {
|
||||
if (readOnly) return
|
||||
if (!open) {
|
||||
setExpanded(false)
|
||||
setIsEditing(false)
|
||||
}
|
||||
}
|
||||
|
||||
const renderUserBadge = (user: UserInfo) => {
|
||||
return (
|
||||
<span
|
||||
key={user.id}
|
||||
className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-foreground border whitespace-nowrap h-[22px]"
|
||||
>
|
||||
<Avatar className="w-4 h-4">
|
||||
<AvatarImage src={user.image} alt={user.name} className="object-cover" />
|
||||
<AvatarFallback className="text-[8px] bg-rose-400 text-black font-semibold">
|
||||
{getInitials(user.name)}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="truncate max-w-[100px]">{user.name}</span>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="relative w-full" onClick={(e) => e.stopPropagation()}>
|
||||
<Popover open={!readOnly && isOpen} onOpenChange={handleOpenChange}>
|
||||
<PopoverTrigger asChild>
|
||||
<div
|
||||
ref={containerRef}
|
||||
onClick={handlePlaceholderClick}
|
||||
className={`w-full px-1 py-1 flex flex-wrap gap-1 rounded border border-transparent transition-all box-border h-[32px] overflow-hidden ${
|
||||
!readOnly || hiddenCount > 0
|
||||
? 'cursor-pointer hover:bg-accent hover:border-border'
|
||||
: ''
|
||||
}`}
|
||||
>
|
||||
{selectedUsers.length === 0 && (
|
||||
<span className="text-muted-foreground text-sm italic px-1 pt-0.5">Empty</span>
|
||||
)}
|
||||
|
||||
{selectedUsers.slice(0, visibleCount).map(renderUserBadge)}
|
||||
|
||||
{hiddenCount > 0 && (
|
||||
<span className="inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground h-[22px]">
|
||||
+{hiddenCount}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</PopoverTrigger>
|
||||
|
||||
<PopoverContent
|
||||
className={`p-1 bg-popover border rounded-lg shadow-xl max-h-60 overflow-auto ${
|
||||
expanded && !isEditing
|
||||
? 'w-[--radix-popover-trigger-width] min-w-[200px] flex flex-wrap gap-1 border-ring min-h-[32px] h-auto cursor-pointer'
|
||||
: 'w-64 border-border'
|
||||
}`}
|
||||
align="start"
|
||||
onClick={expanded && !isEditing ? handleOverlayClick : undefined}
|
||||
>
|
||||
{expanded && !isEditing ? (
|
||||
<>
|
||||
{selectedUsers.length === 0 && (
|
||||
<span className="text-muted-foreground text-sm italic px-1 pt-0.5">Empty</span>
|
||||
)}
|
||||
{selectedUsers.map(renderUserBadge)}
|
||||
</>
|
||||
) : (
|
||||
members.map((user) => {
|
||||
const isSelected = (value || []).includes(user.id)
|
||||
return (
|
||||
<div
|
||||
key={user.id}
|
||||
onClick={() => toggleUser(user.id)}
|
||||
className="px-3 py-2 hover:bg-accent cursor-pointer flex items-center justify-between rounded-sm"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<Avatar className="w-5 h-5">
|
||||
<AvatarImage src={user.image} alt={user.name} className="object-cover" />
|
||||
<AvatarFallback className="text-[10px] bg-rose-400 text-black font-semibold">
|
||||
{getInitials(user.name)}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="text-sm font-medium text-foreground">{user.name}</span>
|
||||
</div>
|
||||
{isSelected && <Check className="w-4 h-4 text-primary" />}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
)}
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default UserMultiField
|
||||
@@ -15,6 +15,9 @@ import { type FieldInfo } from '@shumai/dtos'
|
||||
import { Check, ChevronDown, Trash2 } from 'lucide-react'
|
||||
import { getOptionStyle } from '../fields-manager'
|
||||
import RatingField from '../fields/rating-field'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { useMemberStore } from '@/ui/stores/members'
|
||||
import { useTeamId } from '@/ui/hooks/use-team-id'
|
||||
|
||||
interface FilterPanelProps {
|
||||
fields: FieldInfo[]
|
||||
@@ -40,13 +43,33 @@ export function FilterPanel({
|
||||
excludeFields,
|
||||
hidePrefix,
|
||||
}: FilterPanelProps) {
|
||||
const teamId = useTeamId()
|
||||
const { members, fetchMembers } = useMemberStore()
|
||||
|
||||
useEffect(() => {
|
||||
if (teamId) {
|
||||
fetchMembers(teamId)
|
||||
}
|
||||
}, [teamId, fetchMembers])
|
||||
|
||||
const memberOptions = useMemo(() => {
|
||||
return members.map((m) => ({
|
||||
id: m.id,
|
||||
displayName: m.name,
|
||||
color: 'system',
|
||||
}))
|
||||
}, [members])
|
||||
|
||||
const allFields = [
|
||||
...SYSTEM_FIELDS,
|
||||
...fields.map((f) => ({
|
||||
id: f.id!,
|
||||
label: f.config?.name || f.description || 'Unknown',
|
||||
type: getFieldType(f),
|
||||
options: f.config?.select?.options || f.config?.selectMulti?.options,
|
||||
options:
|
||||
f.config?.type === 'user' || f.config?.type === 'userMulti'
|
||||
? memberOptions
|
||||
: f.config?.select?.options || f.config?.selectMulti?.options,
|
||||
config: f.config,
|
||||
})),
|
||||
].filter((f) => !excludeFields?.includes(f.id))
|
||||
@@ -187,8 +210,9 @@ export function FilterPanel({
|
||||
}
|
||||
|
||||
function getFieldType(field: FieldInfo): string {
|
||||
if (field.config?.type === 'select') return 'select'
|
||||
if (field.config?.type === 'selectMulti') return 'selectMulti'
|
||||
if (field.config?.type === 'select' || field.config?.type === 'user') return 'select'
|
||||
if (field.config?.type === 'selectMulti' || field.config?.type === 'userMulti')
|
||||
return 'selectMulti'
|
||||
if (field.config?.type === 'number') return 'number'
|
||||
if (field.config?.type === 'date') return 'date'
|
||||
if (field.config?.type === 'rating') return 'rating'
|
||||
|
||||
@@ -5,6 +5,18 @@ import ReactDOM from 'react-dom/client'
|
||||
import { ThemeProvider } from './components/theme-provider'
|
||||
import { routeTree } from './routeTree.gen'
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
const resizeObserverErrorNames = [
|
||||
'ResizeObserver loop limit exceeded',
|
||||
'ResizeObserver loop completed with undelivered notifications.',
|
||||
]
|
||||
window.addEventListener('error', (e) => {
|
||||
if (resizeObserverErrorNames.includes(e.message)) {
|
||||
e.stopImmediatePropagation()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
// Set up a Router instance
|
||||
|
||||
Reference in New Issue
Block a user