feat(mobile): route user profile to pushed screen instead of popout
This commit is contained in:
@@ -6,23 +6,17 @@ import { MobileScreenStack } from './MobileScreenStack';
|
|||||||
import { MobileBottomNav } from './MobileBottomNav';
|
import { MobileBottomNav } from './MobileBottomNav';
|
||||||
import { useSwipeGesture } from '../../hooks/useSwipeGesture';
|
import { useSwipeGesture } from '../../hooks/useSwipeGesture';
|
||||||
|
|
||||||
// Screen components — imported as they are created in subsequent tasks.
|
|
||||||
// Inline placeholders are used until the real components exist.
|
|
||||||
const PlaceholderScreen = ({ label }: { label: string }) => (
|
|
||||||
<div className="flex-1 flex items-center justify-center bg-surface-base text-txt-secondary">
|
|
||||||
{label}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
import { MobileSpacesScreen } from './MobileSpacesScreen';
|
import { MobileSpacesScreen } from './MobileSpacesScreen';
|
||||||
import { FriendsPage } from '../chat/FriendsPage';
|
|
||||||
// These will be replaced with real imports as each task is completed:
|
|
||||||
import { MobileDmsScreen } from './MobileDmsScreen';
|
import { MobileDmsScreen } from './MobileDmsScreen';
|
||||||
import { MobileYouScreen } from './MobileYouScreen';
|
import { MobileYouScreen } from './MobileYouScreen';
|
||||||
import { MobileChatScreen } from './MobileChatScreen';
|
import { MobileChatScreen } from './MobileChatScreen';
|
||||||
import { MobileSettingsScreen } from './MobileSettingsScreen';
|
import { MobileSettingsScreen } from './MobileSettingsScreen';
|
||||||
import { MobileVoiceMiniBar } from './MobileVoiceMiniBar';
|
import { MobileVoiceMiniBar } from './MobileVoiceMiniBar';
|
||||||
import { MobileVoiceFullScreen } from './MobileVoiceFullScreen';
|
import { MobileVoiceFullScreen } from './MobileVoiceFullScreen';
|
||||||
|
import { MemberSidebar } from './MemberSidebar';
|
||||||
|
import { FriendsPage } from '../chat/FriendsPage';
|
||||||
|
import { ExplorePage } from '../chat/ExplorePage';
|
||||||
|
import { UserProfileModal } from '../modals/UserProfileModal';
|
||||||
|
|
||||||
const screenMap: Record<string, (params?: Record<string, string>) => React.ReactNode> = {
|
const screenMap: Record<string, (params?: Record<string, string>) => React.ReactNode> = {
|
||||||
'channel-chat': (params) => <MobileChatScreen params={params} />,
|
'channel-chat': (params) => <MobileChatScreen params={params} />,
|
||||||
@@ -33,10 +27,17 @@ const screenMap: Record<string, (params?: Record<string, string>) => React.React
|
|||||||
'settings-privacy': () => <MobileSettingsScreen initialPanel="privacy" />,
|
'settings-privacy': () => <MobileSettingsScreen initialPanel="privacy" />,
|
||||||
'settings-connections': () => <MobileSettingsScreen initialPanel="connections" />,
|
'settings-connections': () => <MobileSettingsScreen initialPanel="connections" />,
|
||||||
'settings-instance': () => <MobileSettingsScreen initialPanel="instance" />,
|
'settings-instance': () => <MobileSettingsScreen initialPanel="instance" />,
|
||||||
'members': () => <PlaceholderScreen label="Members" />,
|
'members': () => <MemberSidebar />,
|
||||||
'voice-full': () => <MobileVoiceFullScreen />,
|
'voice-full': () => <MobileVoiceFullScreen />,
|
||||||
'explore': () => <PlaceholderScreen label="Explore" />,
|
'explore': () => <ExplorePage />,
|
||||||
'user-profile': () => <PlaceholderScreen label="Profile" />,
|
'user-profile': (params) => {
|
||||||
|
// Open the user profile modal with the userId from params
|
||||||
|
if (params?.userId) {
|
||||||
|
// Set modalData so UserProfileModal can read it
|
||||||
|
useUIStore.getState().openModal('userProfile', { userId: params.userId });
|
||||||
|
}
|
||||||
|
return <UserProfileModal />;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export function MobileShell() {
|
export function MobileShell() {
|
||||||
|
|||||||
@@ -112,9 +112,17 @@ export const useUIStore = create<UIState>()(
|
|||||||
openImagePreview: (url) => set({ activeModal: 'imagePreview', imagePreviewUrl: url }),
|
openImagePreview: (url) => set({ activeModal: 'imagePreview', imagePreviewUrl: url }),
|
||||||
closeImagePreview: () => set({ activeModal: null, imagePreviewUrl: null }),
|
closeImagePreview: () => set({ activeModal: null, imagePreviewUrl: null }),
|
||||||
|
|
||||||
openUserProfile: (user, position) => set({
|
openUserProfile: (user, position) => {
|
||||||
userProfilePopout: { user, position }
|
if (get().isMobile) {
|
||||||
}),
|
// On mobile, push a full-screen user profile instead of a positioned popout
|
||||||
|
set((state) => ({
|
||||||
|
mobileStack: [...state.mobileStack, { screen: 'user-profile', params: { userId: user.id } }],
|
||||||
|
}));
|
||||||
|
history.pushState({ mobileScreen: 'user-profile' }, '');
|
||||||
|
} else {
|
||||||
|
set({ userProfilePopout: { user, position } });
|
||||||
|
}
|
||||||
|
},
|
||||||
closeUserProfile: () => set({
|
closeUserProfile: () => set({
|
||||||
userProfilePopout: { user: null, position: null }
|
userProfilePopout: { user: null, position: null }
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user