1429442dbd
- Rename customs-tablet-frontend/ to public-frontend/ for broader scope - Add new pages: customs, inspection with camera integration - Add new services: apiClient.ts, backendApi.ts, normalizers.ts - Add CameraFrame component for real-time video streaming - Add scan_fixer module with clock_publisher and timestamp fix utilities - Update startup scripts to support new frontend structure - Update arm_server configuration and service files Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
'use client';
|
|
|
|
import { create } from 'zustand';
|
|
import type { CustomsDeclaration, InspectionState, Notification, User } from '@/types';
|
|
|
|
interface AppState {
|
|
user: User | null;
|
|
notifications: Notification[];
|
|
selectedCustoms: CustomsDeclaration | null;
|
|
inspection: InspectionState | null;
|
|
setUser: (user: User | null) => void;
|
|
addNotification: (notification: Notification) => void;
|
|
markNotificationRead: (id: string) => void;
|
|
setSelectedCustoms: (customs: CustomsDeclaration | null) => void;
|
|
setInspection: (inspection: InspectionState | null) => void;
|
|
updateInspectionStatus: (status: InspectionState['status']) => void;
|
|
}
|
|
|
|
export const useAppStore = create<AppState>((set) => ({
|
|
user: { name: '张三', role: '海关查验员' },
|
|
notifications: [
|
|
{ id: '1', title: '系统通知', message: '远程查验前端已连接真实后端接口', time: '当前', read: false },
|
|
],
|
|
selectedCustoms: null,
|
|
inspection: null,
|
|
|
|
setUser: (user) => set({ user }),
|
|
addNotification: (notification) => set((state) => ({ notifications: [notification, ...state.notifications] })),
|
|
markNotificationRead: (id) => set((state) => ({
|
|
notifications: state.notifications.map((notification) => (
|
|
notification.id === id ? { ...notification, read: true } : notification
|
|
)),
|
|
})),
|
|
setSelectedCustoms: (selectedCustoms) => set({ selectedCustoms }),
|
|
setInspection: (inspection) => set({ inspection }),
|
|
updateInspectionStatus: (status) => set((state) => ({
|
|
inspection: state.inspection ? { ...state.inspection, status } : null,
|
|
})),
|
|
}));
|