refactor: restructure core architecture and responsive system
This commit implements a major architectural refactor to improve modularity, type safety, and maintainability across the codebase.
Key changes include:
- **Responsive System Refactor**: Migrated from a monolithic `useResponsive` hook to a set of specialized, granular hooks (`useBreakpoint`, `useOrientation`, `usePlatform`, etc.) located in `src/presentation/hooks/responsive`. This reduces unnecessary re-renders and improves developer experience.
- **Core Service Restructuring**: Introduced a new directory structure for services, including dedicated folders for `datasources`, `mappers`, and domain-specific types (`message`, `post`).
- **Data Layer Improvements**:
- Centralized JSON parsing logic in `src/database/core/jsonUtils.ts`.
- Cleaned up repository implementations by removing redundant local utility functions.
- Refactored `MessageMapper` to use the new centralized JSON utility.
- **Type System Cleanup**:
- Decomposed the large `src/types/dto.ts` into a modular `src/types/dto/` directory.
- Simplified `src/types/index.ts` and introduced backward-compatible aliases for core entities.
- **Utility Consolidation**:
- Created a centralized `src/utils/formatTime.ts` to replace fragmented date formatting logic across various screens and components.
- Removed deprecated responsive utility files in favor of the new hook-based system.
- **Service Logic Refinement**: Refactored `ApiClient` and `WebSocketService` to use a centralized `showVerificationModal` service, removing duplicated state management for verification prompts.
This commit is contained in:
@@ -2,33 +2,23 @@
|
||||
* Hooks 导出
|
||||
*/
|
||||
|
||||
// ==================== 新的响应式 Hooks (推荐) ====================
|
||||
// ==================== 响应式 Hooks ====================
|
||||
export {
|
||||
// 核心 hooks
|
||||
useBreakpoint,
|
||||
useFineBreakpoint,
|
||||
useBreakpointGTE,
|
||||
useBreakpointLT,
|
||||
useBreakpointBetween,
|
||||
useScreenSize,
|
||||
useWindowDimensions,
|
||||
useOrientation,
|
||||
usePlatform,
|
||||
useMediaQuery,
|
||||
useResponsiveValue,
|
||||
useResponsiveStyle,
|
||||
useColumnCount,
|
||||
useResponsiveSpacing,
|
||||
// 兼容层
|
||||
useResponsive,
|
||||
useLegacyResponsive,
|
||||
// 工具函数
|
||||
getBreakpoint,
|
||||
getFineBreakpoint,
|
||||
isBreakpointGTE,
|
||||
isBreakpointLT,
|
||||
isBreakpointBetween,
|
||||
// 常量
|
||||
BREAKPOINTS,
|
||||
FINE_BREAKPOINTS,
|
||||
} from '../presentation/hooks/responsive';
|
||||
@@ -42,25 +32,9 @@ export type {
|
||||
PlatformInfo,
|
||||
ScreenSize,
|
||||
MediaQueryOptions,
|
||||
// 兼容层类型
|
||||
ResponsiveInfo,
|
||||
} from '../presentation/hooks/responsive';
|
||||
|
||||
// ==================== 旧版响应式 Hooks (保持向后兼容) ====================
|
||||
// 注意:这些导出将在未来版本中移除,请使用新的 hooks
|
||||
export {
|
||||
BREAKPOINTS as BREAKPOINTS_OLD,
|
||||
FINE_BREAKPOINTS as FINE_BREAKPOINTS_OLD,
|
||||
} from './useResponsive';
|
||||
|
||||
export type {
|
||||
ResponsiveInfo as ResponsiveInfo_OLD,
|
||||
BreakpointKey as BreakpointKey_OLD,
|
||||
BreakpointValue as BreakpointValue_OLD,
|
||||
FineBreakpointKey as FineBreakpointKey_OLD,
|
||||
ResponsiveValue as ResponsiveValue_OLD,
|
||||
} from './useResponsive';
|
||||
|
||||
// ==================== 其他 Hooks ====================
|
||||
export {
|
||||
usePrefetch,
|
||||
@@ -123,4 +97,4 @@ export type {
|
||||
KeyboardEventType,
|
||||
PlatformKeyboardOptions,
|
||||
PlatformKeyboardResult,
|
||||
} from './usePlatformKeyboard';
|
||||
} from './usePlatformKeyboard';
|
||||
Reference in New Issue
Block a user