refactor(stores): reorganize flat store files into modular directory structure
Migrate from flat file organization to modular directory structure under src/stores/: - auth/: authStore, registerStore, verificationStore, sessionStore - call/: callStore - settings/: chatSettingsStore, themeStore - ui/: homeTabBarVisibilityStore, homeTabPressStore - utils/: routePayloadCache - group/sources.ts, group/profileResolver.ts - message/sources.ts - post/sources.ts Update all import paths across components and screens to use new module paths. Maintain backward compatibility through deprecated re-export files for gradual migration.
This commit is contained in:
@@ -49,8 +49,8 @@ import { User } from '../../types';
|
||||
import { blurActiveElement } from '../../infrastructure/platform';
|
||||
import { firstRouteParam } from '../../navigation/paramUtils';
|
||||
import * as hrefs from '../../navigation/hrefs';
|
||||
import { messageManager } from '../../stores/messageManager';
|
||||
import { groupManager } from '../../stores/groupManager';
|
||||
import { messageManager } from '../../stores/message';
|
||||
import { groupManager } from '../../stores/group';
|
||||
import MutualFollowSelectorModal from './components/MutualFollowSelectorModal';
|
||||
import { AppBackButton } from '../../components/common';
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
||||
import { spacing, borderRadius, fontSizes, useAppColors, type AppColors } from '../../theme';
|
||||
import { Avatar, Text } from '../../components/common';
|
||||
import { routePayloadCache } from '../../stores/routePayloadCache';
|
||||
import { routePayloadCache } from '../../stores';
|
||||
import { groupService } from '@/services/message';
|
||||
import { groupManager } from '../../stores/groupManager';
|
||||
import { groupManager } from '../../stores/group';
|
||||
import { GroupMemberResponse } from '../../types/dto';
|
||||
import { GroupInfoSummaryCard, DecisionFooter } from './components/GroupRequestShared';
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ import { spacing, fontSizes, borderRadius, useAppColors, type AppColors } from '
|
||||
import { useAuthStore } from '../../stores';
|
||||
import { groupService } from '@/services/message';
|
||||
import {
|
||||
createRemoteGroupMemberListSource,
|
||||
createCursorGroupMemberListSource,
|
||||
GroupMemberListSourceKind,
|
||||
IGroupMemberListPagedSource,
|
||||
} from '../../stores/groupMemberListSources';
|
||||
import { enrichGroupMembersWithUserProfiles } from '../../stores/groupMemberProfileResolver';
|
||||
ICursorGroupMemberListPagedSource,
|
||||
} from '../../stores/group';
|
||||
import { enrichGroupMembersWithUserProfiles } from '../../stores/group';
|
||||
import { Avatar, Text, Button, Loading, EmptyState, Divider, ResponsiveContainer, AppBackButton } from '../../components/common';
|
||||
import { useResponsive, useBreakpointGTE } from '../../hooks/useResponsive';
|
||||
import { useCursorPagination } from '../../hooks/useCursorPagination';
|
||||
@@ -75,8 +75,8 @@ const GroupMembersScreen: React.FC = () => {
|
||||
return GRID_CONFIG.mobile;
|
||||
}, [width]);
|
||||
|
||||
const memberListSource = useMemo<IGroupMemberListPagedSource>(() => {
|
||||
return createRemoteGroupMemberListSource(GROUP_MEMBER_REMOTE_LIST_KIND, groupId, 50);
|
||||
const memberListSource = useMemo<ICursorGroupMemberListPagedSource>(() => {
|
||||
return createCursorGroupMemberListSource(GROUP_MEMBER_REMOTE_LIST_KIND, groupId, 50);
|
||||
}, [groupId]);
|
||||
|
||||
// 使用统一数据源 + 游标 Hook 管理成员列表
|
||||
|
||||
@@ -7,10 +7,10 @@ import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { spacing, borderRadius, shadows, useAppColors, type AppColors } from '../../theme';
|
||||
import { Avatar, Text } from '../../components/common';
|
||||
import * as hrefs from '../../navigation/hrefs';
|
||||
import { routePayloadCache } from '../../stores/routePayloadCache';
|
||||
import { routePayloadCache } from '../../stores';
|
||||
import { groupService } from '@/services/message';
|
||||
import { groupManager } from '../../stores/groupManager';
|
||||
import { userManager } from '../../stores/userManager';
|
||||
import { groupManager } from '../../stores/group';
|
||||
import { userManager } from '../../stores/user';
|
||||
import { GroupInfoSummaryCard, DecisionFooter } from './components/GroupRequestShared';
|
||||
|
||||
const GroupRequestDetailScreen: React.FC = () => {
|
||||
|
||||
@@ -17,7 +17,7 @@ import { spacing, borderRadius, fontSizes, useAppColors, type AppColors } from '
|
||||
import Avatar from '../../components/common/Avatar';
|
||||
import Text from '../../components/common/Text';
|
||||
import { groupService } from '@/services/message';
|
||||
import { groupManager } from '../../stores/groupManager';
|
||||
import { groupManager } from '../../stores/group';
|
||||
import { GroupResponse, JoinType } from '../../types/dto';
|
||||
import { useCursorPagination } from '../../hooks/useCursorPagination';
|
||||
import { EmptyState } from '../../components/common';
|
||||
|
||||
@@ -37,7 +37,7 @@ import { Text, ResponsiveContainer } from '../../components/common';
|
||||
import { useCursorPagination } from '../../hooks/useCursorPagination';
|
||||
import * as hrefs from '../../navigation/hrefs';
|
||||
import { useMessageManagerSystemUnreadCount } from '../../stores';
|
||||
import { messageManager } from '../../stores/messageManager';
|
||||
import { messageManager } from '../../stores/message';
|
||||
|
||||
const MESSAGE_TYPES = [
|
||||
{ key: 'all', title: '全部' },
|
||||
|
||||
@@ -22,8 +22,8 @@ import { authService } from '@/services/auth';
|
||||
import { messageService } from '@/services/message';
|
||||
import { ApiError } from '@/services/core';
|
||||
import { messageRepository, conversationRepository } from '@/database';
|
||||
import { messageManager } from '../../stores/messageManager';
|
||||
import { userManager } from '../../stores/userManager';
|
||||
import { messageManager } from '../../stores/message';
|
||||
import { userManager } from '../../stores/user';
|
||||
import { Avatar, Text, Button, Loading, Divider } from '../../components/common';
|
||||
import { User } from '../../types';
|
||||
import * as hrefs from '../../navigation/hrefs';
|
||||
|
||||
@@ -20,7 +20,7 @@ import { Avatar, Text } from '../../../../components/common';
|
||||
import { useAppColors, spacing, fontSizes, shadows, type AppColors } from '../../../../theme';
|
||||
import { GroupMemberResponse, GroupResponse, GroupAnnouncementResponse } from '../../../../types/dto';
|
||||
import { useBreakpointGTE } from '../../../../hooks/useResponsive';
|
||||
import { groupManager } from '../../../../stores/groupManager';
|
||||
import { groupManager } from '../../../../stores/group';
|
||||
import { groupService } from '@/services/message';
|
||||
|
||||
const { width: screenWidth } = Dimensions.get('window');
|
||||
|
||||
@@ -20,7 +20,7 @@ import { Avatar, Text } from '../../../../components/common';
|
||||
import { useAppColors, spacing, fontSizes, shadows, borderRadius, type AppColors } from '../../../../theme';
|
||||
import { GroupMemberResponse, GroupResponse, GroupAnnouncementResponse } from '../../../../types/dto';
|
||||
import { useBreakpointGTE } from '../../../../hooks/useResponsive';
|
||||
import { groupManager } from '../../../../stores/groupManager';
|
||||
import { groupManager } from '../../../../stores/group';
|
||||
import { groupService } from '@/services/message';
|
||||
|
||||
const { width: screenWidth } = Dimensions.get('window');
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
} from '../../../../types/dto';
|
||||
import { spacing, useAppColors, type AppColors } from '../../../../theme';
|
||||
import { SenderInfo } from './types';
|
||||
import { useChatSettingsStore } from '../../../../stores/chatSettingsStore';
|
||||
import { useChatSettingsStore } from '../../../../stores/settings';
|
||||
|
||||
const IMAGE_MAX_WIDTH = 200;
|
||||
const IMAGE_MAX_HEIGHT = 260;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { StyleSheet, ViewStyle, TextStyle } from 'react-native';
|
||||
import { spacing, type AppColors } from '../../../../theme';
|
||||
import { useChatSettingsStore } from '../../../../stores/chatSettingsStore';
|
||||
import { useChatSettingsStore } from '../../../../stores/settings';
|
||||
|
||||
// 默认圆角,但会从 store 读取
|
||||
export const BUBBLE_RADIUS = 16;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { useMemo } from 'react';
|
||||
import { StyleSheet, Dimensions } from 'react-native';
|
||||
import { spacing, shadows, useAppColors, type AppColors } from '../../../../theme';
|
||||
import { useChatSettingsStore, CHAT_THEMES } from '../../../../stores/chatSettingsStore';
|
||||
import { useChatSettingsStore, CHAT_THEMES } from '../../../../stores/settings';
|
||||
|
||||
const { width: SCREEN_WIDTH } = Dimensions.get('window');
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ import { ApiError } from '@/services/core';
|
||||
// 【新架构】使用 MessageManager
|
||||
import { useChat, useGroupTyping, useGroupMuted, messageManager, callStore } from '../../../../stores';
|
||||
import { groupService } from '@/services/message';
|
||||
import { userManager } from '../../../../stores/userManager';
|
||||
import { groupManager } from '../../../../stores/groupManager';
|
||||
import { userManager } from '../../../../stores/user';
|
||||
import { groupManager } from '../../../../stores/group';
|
||||
import * as hrefs from '../../../../navigation/hrefs';
|
||||
import { firstRouteParam } from '../../../../navigation/paramUtils';
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user