Linking backend data to frontend
This commit is contained in:
30
frontend/types/detectors.ts
Normal file
30
frontend/types/detectors.ts
Normal 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
53
frontend/types/index.ts
Normal 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
|
||||
}
|
||||
1
frontend/types/progress-webpack-plugin.d.ts
vendored
Normal file
1
frontend/types/progress-webpack-plugin.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare module 'progress-webpack-plugin';
|
||||
Reference in New Issue
Block a user