Linking backend data to frontend

This commit is contained in:
iv_vuytsik
2025-10-15 19:49:19 +03:00
parent ea1f50c1b8
commit 2b19ed246b
28 changed files with 959 additions and 385 deletions

View File

@@ -0,0 +1,30 @@
export interface DetectorType {
detector_id: number
name: string
object: string
status: string
checked: boolean
type: string
location: string
floor: number
notifications: NotificationType[]
}
export interface NotificationType {
id: number
detector_id: number
detector_name: string
type: string
status: string
message: string
timestamp: string
location: string
object: string
acknowledged: boolean
priority: string
}
export interface DetectorsDataType {
detectors: Record<string, DetectorType>
objects?: Record<string, any>
}

53
frontend/types/index.ts Normal file
View File

@@ -0,0 +1,53 @@
// Re-export all type modules so `@/app/types` resolves correctly
export * from './detectors'
// Form validation
export interface ValidationRules {
required?: boolean
minLength?: number
pattern?: RegExp
// add other rule fields as needed
}
export type ValidationErrors = Record<string, string>
// UI component props
export interface ButtonProps {
onClick?: () => void
className?: string
text?: string
leftIcon?: React.ReactNode
midIcon?: React.ReactNode
rightIcon?: React.ReactNode
type?: 'button' | 'submit' | 'reset'
disabled?: boolean
size?: 'sm' | 'md' | 'lg'
variant?: 'default' | 'text'
}
export interface ToastProps {
type: 'error' | 'success' | 'loading'
message: string
action?: {
text: string
onClick: () => void
}
duration?: number
}
export interface TextInputProps {
value: string
handleChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
label?: string
placeholder?: string
name: string
type?: 'text' | 'email' | 'password' | 'datetime-local' | 'date'
className?: string
maxLength?: number
tooltip?: string | React.ReactNode
style: string
isPassword?: boolean
isVisible?: boolean
togglePasswordVisibility?: () => void
error?: string
min?: string
}

View File

@@ -0,0 +1 @@
declare module 'progress-webpack-plugin';